Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By danbicks
#31644
mrburnette wrote:Sorry 'bout that, my bad....

Just a thought.... i reviewed a LUA implementation of the HC-SR04 and my thinking at the moment is that making that implementation work under the ESP8266 ArduinoGUI is problematic.

Rather, I think a tiny85 managing the sonic sensor would be a good way to decouple the critical timing from the ESP8266. There are several examples of the t85 and the HC-SR04,one shown here:
http://projectsfromtech.blogspot.com/2014/01/i2c-hc-sr04-sonar-module-attiny85-i2c.html

You could easily use software serial on the t85 to send the results to the ESP. A send-only lib is available that requires only 1 pin onmthe t85:
http://forum.arduino.cc/index.php?topic=112013.0

Ray



Hi Ray,

Big thanks for this. I think it should be easy enough to use an interrupt for pin change and then calculate time based on echo received and trigger. I will look in to this, I have a really cool sketch on an UNO that uses a similar method and allows for gesture control.

The aim is to make my daughter a night light as she get's frightened at night, all she has to do is swipe her hand and the NEO pixels come on. they fade down after a period of time and then finally turn off.

Thanks for your help buddy, back to bit routines again, good old assembler :)

Dans
User avatar
By Lenbok
#31707 I have a sketch using the HC-SR04 that is working fairly well. It's using the old arduino Ultrasonic.h rather than NewPing or any ESP8266 specific library. The HC-SR04 is getting 5v power, and I have both trigger and echo going through a 3.3v - 5v level shifter to the ESP (the level shifter has like 4 "channels" so it's no prob to do both - maybe you could get by on echo only?).

I'm sure it would be nice if there were a better library for this ported though, but this seems to be working well enough for now.