I am planning on controlling the speed of my motor by using a voltage divider to lower the voltage of my 7.2V NiCD 2000 mah battery to a voltage low enough to be read by the analog port of my Arduino. I am going to read the value (0-1024) and send the appropriate pwm to the motor so that the motor's rpm is the same every time regardless of the voltage of my battery (which will fall with use).
Can anyone tell me:
A. Will I break something
B. Will It work
C. Is there a better way of doing this?
The Arduino is being used to send signals to my Castle Sidewinder 3 ESC to drive the 4600kV motor. It needs to run at a consistent speed every time.
A. I'm not sure, I don't know you.
B. Sure, it will work. You would need to calibrate it somehow, unless you add feedback from an RPM sensor.
C. Depends on the requirements.
aarg:
A. I'm not sure, I don't know you.
B. Sure, it will work. You would need to calibrate it somehow, unless you add feedback from an RPM sensor.
C. Depends on the requirements.
A. I mean electronically, will I fry the Arduino?
B. Gotcha thanks
C. requirements? what do you mean by that?
To make voltage to Arduino equal half the battery voltage use equal values for R1 and R2.
Two 4.7K resistors or two 10K resistors should be good values. Just make sure the values of the two resistors are close to the same value if you want half the battery voltage.
Edit: Of course values between 4.7K and 10K would work as long as the two resistors are the same value. (5.1K seems like a good value.)
Hi,
How are you going to know the speed of the motor and that it is staying constant with battery voltage.
Motor speed also changes with load on the motor.
You will need some form of motor speed feedback to the arduino, an encoder or just a simple chopper assembly may do.
TomGeorge:
Hi,
How are you going to know the speed of the motor and that it is staying constant with battery voltage.
Motor speed also changes with load on the motor.
You will need some form of motor speed feedback to the arduino, an encoder or just a simple chopper assembly may do.
Tom.....
The motor (which is being used on an R/C car for science Olympiad) will be under the exact same load every single time. I am coding in a feedback loop that takes the voltage and assigns a specific pwm that is different every run. The velocity of my vehicle needs to be nearly the same everytime, not necessarily exact
You may need to consider the internal resistance of your battery. When you sample its voltage with your Arduino, the reading you get may depend significantly on whether or not the reading is taken when the motor is drawing current; in other words whether the PWM signal is high or low. I suggest you sample the voltage frequently and use the lowest reading of the last (say) 20 sample readings to adjust the PWM (there will be higher readings when the motor is not drawing current).
ledchaser:
A) USE MOTOR Driver board its safe and cheap too.
B)DON'T ever connect any potential to analog or any pin it will toast your board
B) Bunk. You can connect a potential between 0 and Vcc to the analog pins. That's what they were designed for. I know (hope?) that is not what you meant, but please try to use specific technical language here so you're not misunderstood like this.
Don't use resistors much larger than 10k ohms or the ADC will have a hard time reading the voltage.
I don't want to start an argument but the ADC only needs 1.6 nA to read an analog voltage. I don't know how you came to the conclusion in the above statement. Can you explain what you base that statement on ? I've used Mohm values for voltage dividers with analog inputs with no problems.
raschemmel:
I don't want to start an argument but the ADC only needs 1.6 nA to read an analog voltage. I don't know how you came to the conclusion in the above statement. Can you explain what you base that statement on ? I've used Mohm values for voltage dividers with analog inputs with no problems.
The above is mostly repeating what I've read here. I recall reading this sort of thing from people I consider knowledgeable on the subject (I don't recall their names).
I haven't tried using the Arduino's ADC with high impedance sources but I was under the impression many of the commonly used ADC devices require low impedance sources to work properly.
I know the MCP3208 has this limitation.
I believe there are things one can do to mitigate this limitation. If the ADC is sampled infrequently I believe the accuracy is improved when measuring high impedance sources. A small capacitor between the ADC input and ground can also improve the ADC's performance.
Hopefully others will chime in to eliminate any uncertainty on this topic. I'll have a look at the AVR datasheet to see if it has anything to say on the topic.
Edit: As I've thought about this a bit, I realize I should have added a caveat about sampling frequency. I'm still under the impression, the Arduino's ADC has a hard time reading high impedance sources at high frequencies.
Don't use resistors much larger than 10k ohms or the ADC will have a hard time reading the voltage.
I haven't tried changing the sampling frequency specifically but I had no problem sampling at 40 kHz
using this library. The only catch is that you can't use the analog input for processing because it is stored as a BIN file on an SD card. You can
see some samples I posted on that thread. I don't remember how to change the sampling frequency but Nick GAMMON has a tutorial on it somewhere (on his website no doubt).
I can vouch for the fact that the arduino can read analog from Mohm resistor voltage dividers. It has an equivilent input impedance of 100 Mohms so it doesn't need much current to take a sample.
Maybe someone else can explain how to change the sample frequency.
The ADC is optimized for analog signals with an output impedance of approximately 10k ohm. If such a source is used, the sampling time will be negligible. If a source with higher impedance is used . . .
The datasheet goes on to describe ways to minimize the problems caused by high impedance sources.