September 24, 2013 AT 1:00 am

From the Forums: Serial Sonar Sensor: ATtiny85, HC-SR04, and Arduino SoftwareSerial #arduino

Serial Sonar Sensor 2

From the Forums: Serial Sonar Sensor: ATtiny85, HC-SR04, and Arduino SoftwareSerial:

In this post I will detail how I used an ATtiny85 as a controller for an HC-SR04 sonar module (Ping sensor). The controller reads the inputs from up to 3 HC-SR04 modules and transmits the readings to an Arduino Mega via serial communication. This allows the Arduino Mega to pick up the readings whenever it is convenient rather than having to worry about complex timings. Let’s get started

First things first, we need to run the NewPing library on an ATtiny85/45/25. Until version 1.6 is released you will need to modify the library to do this. However, this removes some of the functions you might want to use on other boards. For this reason, I created the TinyNewPing Library. In it, I removed the parts that cause the errors on an ATtiny and gave it a new name so you can distinguish between the two. All the function names remain the same. If you still need more details check out THIS prior post.

Next we need the SoftwareSerial Library on the ATtiny. Luckily, this comes with the IDE and I already did a post on it. Funny how that works….

Read much more about the project here!


“D is for Diode” – Circuit Playground Episode 4 is out now! CLICK HERE TO WATCH!

Have an amazing project to share? Join the SHOW-AND-TELL every Wednesday night at 7:30pm ET on Google+ Hangouts.

Join us every Wednesday night at 8pm ET for Ask an Engineer!

Learn resistor values with Mho’s Resistance or get the best electronics calculator for engineers “Circuit Playground”Adafruit’s Apps!



No Comments

No comments yet.

Sorry, the comment form is closed at this time.