3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Easy build self balancing electric skateboard

Step 44Motor testing sketch

Motor testing sketch
Again, to help with debugging, here is a sketch to test that the Arduino is talking to the sabertooth and the sabertooth is driving the motors correctly.

Again sketch attached as a text file, copy and paste it into a new arduino sketch window.
NOTE:
Updated February 25th 2012
It works with Arduino V22. They have now released a newer version (V1.0) with a new softserial library with slightly different softserial commands so it might not work with very latest version of Arduino.




The deadman switch on pin 9 has to be working for this to work. The IMU can be connected or not connected up yet, it does not matter.

When deadman button pressed, the motors will turn the same way (anti-clockwise) and increase in speed in 10% increments until at 50% of maximum power, then decrese in 10% increments and finally come to a stop.

If they turn clockwise, then reverse polarity of each pair of motor wires where they connect to Sabertooth until they both turn anti-clockwise when this test routine is carried out.

Video of this test being done can be seen here:
http://www.youtube.com/watch?v=cyVWiURRCgg

« Previous StepDownload PDFView All StepsNext Step »
3 comments
May 4, 2012. 4:47 PMpumo says:
with motor testing did I something wrong?
without pressing deadmanswitch motors turns byself..
it logs level 10 without turning motors.
and when pressing button then motors wont even turn.
I did add 12k pulldown resistor also

ou are NOT Pressing Dead Man Button so all power has been cut
level 0.00
You are NOT Pressing Dead Man Button so all power has been cut
level 10.00
You are NOT Pressing Dead Man Button so all power has been cut
level 20.00
level 30.00
You are NOT Pressing Dead Man Button so all power has been cut
level 40.00
You are NOT Pressing Dead Man Button so all power has been cut
level 50.00
level 40.00
You are NOT Pressing Dead Man Button so all power has been cut
level 30.00
You are NOT Pressing Dead Man Button so all power has been cut
level 20.00
You are NOT Pressing Dead Man Button so all power has been cut
level 10.00
You are NOT Pressing Dead Man Button so all power has been cut
level 0.00
You are NOT Pressing Dead Man Button so all power has been cut
level 10.00
You are NOT Pressing Dead Man Button so all power has been cut
May 4, 2012. 6:49 PMpumo says:
I got wrong schematic (from Self Balancing Scooter Ver 2.0)
I did change for your connection deadman switch to pin 9 and thru 1,8kohm resistor to +5V now it works, kindof..
it spins motors by own and stops after all levels but if I push button down it runs thru all levels once from 0...50...0
not sure should it be like this, but I think it works :)
Oct 29, 2011. 11:01 AMdurakes says:
I have been playing around with your instructions, great job! I got to the point of testing the motors but when I load the motor testing code into the Arduino IDE I get a landry list of Java errors. Not being a programmer I seen to be dead in the water

Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 0
at processing.app.Sketch.setCurrentCode(Sketch.java:1106)
at processing.app.Sketch.load(Sketch.java:218)
at processing.app.Sketch.(Sketch.java:140)...

Any Advice? Thanks

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
127
Followers
10
Author:XenonJohn