First AVR Project: Ultrasonic sensor tester

OK, these are just baby steps, but I have completed my first non-Arduino micro-controller project. It is exactly twice as complicated as a blinking LED. Basically it is a board for testing HC-SR04 ultrasonic sensors. The code simply takes a measurement from the sensor and then blinks an LED with a frequency that is proportional to the reading from the sensor. In other words, as the sensor gets closer to an object then the LED flashes faster.

Screen Shot 2014-10-25 at 10.23.55 PM

So what is the point of this? Well, it does actually have two practical uses for me. Primarily it is a convenient way to test a sensor to see if it is working (much quicker than grabbing the laptop, an Arduino and a breadboard and putting together a temporary circuit). I discovered a secondary benefit too, where I can walk around and point this at different surfaces and at different angles to get a better understanding of how well these sensors work in practice.

The main purpose though was just so that I could actually complete a simple AVR project. I have a tendency to take on projects that are just beyond my current ability and then get frustrated when I can't make them work right away, although I do usually learn a lot in the process.

For this project I used an ATtiny85 (costing anywhere from less than $1 to more than $3 depending on where you buy them and how many you buy) and I could have used a lower memory version like the ATtiny25 I'm sure since the code is so simple. The full source code along with the Makefile is available in this git repo.

The board also has headers for connecting an AVR programmer so that I can reprogram the chip in the future.

Here's the complete bill of materials:

For both the female headers I just cut some headers like this down to size.

Here is the circuit diagram (also checked into the git repo).

Screen Shot 2014-10-26 at 12.51.10 PM

This is only the second circuit diagram I have produced in Eagle so far, so I am still learning. Hopefully this is accurate and makes sense!

Contact Me

Buy My Things!

I sell on Tindie

Recent Posts

Sparkfun AVC

2014 2015 2016

Archived Posts

2012 2013 2014 2015 2016 2017