12V Supply to 5V Arduino Logic

Thread Starter

diedofennui

Joined Jan 17, 2020
10
Now I'm questioning the whole isolation thing. My intent was to ensure my electronics didn't fry the controller of the $25K chair. I assumed that it would be wise if I attached my system directly to the batteries instead of the controller. I realize that since the two systems are attached to the same 24V series of two batteries it isn't truly electrically isolated. My board will start with a fuse and a circuit to ensure power can't flow backwards.

As the project has progressed I've realized that using the smallest amount of current is more important than isolation since the power source is batteries. This begs the question: does the voltage divider or the optocoupler use more current?
 
Last edited:

ericgibbs

Joined Jan 29, 2010
18,849
hi,
A resistive divider, 'looking' into a Ardunio port pin would draw micro-amperes, compared to a Opto which would require ~10mA.
E
 

Reloadron

Joined Jan 15, 2015
7,517
This begs the question: does the voltage divider or the optocoupler use more current?
Well beyond what Eric has pointed out, back to some of the beginnings.
I'm creating a LED lighting system as an add-on to a powered wheelchair. My intention is to not connect it to any point of the electronic control system of the chair. The one thing I do need to know is when 12V power is supplied to the headlights of the chair. I thought if I used an optocoupler I could retain the isolation of my system.
So you are adding LED headlights or you are adding to existing? Figure it this way, in addition to a divider or opto-coupler you will apparently be powering some form of micro-controller. Pretty obvious by the thread title. All things considered I would just run with the divider network since whatever uC you choose will also be powered by the existing battery. Your uC common will be the same battery common right?

Ron
 

Reloadron

Joined Jan 15, 2015
7,517
Why does that info need to be passed to the chair if your lighting is not affecting the chair control? It will be obvious to the user when the lights are on :).
Initially I thought, based on the first several post, that the object was to know when existing headlights were on? Now I am not sure exactly what the object of all of this is.

Ron
 

Thread Starter

diedofennui

Joined Jan 17, 2020
10
The chair comes with a power controller, drive system, headlights, taillights etc.. I am building a separate microcontroller driven LED strip lighting board. So my aim is to sense when 12V is applied to the built in lights (turning them on) so I can turn on my LED strip lighting at the same time.
 

Thread Starter

diedofennui

Joined Jan 17, 2020
10
So my conclusion is to use a 12V voltage divider. I've chosen resistor values of 7K and 4.5K for an output voltage of 4.7V and a leakage current of barely over 1mA. Will this divider hold the microcontroller pin low when the 12V is absent?
 

dendad

Joined Feb 20, 2016
4,476
So my conclusion is to use a 12V voltage divider. I've chosen resistor values of 7K and 4.5K for an output voltage of 4.7V and a leakage current of barely over 1mA. Will this divider hold the microcontroller pin low when the 12V is absent?
That will be ok, but why not use the analogRead(pin) function as mentioned above?
 

Reloadron

Joined Jan 15, 2015
7,517
So my conclusion is to use a 12V voltage divider. I've chosen resistor values of 7K and 4.5K for an output voltage of 4.7V and a leakage current of barely over 1mA. Will this divider hold the microcontroller pin low when the 12V is absent?
That should work fine. That or as mentioned an analog read with a greater than. The resistance values I mentioned earlier were based on readily available off the shelf resistors which should be easy to find. Yes, in the absence of 12 volts the divider out will be zero or close enough to a logic low, give this a read:

LOW
The meaning of LOW also has a different meaning depending on whether a pin is set to INPUT or OUTPUT. When a pin is configured as an INPUT with pinMode(), and read with digitalRead(), the Arduino (ATmega) will report LOW if:
  • a voltage less than 1.5V is present at the pin (5V boards)
  • a voltage less than 1.0V (Approx) is present at the pin (3.3V boards)
When a pin is configured to OUTPUT with pinMode(), and set to LOW with digitalWrite(), the pin is at 0 volts (both 5V and 3.3V boards). In this state it can sink current, e.g. light an LED that is connected through a series resistor to +5 volts (or +3.3 volts).

The link provides a full read on the subject but the above covers it.

Ron
 

ElectricSpidey

Joined Dec 2, 2017
2,779
“I realize that since the two systems are attached to the same 24V series of two batteries it isn't truly electrically isolated.”

So what happens if the lighting is switched low side?
 

Thread Starter

diedofennui

Joined Jan 17, 2020
10
That will be ok, but why not use the analogRead(pin) function as mentioned above?
Using analog read to measure battery charge is a great idea. The only problem is that the chair's lighting output is always 12V no matter the charge level of the battery because of the voltage converter in the chair's power module.
 

Thread Starter

diedofennui

Joined Jan 17, 2020
10
“I realize that since the two systems are attached to the same 24V series of two batteries it isn't truly electrically isolated.”

So what happens if the lighting is switched low side?
Not sure what you mean. My understanding is there would be two states: +12V or 0V. I did ask everyone whether the voltage divider would act as a pull down to avoid a floating pin.
 

ElectricSpidey

Joined Dec 2, 2017
2,779
From the statement I quoted, I can only assume the two systems will share a common ground, if this is the case and the lighting is switched on the low side, the pin will never go low.

If the lighting is switched on the high side, then there is no problem.
 

Janis59

Joined Aug 21, 2017
1,849
When anyone uses the Arduino or any other Atmel 328 based circuit it indicates the speed is not the problem for this application. Thus, when I have to, I am using it with solely 3v3 Vcc but then one thing must be done - just 16 MHz quartz must be shifted to 8 MHz. Circuit may not work on full speed at low supply voltage. Thats is solely one implication, all other works on it better than best.
 
Top