ABOUT
MOLLY MASON
Banner

week 08

INPUT DEVICES

Tools + Methods

Roland Modela Mill
Soldering
Arduino IDE

Board Design

This week I decided to make an ultrasonic sensor since I need to be able to detect proximity for my final project. This sensor works just like sonar! It sends sound waves out of one of it’s little speakers and listens to hear how quickly they return. Pretty cool.

Sonar

Electrical Diagram made in Eagle

Sonar

Components for Sonar

Sonar

Final Traces

Making the Board

I used Eagle to draw up a helloworld.HC-SR04 board. I wanted to add an LED but I didn't have any pins left on the ATTiny and I wanted to focus on just getting the sensor to work. I couldn’t find the HC-SR04 component in Eagle’s Fab Library but saw that it was four pads similar to the size of typical ISP pad so I added a 1x4 header with the intention of adding a female header or soldering the component directly to the chip.

Sonar

Sonar Sensor

Sonar

Sonar Sensor

Sonar

Sonar Sensor

Sonar

Sonar Sensor

Sonar

Sonar Sensor

Programming the Board

Using Arduino IDE

Once again, I worked with Arduino to program my board this week. To work with the Sonar I started with this tutorial which pretty much gave me all the code I needed to work with. Essentially, you are emitting pulses from your trigPin in which your echoPin can calculate distance based on how long it takes to receive information.

Again, I set followed the high-low tech tutorial from week 6 in order to add the additional baords to the Arduino IDE. I set my board to ATTiny 25, my processor to ATTiny 45, used the default Internal 1 MHz Clock, and set my programmer to USBTinyISP. When I first ran this code it looked like it uploaded but I had no way to access the data. I needed to add serial code to read it on the Arduino plotter. I used this page to gain some more info about serial and was able to get the serial plotter to return distances in cm to me.

Placeholder

Final Arduino Code

Placeholder

Programming the board

Placeholder

Measuring reliable distances up to 15inches (~40 cm) away

Files
Traces
Arduino Code

Copyright Molly Mason 2018, All Rights Reserved.