Introduction: 24V Motor Controller for $24, RC & Arduino
Like many people, I have wanted to use the base of a power wheelchair for remote control projects. However, proper motor controllers are expensive, and I thought there had to be a cheaper solution. I originally bought brushed ESCs (electronic speed controllers) that are omnidirectional but fit with my goal of making it remote controllable. The ESCs were great for proof of concept, helped me size batteries but couldn't run at 24V.
I have a previous instructable detailing my journey of learning how to work with RC and Arduino. Thus, I will not cover the programming side extensively and will instead focus more on the hardware side.
My prototype above cost $120 excluding RC gear.
Power Wheelchair $Free.99
Motor Controller Electronics $24 for both motors SCORE!
Arduino Uno $35
Wire $10 and have plenty of extra
Step 1: The Basics
I'm working with brushed DC motors which makes things rather simple compared to brushless. The few basic parts are as follows.
Power Source:I chose two sealed lead acid batteries with 10Ah of capacity that should get me 20-30 minutes of use.
Fuse/Holder:Always protect your project and a good rule of thumb is to use 125% of your stall current. I floored my motors while sitting on robot on carpet and measured the current with a power analyzer. Then used the next automotive fuse up from that measured value.
High Speed Switch:A device that can ideally switch in the nanoseconds. I.E. Mosfets, Solid State Relays.
Low Speed Switch:Device that can switch in the tens of milliseconds. I.E. Standard Relays
Flyback Protection:Once you stop supplying power to the motors but they are still moving they turn into generators. You have to bypass or sink this power or you will let the magic smoke out! Also known as freewheeling, snubbing, suppression.
Step 2: Donor Machine
I picked up a Jazzy Select Elite! Sounds awesome but is cheap compared to handicap frames/motors in build and price. The motors don't have brakes other than a locking lever for parking use. They do appear to have hall effect sensors but I will not be using them at this time. I only picked up the frame with motors and wheels since the frame weighs 68lbs itself. I pitched the motor controller and controls as it would be easier to just design from scratch.
Step 3: Schematic
Almost none of the component values relate to my actual parts but it was thrown together for demonstration.
Solid State Relay SSR-40DD Hockey Puck Case
Two 12V Automotive SPDT 40A Relays
R1 1K Ohm Resistor
R2 270 Ohm Resistor
2N2222 NPN Transistor
1N5400 Flyback Diode
I have 1N4001 flyback diodes for each relay coil not shown above.
You feed the SSR a PWM signal to vary the motor speed and give the transistor a digital state to dictate motor rotation. I recommend you have forward rotation on the normally closed contacts just in case you burn up a coil. I wouldn't switch the motor rotation while at full throttle, but the relays can take some abuse.
Step 4: Arduino Wiring
Here I will label input/output pins and label where they go/come from.
Pin 2: 1st RC Input
Pin 3: 2nd RC Input
Pin 5: 1st Motor PWM Output
Pin 6: 2nd Motor PWM Output
Pin 7: 1st Motor Direction Pin Output
Pin 8: 2nd Motor Direction Pin Output
Pin 12: Wired straight to Reset Pin
5V: Receiver Power Output
Vin: 12V Battery Input
Gnd: One on Chassis, Two to Receiver
USB: Laptop, Tablet, Deathstar Debug Output
Step 5: Arduino Sketch
I'm not the best programmer but I try to comment excessively as I forget what I did yesterday.
Step 6: Previous Versions, Attempts, Failures
Everyone gives me a look when I tell them to set themselves up for failure before success! In short, take notes on what you are doing, changing, or breaking. This makes it easy to identify your mistakes so you can turn around and have a success that you learned something. When you have success you will know where it came from instead of saying "I don't know it just works now!?"
I first tried building an H-Bridge using N-channel MOSFETS. I found out that you can't use 5VDC to trigger 24VDC on the high side of the bridge. This is where a charge pump comes in, but that is where I took a detour. I didn't want to design a circuit board and go through the additional complexity of driving MOSFETS. I was kind of lazy and making circuit boards can be expensive.
My second idea, was using solid state relays (SSRs) in an H-bridge configuration. SSRs have internal circuitry/magic that makes it possible to use 5VDC to trigger 24VDC. You can also feed them a PWM signal to control the speed of the motor. I then placed an order for 10 SSRs from the wonderful Ebay....
The third idea came while I was waiting for the SSRs to arrive from China where I saved $4/ea versus ones already in the USA. What if I effectively modulated the input voltage for speed control but switched my motor wires when I wanted to go backwards? This is where I cut out three SSRs per motor and wanted to add a 24V DPDT relay. I quickly found out that these relays are expensive for a 40A load...
I kept looking for a suitable relay and came up with the idea of using two 12V single-pole double-throw (SPDT) relays. I would want to trigger both at the same time with 24V and would put the coils in series. Then each relay would be designated for the modulated voltage signal or ground/return from the motor
Step 7: A Few Caveats
A) Don't be a stick slammer with the transmitter joysticks or you will run into an issue not having a delay when your 12V relays change states. I have done a few test runs and have done fine with no delay and some abuse.
B) I programmed Elevons/Tank steering in my transmitter to make my arduino program simpler. I also was unable to achieve proper tank steering function in my previously mentioned instructable...
C) The SSRs are not a great quality and need to find a "matching" pair to use together. This means finding a set that has similar voltage drop across the output terminals and lower is better for heat buildup. Mine are around 0.6-0.7V at max throttle. This leads to uneven motor speeds while trying to go straight and would be a great time to use the integrated hall effects sensors. This isn't a huge problem now but will be as you add functionality to the base system.
D) Flyback diodes are important in protecting your electronics from the power generated when stored energy is released or your motor is freewheeling. I have my SSRs protected from the motor freewheeling by bypassing the SSRs and "charging" the batteries. Lead acid batteries can handle some amount of this where LiPO's can't. You also have to consider the scale of your battery bank versus the generated power. Also, relays release some power when switched off. It is a best case to use a flyback diode to short the coil to itself to dissipate the power from cooking your transistor.
D) I have used an Arduino Uno but have Arduino Pro Mini's I will solder into the perfboard. Also, soldering in your receiver is a great idea for routine abuse.
E) Your teacher lied to you about moving electrons being the basis of electricity. It's all done by smoke and you must do your best keeping it in the wires where it belongs! Fuse your project, and it is always better to go with fast blow fuses, like AG3 glass tubes or automotive fuses.
F) As you come up with new ways to do certain portions test them individually instead of as an entire unit. This way you focus on sub-systems that make up the whole system which makes trouble shooting easier.
G) I only "own" the picture of the robot and the schematic. The rest are on loan from Google Search under fair use guidelines.
Step 8: Next Steps
A) Incorporate hall effect sensors.
B) Replace Arduino Uno with Pro Mini.
C) Conceal electronics and clean up wiring.
D) Add kill switch/disconnect.