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..
thanks for any input into this.
-
1What 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– RS23220162016年09月04日 09:03:51 +00:00Commented Sep 4, 2016 at 9:03
-
2anemometers 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– Gerben2016年09月04日 09:52:37 +00:00Commented Sep 4, 2016 at 9:52
-
Some anemometers do measure direction of wind e.g. see wikipediaRS2322016– RS23220162016年09月04日 10:19:51 +00:00Commented Sep 4, 2016 at 10:19
-
@qwerty10 some do, but not the one shown in the picture.Gerben– Gerben2016年09月04日 12:25:03 +00:00Commented 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– PeeS2016年09月04日 13:15:36 +00:00Commented 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
-
1This is probably the easiest solution. Other option is to go for the full wave rectifier but using an op amp to take care of the voltage drop. An example can be found at http://www.eleccircuit.com/full-wave-rectifier-with-an-op-amp-ic/.Paulo Soares– Paulo Soares2016年09月04日 09:34:43 +00:00Commented Sep 4, 2016 at 9:34
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.