Author Topic: A4WD Rover Project  (Read 1470 times)


  • NewMember
  • *
  • Posts: 12
A4WD Rover Project
« on: November 04, 2013, 08:08:41 AM »
Thought I would share some preliminary info about one of my current projects. I bought a A4WD-1 Rover w/o electronics a couple years ago. I have it outfitted with GHM-16 Gear Head Motors, TRC-01 Off Road Tires, BAT-06 12V Battery and DE-05 (Sabertooth 2x12 Motor Controller).

Since then I've experimented with several types of wireless communication with it, Xbee's, Synapses and EZB Blue Tooth. All were eventually "mostly" successful. The Xbee's and Synapses tended to conflict with a wireless camera I also have installed on the Rover, even though in theory they operate in entirely different  radio bands. I guess there was bleed since they are mounted so close together. The EZB Blue Tooth worked fine with the camera but was limited in range.

So it was time to try Moteino's. At this point I have been able to implement a standard USB joystick connected to my laptop via a Python program to send control bytes out a Moteino also connected to my laptop.

Another Moteino is mounted on the rover and connected to the rover's Sabertooth motor controller. The Sabertooth can handle several modes of operation. For this project I'm using its RC mode which is actually a PWM type of control. In other words, a positive pulse of 1.5ms every 20ms holds it neutral, a pulse from 1.5ms to 1ms makes it go 1 direction and a pulse 1.5ms to 2ms makes it go the other direction.

Eventually I was able to get the joystick to control the rover remotely. The biggest issue was dealing with the format of the control byte at each stage of the process, especially as it is handled by the RF12. I don't think I could have gotten it going without using my trusty 48 year old Tektronix scope!

Here's a few pieces of script in an effort to describe the conversion process.

Python script:
PS2 joystick writes the servo byte out the serial port.
But first convert decimal joystick position to ascii character.
servoPosition = chr(servo)

Gateway Moteino sketch:
The gateway moteino receives the incoming byte on the serial port, converts it and sends it out the radio.
servoPosition =;
itoa(servoPosition, buffer, 10);
radio.Send(GATEWAYID, buffer, 5);

Node Motino sketch:
The node moteino radio library receives the incoming byte in radio.Data[5] as no null terminated char array.
Then convert char array to a String object newStr.
for (int i = 0; i < 5; i++) { newStr = newStr + (char) radio.Data; }
Call function to convert String object newStr to an integer servoPosition.
int servoPosition = stringToNumber(newStr);
The integer servoPosition is then manipulated arithmetically to create a pulseWidth delay ranging from 1ms to 2ms every 20ms.

Receives PWM signal from node moteino d3 pin.

At first glance it might look like I'm doing some redundant conversion, but every step has different data requirements - or so it seems.

I'll post any and all program code once the entire project comes together. The final project will probably use the Sabertooth's serial data packet mode, so that I can do syncing, error handling and multiple sensor bi-directional data flow.

More to come...