# Measuring generator voltage with arduino

have this small DC motor most likely from a drill. I have tested it by hooking up an LED to it and connecting the generator shaft to a cordless drill. I pushed the drills button fully on the low setting and the LED did not burn out. So I was wondering how can I set up the arduino (Uno) so I can measure the voltage coming from the generator and see it on my computer screen?

KE7GKP:
Start by measuring the peak voltage (at maximum RPM) with a volt meter. Then use a voltage divider (two resistors) to divide that peak voltage down to a voltage that is safe for the Arduino (i.e never greater than 5V).

If you don't already have a digital multi-meter (for measuring volts, amps, ohms. etc.) you should have one if you are going to do any experimenting with electronic circuits. They can be found for as little as \$5 if you shop carefully.

Ok and after that what do I do? I mean with the code and hookup?

After you determine that your voltage will be below 5V, or can be divided down to remain under 5v, than you can connect it to one of the analog inputs,
value = analogRead (A0);
for example, and then send it via serial/usb connection to the PC and see it on the serial monitor in the IDE:
Serial.print("motor value ");
Serial.print (value, DEC); // result will be a number from 0 to 1023 with 1 = ~4.89mV (or, 5V/1023).
If you want it as a voltage, multiply it out, see FLOAT type variables in the reference section
float voltage = ((value/1023)*5); // does the math with decimal places
Serial.print (voltage, 2); // prints a number with 2 decimal places, ex 4.35

This presumes you have the basics of your sketch setup also, which I didn't go into.

After you determine that your voltage will be below 5V, or can be divided down to remain under 5v, than you can connect it to one of the analog inputs,
value = analogRead (A0);
for example, and then send it via serial/usb connection to the PC and see it on the serial monitor in the IDE:
Serial.print("motor value ");
Serial.print (value, DEC); // result will be a number from 0 to 1023 with 1 = ~4.89mV (or, 5V/1023).
If you want it as a voltage, multiply it out, see FLOAT type variables in the reference section
float voltage = ((value/1023)*5); // does the math with decimal places
Serial.print (voltage, 2); // prints a number with 2 decimal places, ex 4.35

This presumes you have the basics of your sketch setup also, which I didn't go into.

man thanks alot for this! Well I've got the gist of making a voltage divider but so far for the basic sketch setup I don't have a clue. I mean I know how to make an LED blink and set it up to do it without any help but how can I setup the sketch for this project?

BTW thanks TONS for this your really putting some effort into helping me and I appreciate it.

Follow the same sketch format.
Define the pins you're going to use
Declare the variable types

In void setup, use pinMode to define your inputs & outputs
setup serial.begin with the speed your using, use the same speed in the serial monitor

in void loop, do the analog.read of the pin and the serial.print of what to display.

See the Reference section on the home page for formatting if needed.

Try putting some code together, post it here using
[ code ] and [ /code ] (without spaces) so we can help you out more.

There's probably a tutorial even on reading the analog inputs.