Thursday, October 10, 2013

Run Sabertooth 2x5 in simplified serial mode

Recently I decided to try the Sabertooth 2x5. The simplest way would be to use serial mode.

Simplified serial mode uses TTL level single-byte serial commands to set the motor speed and direction. This provides a simple way to interface to PCs, without a need to implement a packet-based communication protocol. Motors and sabertooth

To make it more interesting I was using two motors and tracks. The serial connection was provided by the Propeller Plug.

1. Setup the Sabertooth by setting switches 2 and 4 to the DOWN position.

2. Connect a power supply, motors, the Sabertooth board and the Propeller Plug:

Propeller PlugSabertooth 2x5
RXS2
TXS1
RES
VSS0V

3. Once everything is set and ready, power the Sabertooth board and plug in the Propeller Plug.


4. Do test drive. Start first and second motors, wait for 3 seconds and stop them:
$ perl -e "print chr(127)" > /dev/ttyUSB0 && perl -e "print chr(255)" > /dev/ttyUSB0
$ sleep 3
$ perl -e "print chr(0)" > /dev/ttyUSB0
Have fun!

UPDATE: you can connect PS3 joystick and send signals from it to the Sabertooth. The following code snippet shows a simple example:

When you press UP, DOWN, RIGHT or LEFT the specified command will be sent to the Sabertooth, in this case full forward, full reverse, full forward for the right motor and full forward for the left motor respectively.

No comments:

Post a Comment