This project reuses a lot of stuff from our previous projects, using an arduino as the brains behind the scenes.
Step 1: Ready Your Tools
Additionally you will need:
•Steel square tubing for frame
•24VDC 300W motor
•Arduino UNO - Check your local suppliers or eBay.
•Sabertooth 2x25 Motor Controller ( www.dimensionengineering.com or a local supplier)
•5 DoF analogue IMU - available on ebay (to be replaced with digital IMU at some point)
•Scooter wheel, sprocket, chain and axle - available as a kit
•Shielded multi core cable for the accelerometer and heavy power cable for the motors
•Toggle switch for adjusting balance position.
•DC connector for Arduino.
•DIL pins to suit Arduino
•Double sides tape
•Drill and drill bits
•Welding equipment and saftey gear
•Soldering iron and solder
•Wire cutter and wire strippers
•Heat shrink and hot air gun to shrink it
Step 2: Frame and Motor
The wheel, sprocket, chain, and axle all came in a kit designed for a scooter.
We used 25x50mm tubing for the frame and 25mm for the foot pegs. A couple of plates across the middle of the frame served to mount the single motor with a piece of acrylic to which we glued or screwed the electronics.
The axle was set in a channel which allows the two sprockets of the motor and wheel to be moved so the chain can be easily fitted. A bolt above the axle stops it from suddenly sliding upwards when in use.
Step 3: Connect Arduino to Switches
We built this model with an ardunio nano but are in the process of transitioning to an arduino uno to keep our projects on a standard platform. The code and pin-outs provided here are for an arduino uno.
To connect the Arduino to the 3 position rocker switch to adjust trim and the push button kill switch:
Arduino - Switch
GND -> 3Pos cen, push button -ve
D9 -> Push button +ve
D10 -> 3Pos 1
D11 -> 3pos 3
Step 4: Arduino to ESC
GND -> 0V connect this to the same rail that you were using for the sensor
5V -> 5V
D13 -> S1
This would also be a good time to set the DIP switches on the Sabertooth to the right settings for serial control.
1 - On
2 - Off
3 - On
4 - Off
5 - On
6 - On
Step 5: Arduino to IMU
A0 -> Y4.5
A1 -> Z Acc
A2 -> Y-Rate
A3 -> X-Rate
3.3V -> 3.3V
Step 6: ESC to Batteries
B+ -> Pos battery terminal - optional - In & VCC on voltmeter
B- -> Neg battery terminal - optional - GND on voltmeter
M2A -> 24VDC on motor
M2B -> Motor GND
If you have wired two 12v batteries in series you can place the master switch in the middle.
Step 7: Code
I have added the code but you need to change .txt extension to .ino
A final note on testing
This vehicle requires a little more skill on the part of the rider than the Scooter or SciChair, it also requires a little leap of faith on take off. This faith should not be easily given however, one silly mistake, like wiring the motor backwards (cough) will result in this machine throwing you face first into the dirt. As such I strongly recommend laying the unicycle down on the ground, switching it on then lifting the seat up with both hands ready to lift it off the ground if it decides to fully engage the motor. Once you're happy that it is properly sensing its tilt lower the wheel onto the ground and slowly lean on it to test its responsiveness. Only after all this should you attempt to climb aboard and even then, a helmet is strongly recommended.