Step 27Motor controller
This is a Sabertooth 2 x 25Amp (40Amp peak) robot motor controller for medium sized robots with 2 motors.
Each motor has to be able to go forward and reverse, and switch direction frequently and rapidly without mishap.
The ones I have are 250 Watt 13.7 Amp peak (that is what it says on them). Watts = Amps x Volts and I have 24 Volts so that makes 10.4 Amps using that calculation. Anyhow, well within limits of the Sabertooth.
NOTE: It will handle most forms of abuse and will shut down rather than burn out and so on. It will NOT tolerate having the power supply leads conncted up back to front however - be warned.
Also it has to be able to handle a lot of power as if falling over, motors have to be big enough to allow machine to accelerate fast to bring itself beneath you once again.
Therefore unless you really know what you are doing, designing your own is out of the question.
The sabertooth can handle many types of misuse but you mustn't connect the batteries to it back to front!
The Arduino can send control data to it in several ways but I have chosen a mode called simplified serial mode. The Sabertooth website has a lot of downloadable information on all this.
It isn't exactly low cost but worth the money.
| « Previous Step | Download PDFView All Steps | Next Step » |


























































































I am a beginner. As I see on Ebay lots of Sabertooth >But they are not the same with yours -
Please, could you show me where to buy this one
Many thanks
TRANCT
http://www.robotshop.com/dimension-engineering-sabertooth-2x25-6.html
http://www.solarbotics.com/product/50120/
http://www.lynxmotion.com/p-623-sabertooth-2x25-regenerative-dual-channel-motor-controller.aspx
http://robotbits.co.uk/motor-drivers/sabertooth-2x-25amp-motor-driver/prod_62.html
John
Thanks
TRANCT
Do it in stages.
Get mechanicals right: wooden board, brackets, motors, chains, Razor wheel sets.
Then start on electronics:
IMU
Arduino
Battery to power Arduino initially
Switches/buttons
Also need sabertooth motor controller and 2 x 12V batteries.
I would not try this as complete beginner. I would make some Arduino projects first so you are fairly familiar with how it all works.
http://uk.rs-online.com/web/p/lead-acid-rechargeable-batteries/4363614/
and use a converter to make it 24v
http://www.virtualvillage.co.uk/12v-to-24v-dc-dc-power-converter-module-003602-013.html
Is this a good idea?
Also.... Is it possible to make the hand controller wireless? (bluetooth)
So, for self-balancing machines you do need some reserve.
Also when going up a slope the current draw will increase considerably.
I would use two 12v batteries in series. Lead-acids are fine, in fact they can provide high current for short periods - exactly what we need.
I would only invest in more expensive batteries once you are happy your machine balances OK.
I have one machine that uses a wireless Wii-Nunchuck for the "deadman" switch function and steering. Works fine but in public exhibitions it can get swamped by too many people using cell phones and so on, it loses connection (scary).
See here for how to do that:
http://www.instructables.com/id/Wireless-Wii-Nunchuck-control-of-Arduino-projects/
I also have a wired Nunchuck Instructable - not as cool but more reliable!
John
Im planning on using the same motors as you... are these the ones?
http://www.ebay.co.uk/itm/24V-250W-Electric-Scooter-Motor-Unite-Brush-MY1016-/170671368090?pt=Motorcycles_Parts_Accessories&hash=item27bcce679a#ht_2798wt_1139
Can you use bluetooth to link the nunchuck?(if it doesnt already use that LOL)
I now plan on using these batteries
http://uk.rs-online.com/web/p/lead-acid-rechargeable-batteries/3730366/
, 2 to make a 24v system. I was wondering... what batteries do you use and how much battery life does it give you? I was hoping to use this for at least 3 hours.
I want a design like your carbon fibre pneumatic system... but dont have access to welding and metalwork facilities. Is it possible for you to make me one and me pay you? Speaking of pneumatic, how much benefits to the pneumatic tires give?
Also could i use the pressure sensors on the board to make a dead switch?
Excuse me for asking so many questions, because im making 8 of these to sell, with a £160 profit on each, so i want to make them good :D
Thanks for your amazing advice and all the time you put into making the instructions viewable.
If you are going to sell them for £160 profit on each one, then you design 'em matey!
Make sure you have a few million $ public liability insurance, don't use any of my software and don't mention me anywhere in the instruction manual.
John
I hooked up my Arduino to my Sabertooth for the first time today, and ran the motor test. The output from the Arduino looks good. The deadman switch is on, and it is stepping through the motor outputs as it should. The DIP switches on the Sabertooth are set correctly, and the batteries and motors are all in place. But the Sabertooth doesn't power the motors - nothing at all!
I tested the Sabertooth in analogue mode just to check that it's good, and that side of it is fine. I stripped down the test code to just power the motors at 100%, and still nothing.
Did you have any problems getting the Arduino to talk to the Sabertooth? Any tips?
Only time my saber has refused to work was when I charged batteries so much they were producing around 37V. Saber decided this was too high so refused to work until I hed left it turned on for a while to drain the batteries a little.
I do know someone who had a faulty sabertooth which worked but highly erratically. He mailed me his Arduino/IMU and it worked fine on my sabertooth so he sent his back and had it replaced.
You could rewrite the code so it works using the analog inputs of the sabertooth.
If you look at the Instructable by Shane Colton that shows how to make a segway with drill motors, he has a sketch that resets the arduino pulse width modulation from the standard 500Hz (too slow) to a much faster rate.
If you smooth the pulses with an R/C filter so it JUST smooths out the pulses to a stable voltage (so retain the "instant" response time), then it could work.
One of my early boards used a non-arduino microcontroller, a PWM output of about 20,000Hz, with the ripples just smooothed with an R/C filter, feeding into the analog inputs of the sabertooth and it did work OK.
I used the serial link communication method in the instructable to deliberately avoid all this hassle!
John
Rather than using the Sabertooth in Analog mode, I'm having a go at using it in RC mode. This is where it pretends to be a servo. I've used Arduinos to control small RC ESC like this. It does work fine, but I am concerned it wont be fast enough for self balancing.
There's an Arduino Servo library which does all the work for you, you just give each motor an input between 0 (full reverse) and 180 (full forward).
Will post an update on how this goes - I'm not convinced the response will be fast enough though.
Do you think the speed of the communication is the issue, or could solething else be causing the overshoot?
Balances fine, but has a tendency to wander around the garden slowly on its own.
Someone else has recently contacted me as he cannot get the sabertooth to respond to serial commands either.
I just wonder if some sabertooths have a fault with this as others do seem to get it to work OK.
Re: wandering around the garden: If you use a PID loop the "I" should stop it wandering too far.
As I am using something more like a "PD" loop in the code, it is only the rider who stops it rolling off in one direction by leaning back a bit when necessary.
Simplest explanation of all this I have seen is the SegWii project video and pdf tutorials:
www.segwii.com
John
This stops
a) Machine spinning you off if one wheel hits small obstruction.
b) Machine spinning you off as you come to a standstill after a run as one motor stops before the other one as they often have slightly different amounts of internal friction.
I learned all this by falling off!
Now, gyros drift with time, they are not the same as an electronic compass when used like this.
So, if you don't put in any steering inputs for a while, the "resist sudden unexpected changes is course" gyro will drift a bit and the board will start to meander around your garden as you say!
John
I turned this on for the first time today as was very careful to get the + and - the right way round, started off fine, pressed the deadman switch and it spun. So i turned it over and pressed it agai, it ran for around 2 seconds before the sabertooth burst into flames!!
Is there anything else that could have done this??
as i had the batteries connected up fine!
No extermal pots, values for overall gain, balance trimming etc all hard coded for now.
Once you can get it to balance you are 90% of the way to success. You can then add steering and other peripherals back in one at a time.
If anyone asks me for code from now on I will send this version also with main code.
John
Sorry not to be more helpful.
John
Silly question.... but you can use the ground on the digital site of the arduino board as a normal ground cant you?
The 0V on the Sabertooth is connected to GND on Arduino.
The S1 on Sabertooth is connected to digital pin 13 on arduino with current software.
The other two sabertooth connections are not used.
The "dead man" switch is set up to feed a signal of +5V (from +5V pin) to digital pin 9, I put a 300 Ohm resistor in this line just to limit current, not sure if essential to do that..
Digital Pin 9 is also connected to GND via a "pulldown" resistor - about 5K will do. This holds it at 0V when the dead man button is not being pressed else the voltage the arduino "reads" at that Pin would drift around.
For the version of the code that just self-balances the board, then, assuming Gyro/accel outputs are connected to the correct analog pins, your board should balance.
A reminder:
analog pin 4 is used for accelerometer voltage intput to the arduino
analog pin 3 is balance gyro low-res input pin. (Y-rate)
hi res balance gyro input is analog pin 0. (Y-rate 4.5)
IMU also requires a power supply: +ve from the 3.3V output on the arduino and a wire back from IMU to GND on the arduino.
best wishes
John