RC and Programmable Rover thingy

Hello dear Arduino Community

I would like to present you my recent project.

I simply call it “Mini Rover”.

It is a small vehiecle made of lego-caterpillars, 2 geared motors, a SN754410NE H-bridge, 6*AA batteries, a Atmega 328P nano board, SPI micro SD card reader, 10DOF L3GD20 LSM303D BMP180 Gyro Accelerometer Compass Altimeter (not working yet)and a sharp GP2Y0A21 distance sensor all mashed together in a 3D printed chassis. The electronic components are connected on a prefboard. There is also a BT serial module, which is not connected yet.

My goal ist it to draw linear pictures on the ground with some chalk or pencile attached to it. So i have to be able to control it more or less accurate from waypoint to waypoint.
It is controlled by a computer program or smartphone over bluetooth, or a Gcode like program on a SD card, run directly on the rover itself.

The Serial commands/Gcode like thingy, is generated by a program i am currently creating in processing.

I already made a simple command set for the minirover, which are transmitted over the serial port:

D**  (eg. D11)      Direct Drive (control the motors): 0 stay 1 Fwd 2 bckwd , first character is left motor, second right motor
I*   (eg. I1)       Get Info:     0 Status 1 Name 2 posX 3 posY 4 IRval 5 SD status
C*   (eg. C1)       SD Card:      1 start file 2 pause file 3 stop/reset file
W*** (eg. W123)     Wait:         wait ** millis to read next command ,only for SD files

The code files are in the attachment.

Running files from SD card works, connecting with the processing program and getting commands also work.

There is still a lot of thins to do, for example getting the digital compass to work for accurate angles, and implement a line drawing mode for the processing “host software”. I will also completly redo the processing program, because it got too complex, and i figured some other ways out to do buttons and stuff.

But first, i have to solve an strange driving issues:

When i send D22, both motors turn backwards, which it is supposed tho do
When i send D11, after i sent D22, only the left track moves, which is not supposed to do

but when i send D00 to stop it all, it works. And i send D11 both motors turn forward, as if nothing happened.

the parser on the arduino works fine, i checked it by returng the registers by using the bitRead(DPORT,bitnumber) command. BUT even if all the Ports registers are correct, the right track is standing still.
I tried it whith a cheap Nano clone AND an original arduino Micro.
I also checked the soldering.
I don’t get where the problem is. I hope you have a idea.


ps: here is the parser section of the rover:

    char c = Serial.read();
    if(c == 10){                     // zeilenmbruch = decimal 10
      parse(command);                // input lesen
      command = "";                  // kommando löschen
    } else {
      command += c;
Command list:

D**      Direct Drive: 0 Stillstand 1 Fwd 2 bckwd
I*       Get Info:     0 Status 1 Name 2 posX 3 posY 4 IRval 5 SD status
C*       SD Card:      1 start file 2 pause file 3 stop/reset file
W***     Wait:         only for SD files

void parse(String com){  
  char Gcode;
  String Parameter;
  boolean state;
  Gcode = com.charAt(0);                         //Gcode Command (eg. D)
  Parameter = com.substring(1);  //Parameter (eg. 1010)

  if(Gcode == 'D'){                              // direct drive
    lTrack = Parameter.charAt(0) - 48;           // parameter werden einzeln ausgelesen  
    rTrack = Parameter.charAt(1) - 48;           // ascii in int gemäss ascii tabelle   
  }                                              // -48

  if(Gcode == 'W'){                              // wait (only for SD card)
    SDwait = Parameter.toInt();
    SDPrevMillis = millis();
  }                                              // -48

  if(Gcode == 'C'){                              // SD commands

    if(Parameter == "1"){                        // 1 play file
      fromSD = true;
      roverStatus = 2;
    if(Parameter == "2"){                        // 2 pause file
      lTrack = 0;
      rTrack = 0;
      fromSD = false;
      roverStatus = 4;
    if(Parameter == "3"){                        // 3 reset file
      fromSD = false;
      roverStatus = 1;

  if(Gcode == 'I'){                              // Info 

    if(Parameter == "0"){                        // 0 sende status
      Serial.print('s');                         // s steht für status
    if(Parameter == "1"){                        // 1 sende namen
      Serial.print('n');                         // n steht für name
    if(Parameter == "2"){                        // 2 sende posX
      Serial.print('x');                         // n steht für name
    if(Parameter == "3"){                        // 3 sende posY
      Serial.print('y');                         // n steht für name
    if(Parameter == "4"){                        // 4 sende IR messung
      Serial.print('i');                         // s steht für status
    if(Parameter == "5"){                        // 5 sende statur SD karte
      Serial.print('s');                         // s steht für status
      if(SDState == 0){
        Serial.print("not initialized yet");
      if(SDState == 1){
        Serial.print("File on SD ready!");
      if(SDState == 2){
        Serial.print("No Card!");
      if(SDState == 3){
        Serial.print("No rover.txt file!");

miniRover_0_1_4_baustelle.zip (3.15 KB)

pc_controller0_4.zip (8.44 KB)


You seem to be under the mistaken impression that print() needs your help to convert an int to a string.

NOTHING you are doing needs Strings. Quit pissing away memory uselessly.

the parser on the arduino works fine, i checked it by returng the registers by using the bitRead(DPORT,bitnumber) command.

That makes no sense. It would be far more useful to print the values of lTrack, rTrack, etc.


Even when the data doesn't come from the SD card? Why?