baconwaifu / propforth

Automatically exported from code.google.com/p/propforth
0 stars 0 forks source link

SR04 stops after long distances #195

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

SR04 ultrasonic range finder in BOT 1 confiuration

330 ohn resistor on echo pin.

When target is close (300mm or less) SR04 measures fine.

When aimed at a distant target, (greater than 1 meter) Pin 16 appears to remain 
high and no further updates to the distance value are observed.

Gut feeling is the long distance times out inside the SR04, but did not test 
yet. 

Original issue reported on code.google.com by prof.bra...@gmail.com on 4 Jun 2013 at 6:08

GoogleCodeExporter commented 8 years ago
SR04 is connected to Vin, USB or 4*AA alkaline batteries, I did not use the 
NiMh yet. 

Original comment by prof.bra...@gmail.com on 4 Jun 2013 at 6:10

GoogleCodeExporter commented 8 years ago

Original comment by prof.bra...@gmail.com on 7 Jun 2013 at 1:25

GoogleCodeExporter commented 8 years ago
sr04 trig is on pin 16
sr04 echo is on pin 17 (with 220-330 ohm resistor in series)

Why does pin 18 flicker with readings?  nothing is connected to any pins aside 
from 16 and 17, Vin and GND

Original comment by prof.bra...@gmail.com on 11 Jun 2013 at 4:05

GoogleCodeExporter commented 8 years ago
From the forums: lloks like I had the decimal point off by about one place

[QUOTE=Martin_H;1189552].. but if you are using a single series resistor you 
need to use one around 3.9 kOhm [/QUOTE]

So I had the original in line resistor off by around an order of magnitude...  
Makes more sense now. 

I tried the method from propellerpowered 
http://propellerpowered.com/shop/?page_id=1789 but 10k did not work on my rig. 
It only read 54 mm max reading. 

I looked at the Sparkfun page 
https://learn.sparkfun.com/tutorials/voltage-dividers/all

and this suggested using a voltage divider with 1.7k ohms near the echo pin and 
3.3k ohm going to ground, with the prop pin in between. I found 1.8 k and 3.3 k 
resistors.   Tried it, this totally functions great, so I know that at least 
the parts are working.  The pin 18 flashing has stopped, and it reads up to 5 
meters.  

I still need to use only one part, if possible. Now I will go try the single 
3.9k ohm resistor in line from echo to the prop input. How do we figure the 
best value for the single in line resistor?  Just ohm's law, 5 volts divided by 
.oo1 amp to get 5000 ohm, then find what closest in the parts box?  I do have 
3.9 k ohm resistors, so this would be 5 / 3900 =.0012.. so 1.2 milliamps is ok? 

Original comment by prof.bra...@gmail.com on 12 Jun 2013 at 3:25

GoogleCodeExporter commented 8 years ago

Original comment by prof.bra...@gmail.com on 12 Jun 2013 at 3:25

GoogleCodeExporter commented 8 years ago
The 1.7 L ohm and 3.3 k ohm resistor voltage divider works, but the 3.9 k ohm 
resistor between echo and the propinput pin 17 does NOT work on my rig.  

There is a possibility that the internal prop pin circuitry was damaged in 
testing on my rig. 

Will update the pages to include this new knowledge. 

Original comment by prof.bra...@gmail.com on 12 Jun 2013 at 4:46

GoogleCodeExporter commented 8 years ago
info in these threads:
http://forums.parallax.com/showthread.php/148489-SR04-5-volt-to-3.3-volt
http://forums.parallax.com/showthread.php/148527-Input-clamping-diode-5v-to-3.3-
volt-Max-and-Min-resistors

Solution is:
1) Use 4 NiMH batteries, and ensure proper voltage;
2) use 10k resistor. 

Original comment by prof.bra...@gmail.com on 24 Jun 2013 at 6:52