Here is a cool Brushed DC Motor driver you can use for your large two wheeled robotic projects. The first time I did this was for my R2D2 life size replica. At the moment R2D2 is in need of new shoes, so I will detail how to work on something like that later on. On this Instructable, on the other hand, I will work with a wheel chair platform, as they are great starters for two wheel robotic projects!
I have coded this algorithm a few times now. I call it RC2PWM because it picks up the Remote Control (RC) radio signal and transforms it into a Motor PWM I can use to drive a Brushed DC motor. I have coded this for HC11 (yes, I am that old...), 80C51, AVR, MSP430 and now a new microcontroller on the market, the PAC5220.
From all of these implementations, my favorite has to be the PAC5220 because of how much integration it offers. As we will see later, this is not a micro to be underestimated.
In the event you want to get deeper into how the RC2PWM algorithm works, I have detailed most of the aspects within my blog. You can find these postings here:
Having Fun With Input Captures - Part 1
Having Fun With Input Captures - Part II
PWM Outputs For Motor Control - Introduction
PWM Outputs For Motor Control - Initialization
PWM Outputs For Motor Control - Protection
PWM Outputs For Motor Control - H Bridge Theory
PWM Outputs For Motor Control - Finally, Controlling It
The Project : An Electric Wheelchair Base as a Remote Controlled Robot
To validate my RC2PWM algorithm on the new microcontroller, I will use an electric wheelchair base. This is the quickest way to get something going. I could weld a platform and go through the hassle of creating a robot, but that would take too long. What I want is to get these drivers going so I can return my R2D2 replica back into walking mode.
- One Electric Wheelchair (as far as I know, all of them are made of two large DC motors)
- Two HYDRA-X20 Body boards (EH-HYDRA-X20-1)
- Two HYDRA-BLDCM1 Three Phase Driver Head Boards (EH-BLDCM1-1)
- One RC Radio and receiver combo
- Female Spade Connector Crimp Terminals
- 14 Gage Wire
- Spade Connector Terminal Strip
- Wood Platform
- Tie Raps (or preferred method to secure wires and cables)
Step 1: The Electric Wheelchair
Obtaining The Electric Wheelchair
I spent a few days browsing the Craigslist in search of an economical electric wheelchair (EWC). My budget was $100-$150. This may seem like a ridiculous low price for an item which is priced in the thousands when new, but when these chairs are in bad shape, they can be had for such an amount.
Allow me to recommend that if you find a chair in good shape, please let some possible user take advantage from it. But if the chair is in no longer usable state, it is fair game!
I was lucky to find a gentlemen which sold me one of his old chairs for $100. This chair had seen way better days (one of the wheels is kind of wobbly), so I decided this was a no brainer! To my surprise, the batteries are in perfectly working order. BONUS!!!
Step 2: Preparing The Chair
Now, if you just want to create a remote controlled wheelchair (which I am not certain why would you), you can skip the very next step.
The first thing I did when I got the new chair was to remove the actual chair and the blue plastic cover. The blue plastic cover looks "cute" and I may use at some point in time, but at the moment it would be in the way. I may also create some completely different chassis, in which case the blue plastic is a gonner... The chair, on the other hand... Hmmm... It looks like it could come in handy if I ever want to create a space ship prop for my son. OK, but one project at a time! I always seem to get ahead of me...
When you remove the chair, chances are you will see it is actually connected to the base with a fat cable. This is how the hand controller drives the motors.
Most of the chairs I have seen have an easy to disconnect connector. Simply twist it and the chair will become separated.
Here comes a step you will need to decide on. Next thing I did was to cut the wires from the cable assembly. CHOP CHOP! Notice once you do this you will lose the ability to drive the chair with the hand controller, but most importantly, to charge the batteries with the chair's charger. Of course we could wire this later on, if needed, but it will have to be a separate (AKA ugly) connection.
If you have access to a matting connector and the respective crimps, you can create your own connector and skip on severing the wires. I did not want to bother with making a compatible cable so I just cut the wires up.
I then removed the entire wiring and prepared to add my own crimps. Yes, I realize this rat's nest is impossible to follow, which is why I have added a block diagram where we can see how the harness looked at this point in time.
Step 3: Remove The Breaks
Here is a short step and something you must also decide whether you want to do.
In order to ensure an EWC user does not start running down a slope (specially if the chair loses power), each brushed DC motor has a particle brake. This brake is always present and only when the motors move, does the electronic driver releases the braking mechanism.
I do not see why I would want my robot to have these brakes, so I decided to chop them off.
I must tell you, however, that if you decide to keep the brakes, the HYDRA-X20 solution has enough drivers to power them up. Do notice from the previous block diagram, that only one signal is used to disengage the brakes. Hence, it is my impression that all you need is a low side FET and a free wheeling diode (or a half H Bridge) to empower this feature.
Since I will not be using this feature on my R2D2 revival project, I decided would not need to worry about it with my wheel chair project either. No tight slopes for this robot, though!
Step 4: Crimping Wires
No science here. If you have never crimped wires, rest assured it is not hard at all.
I can mention, however, that to crimp the conductor side, I used the 20-22 gage crimp press. I then used the 14-18 gage crimp press to crimp the insulator side.
I needed to do this for the existing harnesses which come from the wheelchair base, and then some patch cables I will show in the step where I put it all together.
Step 5: Connect It All And Take It For A Spin!
Who is the muscles on this endeavor can be a religious discussion. Is it the DC motors, or is it the power drivers? I am going to go with: BOTH! The DC motors will transform electric energy into kinetic energy, but that insanely large electric energy can only be supplied by a mighty controller.
I am very happy with how my implementation around the PAC5220 device came up. We call it the HYDRA-X platform. If you look at the EH-HYDRA-X20-1 board, it looks like an Arduino. It is very similar. On this board, the PAC5220 is the brains, a 32 bit ARM M0 MCU.
Curiously, however, the PAC5220 is also part of the muscle system. As it turns out, to power up big and powerful FETs, we need a pre-drive stage. Usually, those blocks come in the form of discrete components. But the PAC5220 packs it all in a single device! Cool indeed!
And hence, the cherry on top (pun intended) is the FET board. Together, they form the ultimate motor driver! You can drive huge motors with this puppy!
BTW, the BLDCM1 board is meant to drive 3 phase BLDC motors, and I will eventually do a tutorial on that. For this project, however, I am only using two half H Bridges. In fact, in the final picture you can see 4 FETs out of 6. The reason is (and I am not proud of this) I had a bug in the FW and I was blowing up FETs. Since I was not using the third half H Bridge, I decided to only work with the 4 FETs.
You may have also noticed the FETs have no heat sink. Since these are 200A peak FETs, they seem to be taking it well with the light load. However, I do not recommend this operation as heat is always a KILLER! Luckily, I have already started to design and experiment with a heat sink, but I was impatient to get this released so I decided to risk it. Eventually I may do an instructable on how to place the heat sink on the board, as there are some nuggets of information the community may be able to take advantage from. I do recommend you operate with a heat sink, though!
The block diagram gives us a pictorial view of what the main controller entails. Here are a few important details:
- 24V Battery power is supplied to both HYDRA DC motor controllers. They will each generate their internal voltages, so no need of voltage regulators is needed.
- An RC receiver is connected to both motor drivers. Channels 2 and 3 are connected to the right and left motor controller's respectively.
- The right motor controller, powers up the receiver. The left motor controller only needs to provide the RC PWM signal.
- The RC PWM signal is fed into an input capture on the motor driver. The firmware decodes this signal and generates according motor control PWM.
- The power stage then energizes the brushed DC motor. The firmware provides both direction and speed information to the motor.
If you want to go deeper into how the RC2PWM algorithm works, I suggest you take a look at the links I provided during the introduction.
With all of this tutorial, all we are left to do is take this new creation for a spin! Enjoy the ride!