I was trying to play with Arduino this weekend and connected a DC motor to A0 and GND to measure the voltage it provides when I rotate it.

However, when I rotate the DC motor with my fingers to test out the readings I see that when rotated clockwise it generates voltage that can be read in Arduino. But when I rotate it counter-clockwise the values I get are 0 - this is probably because DC motor generates negative voltage (?).

How do I fix this so that no matter the direction of the turn I get always positive value?

I am trying to build a simple anemometer, just for fun for kids and plot the values, however can't do much when I get 0 on analogRead when wind blows from the other direction..

enter image description here

thanks for any input into this.

  • 1
    What you're doing is a bit like using a DC motor as an AC generator. So to convert a negative voltage to a positive on in this case you can use a rectifier circuit (its basically an arrangement of 4 suitable diodes) or buy it ready made. The rectifier will make the voltage positive all the time which is what you seem to want-though youll probably need another circuit to sense the direction of the wind. A brushless DC motor is probably a good choice for making an motor based anemometer.
    – RS2322016
    Commented Sep 4, 2016 at 9:03
  • 2
    anemometers only rotate in one direction, because of the shape of the cups. PS you might want to add a resistor between the motor and the Arduino pin, to prevent damage if the voltage is above 5V or below 0V. Something like 10kOhm.
    – Gerben
    Commented Sep 4, 2016 at 9:52
  • Some anemometers do measure direction of wind e.g. see wikipedia
    – RS2322016
    Commented Sep 4, 2016 at 10:19
  • @qwerty10 some do, but not the one shown in the picture.
    – Gerben
    Commented Sep 4, 2016 at 12:25
  • @Gerben, thank you - that makes sense to allow the motor to spin in only one direction. All i really need is to show kids if there was wind or not and how 'big' it was - no details, just a fancy color graph. Let me try that, thank you all for your help.
    – PeeS
    Commented Sep 4, 2016 at 13:15

2 Answers 2


You can use full wave rectifier, but there is a significant voltage drop on it.

Another way is using Voltage divider to provide 1/2 Vcc to one of the motor terminals. But then you can measure just 1/2 Vcc in both directions (without another Voltage divider)

Something like:
enter image description here


I wouldn't connect a motor (or indeed any inductive circuit) to a semiconductor without protection. This should limit -ve as well as excessive voltages.

The simplest is to use clamp diodes to Gnd and 5V and connect the motor via a resistor. This will limit any incursions to one diode drop either side of the supply voltage, which should be safe.

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.