voltage sensor to initiate action in sketch

Hi All, I have a 4 battery rotation system that changes position at a set time interval.

I want to tell the program to go to a specified position when one of the batteries voltages is at a certain level.

4 positions, 4 batteries, 4 voltage sensors with input to read and evaluate for controlling the rotating system.

I need to learn how to have the arduino read a voltage sensor and use the info to tell the sketch to goto a certain section.

I don't need to print voltages on my screen or have a temp gauge of any kind.

I need to use battery voltage info for part of the sketch.

Can some one advise me on this?



Are you able to read the voltage and print it on the serial in the first place?

That's normally the first step beforw you use the value to control any action.

Please add schematics and the code you already have to provide any guidance.

Hi, What voltage are your batteries? Are all your batteries and Arduino controller sharing the same gnd/common?

Thanks.. Tom.. :)

Hi Tom, Thanks for responding. My batteries are 12v. Full range would be 11v-16v.

I can write to serial port.

But drawing a blank on how to use data to change rotation system to certain position.

Power supply for latching relay coils and arduino are sharing same ground, but batteries which run a Bedini SSG ("motor") do not.

I can disconnect the arduino and the motor will continue running in latest rotational position.

Looks like connecting voltage sensors would affect grounding.



Since the Arduino can be damaged by more than +5V (and it can't read any more than 5V) you need a [u]Voltage Divider[/u] (2 resistors).

Use the [u]Read Analog Voltage Example[/u] as a guide, but you'll need to scale the ADC readings to take the voltage divider into account.

Then, you'll need some if-statements to different things depending on the voltage.

But drawing a blank on how to use data to send high or low signal to pin.


I don't need to print voltages on my screen

It's a really-really good idea to print the voltages during software development. You can also print other variables or little messages so you can "see" what the program is doing. When you're done and everything works, you can take that stuff out or if it's not hurting anything and you don't need the serial connection for something else, just leave it there.

Thanks Mr doug,

I'm after it as you suggest.