Main Menu

Help me Ping!

Started by mdt, August 28, 2014, 06:48:13 PM

mdt

Hi,

I have a moteino r.4 and a box full of hc-sr04 range sensors.  The moteino is hooked to a 3V FTDI USB cable so that I can program it and watch serial output.  This works well.  The hc-sr04 Vcc and GND is hooked to a 5.2V battery pack (4 Sanyo Eneloops).  ECHO and TRIG are hooked to the moteino's #3, and #4 IO pins.  I have tried many different permutations of the Ping sketch including the NewPing sketch, Felix's sump pump sketch, etc.  I get either "out or range" or completely bogus ranges.  I have tried four known good hc-sr04 sensors. 

Is there a logic level voltage mismatch (3V vs. 5V) that is causing the bogus range sensing? Again, the moteino is getting power from the 3V FTDI USB cable.

Thanks in advance!

Marshall

Charly86

Marshall,

Humm your moteino is powered With 3.3V this is fine, but the deal is that you connected device that send 5V (may be if there is no voltage divider on your HC-04 board).  So Arduino Pin could get up to 5.2 V which is out of spec when powered to 3V3 and could burn the connected IO.

Try putting  resitors to do a voltage divider as picture for testing

set R2 to 18K max to be safe (can be down to 10K @ 5.2V for testing)

mdt

That did the trick!  Thanks for your help!  Best Regards,  Marshall

Reck_law

I just power mr sr04 with 3.3 v from mote works fine for me