I am working on robotics project. The drive chassis is powered by a 3-cell 12V 8 Amps battery (I might also go for connecting two batteries to attain speed as my drive motors work at 24V full power). The battery can get charged up to 12.8V.

As I start driving the chassis, the voltage goes on dropping which is obvious! But that's where the problem arises. All my calculations of Arduino are based on a constant value of voltage. So when the voltage drops the calculations go wrong. I tried taking feedback from the voltage and changing the code, but it gets too complicated. I need a stable voltage of at least 11V (or 22V in the future). What can I do?

  • 1
    \$\begingroup\$ I suggest you to improve your voltage sensing and clean up your code. Such motors are normally not feed with a stable voltage, because it's somewhere between very difficult and nearly impossible. \$\endgroup\$ – Laszlo Valko Oct 7 '14 at 3:14
  • 2
    \$\begingroup\$ What exactly are you calculating with the feedback voltage? If you give us more details, I bet we can help you come up with a better method than the one you're trying. \$\endgroup\$ – Dan Laks Oct 7 '14 at 3:18
  • \$\begingroup\$ are you just using a fixed duty cycle %, assuming a certain voltage? It is very easy to use an ADC input to just scale the duty %... it is very few lines of code \$\endgroup\$ – KyranF Oct 7 '14 at 6:02
  • \$\begingroup\$ oh can I also mention that with robotics you should always be aiming to get encoder/optical sensor feedback of the speed of your wheels and have your motors driven by a "speed controller" preferrably a "PI" closed loop feedback controller. This is the best middle ground between something that works and getting too complicated \$\endgroup\$ – KyranF Oct 7 '14 at 6:06
  • \$\begingroup\$ are trying to measure the speed of the motor using the voltage or you face problem in calculating the DC voltage itself;it would be better if you could share the schematic \$\endgroup\$ – yogece Oct 7 '14 at 8:35

First, fix the code to take the measured voltage into account. No, it's not "too complicated". Get someone that knows what they are doing.

Second, regulating the voltage to motors to get specific speed or accumulated distance is futile. Measure speed or distance directly, then vary the motor drive to whatever it needs to be to produce the desired result. Due to the closed loop feedback, this will automatically compensate for the power voltage. For a little faster and more linear response (which allows the control algorithm to work more simply), I'd add a little feed-forward based on the measured power voltage. The control loop puts out a normalized drive level, and the code that sets the PWM duty cycle takes the power voltage into account so that the desired drive level is achieved independent of power voltage and transparently to the control loop. This is all well within the capability of a modern microcontroller.

  • \$\begingroup\$ Exactly. If you're driving heavy loads, you should expect the voltage to drop. And if you want to know something, measure it as directly as you can. Don't try to infer any more than you have to. Once you fix the problem that you asked about, there will be other odd behavior that will make it difficult to get an accurate calculation. Whatever quantity you're actually going for, just measure it directly. \$\endgroup\$ – AaronD Oct 7 '14 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.