0
\$\begingroup\$

I want to detect the presence of a 8.4V voltage source from an Arduino, so I'm using a voltage divider to step it down to a voltage safe for the Arduino to read with an digital pin.

However, for when the Arduino is powered off, I also want an LED to light when the voltage is present.

How do I combine these two circuits? So the divider didn't waste power, I was using high values 2/1M ohms, but I have to lower those if I want there to be enough current to power the LED. I calculated the maximum resistence needed to light a red LED would be around 400 ohms. Will this circuit work?

enter image description here

This circuit essentially sits "between" a battery charger and a battery, allowing an Arduino to detect when the charger has been attached.

EP (external power) goes to an Arduino digital pin.

S1 is a normally-open magnetic reed switch closed by a magnet on the input voltage source plug. I added it because Vin is attached to a battery's positive terminal, so that's there as a safety mechanism to ensure the 8.4V contact doesn't expose live battery leads when the external plug is unplugged.

D1 is necessary to keep EP pulled low when the magnetic plug closes S1 but no power is present, indicating the charger itself is unpowered.

\$\endgroup\$
  • \$\begingroup\$ you shouldn't put a load(arduino and LED) in parallel with the battery in the charger.. did I miss understand something? \$\endgroup\$ – Wesley Lee May 9 '16 at 16:50
  • \$\begingroup\$ What battery(how much voltage) do you use to power your arduino? What is the forward voltage of your LED?..... You dont have to use an ADC for this but use appropriate resistors so that voltage at the voltage divider can just reach the level where the arduino can detect as a positive 1 if you have adapter power and will obviously be 0 if not present since you have a reverse biased diode. \$\endgroup\$ – Jasser May 9 '16 at 18:24
  • \$\begingroup\$ @WesleyLee, Why is that? The Arduino is the primary load of the entire system and needs to remain on when the battery is recharging. That's currently what I have wired and it's working fine... \$\endgroup\$ – Cerin May 9 '16 at 22:08
  • \$\begingroup\$ @Jasser, The battery is a 2S lipo which holds a maximum charge of 8.4V, but that's fed to the Arduino via a switching 5V UBEC. The LED's Vf is 1.8v. You're right about the ADC. That's a typo. I'm using a regular digital input. \$\endgroup\$ – Cerin May 9 '16 at 22:11
  • \$\begingroup\$ cause the charger that charges the battery does not know there is an arduino in parallel. It feeds a given current then maintains a given tension on the battery to charge, if you have an arduino in parallel you will throw the measurements off. If its a small load it will make a little difference but later it may cause problems \$\endgroup\$ – Wesley Lee May 9 '16 at 22:24
1
\$\begingroup\$

Looks like it should work. You'll have about 8V at Vin, depending on the voltage drop across D1. That's fine since the Arduino's voltage regulator should handle that nicely.

You'll have about 4V at EP, a bit low for a 5V Arduino, but should work. If you have a 3.3V Arduino, that could be a bigger problem.

You'll have about 16.5mA going through the red LED, so if you're using one of the basic 5mm LED they usually have a max current of 20mA and a suggested current of between 16 and 18 mA. So perfect there.

However, if you wanted to use standard resistor values and get your EP voltage closer to 5V, you could do this. The current through the LED would be just over 17 mA, brighter, but still within suggested range.

enter image description here

\$\endgroup\$
0
\$\begingroup\$

If I am right than nobody would want the battery to discharge if you already have a power adapter(when your mom is paying your bills).

Since the battery and adapters voltage are same The current flowing through the diode is zero and the adapter is not used at all to power your arduino but instead the battery does. I am sure that you dont want to waste your battery's charge when adapter is already connected.

However the LED would glow and take the current from the adapter. Also the voltage you get at the EP pin would be 4V which is enough to be detected by the arduino. So no problems there with the LED. When the adapter is not there the LED would not light up for sure since you have diode in reverse biased state.

I would recommend to go for another circuit where you utilize either a battery or the adapter to power your arduino.

\$\endgroup\$
  • \$\begingroup\$ This is incorrect. I already have a circuit, minus the led, both charging and powering the Arduino, so no, the diode doesn't stop the charger from powering the Arduino... I don't understand how you would think that. The diode's only purpose is to stop the battery from flowing back through this circuit and giving EP a false reading. \$\endgroup\$ – Cerin May 10 '16 at 15:32
  • \$\begingroup\$ @Cerin it is no way wrong.. let me tell you this way. The power is taken from the battery but not from the adapter since 8.4v is the voltage at one terminal of diode and again 8.4v on the second terminal from the battery so the voltage difference across the terminals is zero and hence no current will flow through the diode. \$\endgroup\$ – Jasser May 10 '16 at 15:43
  • \$\begingroup\$ Since no current is flowing through the diode, so current from the adapter is drawn through the diode to be used by arduino. As I said your LED would light up only when you have your adapter connected since the current required to light up the LED is taken from the adapter. \$\endgroup\$ – Jasser May 10 '16 at 15:49
  • \$\begingroup\$ If you still have problems with this then let me know where exactly. \$\endgroup\$ – Jasser May 11 '16 at 6:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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