-1
\$\begingroup\$

I am using this analog proximity sensor with esp8266 (07)The sensor requires 5V. Whenever I power it with USB the readings are just fine (steady), moving my hand towards it and away from it reads the way it is supposed to read. But whenever I power it with a battery, the readings are random. I used a 9V battery with this regulator LM7805 equivalent to take it down to 5V at up to 1 AMP. When I tested the output voltage it was 5V, which is same as with USB power, but for some reason they produce different readings. What could possibly be wrong here? Thank you in advance.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ Can you post a schematic of the regulator circuit? It sounds like your voltage regulator is unstable (oscillating). You can use an oscilloscope and see if you have solid 5V or bouncing and down. If you don't have an oscilloscope, you can get a rough idea by using a multimeter set to AC volts. It blocks DC but oscillating 5V rail will show up as a non-zero reading. \$\endgroup\$ May 10, 2016 at 17:34
  • 1
    \$\begingroup\$ Is the battery powering only the sensor, or the whole arduino with the esp? If it's only the sensor, did you remember to connect the ground of both the battery and the rest of the circuit? If it's powering everything, check how low the voltage on the battery gets. The LM7805 may handle up to 1A, but 9V batteries will supply a fraction of that. Also be sure to add capacitors, larger and the input of the LM and smaller at the output of the LM. \$\endgroup\$
    – user68591
    May 10, 2016 at 17:36
  • \$\begingroup\$ I dont have specific schematic for this regulator but between these i think schematics \$\endgroup\$
    – sparks
    May 10, 2016 at 17:43
  • \$\begingroup\$ The battery is only powering the sensor only and yes i did connect the Ground to both.The output Voltage is just fine 5V unless if it is current issue. \$\endgroup\$
    – sparks
    May 10, 2016 at 17:48

1 Answer 1

1
\$\begingroup\$

I guess that randomness is the noise of the ANALOG values provided by the sensor. Add a capacitor to smoothen the signal you are sending to the Arduino. To maintain a constant non pulsating dc supply to the sensor add two capacitors, larger one to the input of 7805 and smaller one to the output of 7805

\$\endgroup\$
1
  • \$\begingroup\$ Thank you .But why with USB that doesn't happen? and what sizes of capacitor to use ? \$\endgroup\$
    – sparks
    May 10, 2016 at 18:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.