I’m here to show you how to use a HC-SR04 Ultrasonic Range Finder with an ATtiny85 as well as programming the ATtiny85 using the wonderful shield that randofo created.

List of materials:
ATtiny85 Programming Library
Arduino Uno
HC-SR04 Ultrasonic Range Finder and Library
Jumper Wires

Step 1: Program the Arduino

Before you connect your shield to the Arduino Uno, you’ll want to make sure you’ve put your Arduino Uno into it’s ISP mode, to do this load up your Arduino IDE and once it’s loaded go to File > Examples > ArduinoISP, now connect your Arduino up to your PC and upload the ISP sketch.

<p>Download link for the <a href="http://iteadstudio.com/?dl_id=7" rel="nofollow">HC-SR0R Library</a></p><p>is not working: can you provide a good link plse? Or can we use the regular HC-SR04 library from Arduino?</p><p></p>
<p> I am working on a project which requires that a very powerful bulb gets brighter as a person aproaches it. </p><p>How could I modify this to give an output voltage which increases in a linear fashion from 0 to 10 volts?</p><p>There are many projects on instructables and elsewhere that either use the distance information to output to a digital display or light up a few leds in steps as with car reverse sensors, but I have not found anything which will give a continous analogue output voltage neccessary to operate a lighting dimmer. Can anyone point me in the right direction?</p>
That sounds like a cool project. One way to do that would be to store values for max distance and min distance. A digital to analog output could control the light. If the subject(Range) is at max distance(maxDist), the analog value would be set to 0(0 volts), and if he's at min distance(minDist) it would be set to 255 (5 volts). Assuming the analog resolution is 8 bits. Your formula could be: <br><br>AnalogOut = ((1 - (Range - minDist) / (maxDist - minDist)) * 255)<br><br>if (Range &lt; minDist) AnalogOut = 255<br><br>You need an amplifier circuit with a gain of 2 so you can get the voltage from the 5 volts max from the analog pin to 10 volts. It would need to source enough current for the light. <br><br>In a nutshell you calculate where the subject is within min and max and get that percentage. Subtract from 1 because 0 range is 100%. Multiply by 255 to scale it to the DAC, send it out the DAC, then amplify the output. <br><br>If you don't have a DAC I bet you could use pulse width modulation and smooth it with a low pass filter. Heck you don't even need to smooth it or use an amplifier circuit if you use a mosfet or solid state relay triggered by the 5v with a 10v supply(or whatever your light requires) across the load rails of the mosfet or SSR. I'd use PWM and try to find a mosfet that works. And probably an IR light and sensor rather than the ultrasonic sensor for a wider radius but IDK.<br><br>I hope this isn't overwhelming but it's something you can work with. Have fun with it.
<p>Great tutorial! But I missed the <a href="http://iteadstudio.com/?dl_id=7" rel="nofollow">HC-SR0R Library</a>, the link is broken. Would you like to update it? I can't find the suitable library for this project. Thanks.</p>
This is cool...I like your DOOM avatar...
where can i purchase jumper wires like the ones shown??? Ive been looking for sooo long. Thanks in advance
Dealextreme has them as well. good quality and very cheap<br>http://www.dealextreme.com/p/breadboard-jumper-wires-for-electronic-diy-70-cable-pack-80208
Sparkfun.com will have jumper wires, the ones I'm using are from Earthshine Electronics
what does this contraption do?
Well the base of this project is for you to do something when an object or something else gets within a certain range, other than that it's only limited by your imagination and I/O pins
Could you suggest something that I can put behind my car to give warning when I am reserve driving
I wrote a short program that uses if_then_else statements to determine and energize one of three LEDs (green, yellow, red) depending on the distance and installed it on the back of my motorhome. Works great. I even ended up using an RGB (3n1)led to minimize the footprint. I used inches and the light stays green until 3ft then goes to blinking yellow until distance is less than 2ft. THEN red. One NOTE: the HC-SR04 is voltage sensitive and must not exceed the rated 5vcc. Unlike the arduino that can handle some variations. Its and expensive lesson.
some autobody shops sell ultrasonic parking guides, I'd advise you go check those out, I'm not sure that this could do the job.
A useful application would be in the drone community or other RC flying platforms.
Adafruit.com also has them. They have both male: https://www.adafruit.com/products/153 and female: https://www.adafruit.com/products/266.

About This Instructable




Bio: I've always taken stuff apart, almost always put it back together... I enjoy tinkering around with pretty much anything.
More by Dominion-Network:Ultrasonic Range Finder with an ATtiny85 (With Shield) LM355Z Temperature Sensor 8 LED Chaser with 74HC595 8 Bit Shift Register 
Add instructable to: