WiFi Tank Robot in about an hour


 (Left to Right, Auric and Oddjob)

If you've been reading here for a while, you will probably remember Auric my large quad-track robot.  If not, you can read all about it here.

Auric is still developing and getting smarter, but it's also really an expensive project.  I wanted something fun for the kids.  It had to be easy to build and able to handle indoor and outdoor conditions well.

The solution came in the form of a "Black Gladiator" chassis from DF Robot.  Mine came from Little Bird Electronics in Hornsby New South Wales, for the princely sum of $A50.

What I really like about this chassis is that unlike quite a few "budget" tracked chassis I have seen, this has an aluminum base plate which makes it not only stronger, but it shouldn't flex so much and cause damage to PCBs attached to it.

It's a kit so you will need a small phillips-head screwdriver, soldering iron, cutters and medium duty hook-up wire.  When I received mine, DF-Robot's website had some problems and the assembly instructions lacked any pictures.  However, Little Bird have step-by-step instructions on their product page.

I'm not going to repeat the details already published because that would be pointless, but I will offer some hints to make the job easier:
  1. Use a pair of small spanners (M5) to lock up the nuts which secure the non-driven wheels to the chassis.  This is the only part of the kit I wasn't happy with, because it took a couple of attempts to eliminate the free play from these wheels.  Bearings would have been nice, but then the cost would be higher.
  2. The cutouts in the tracks face away from the chassis, and then the pegs will slot nicely into the non-driven wheel as well.
  3. In my build I had to remove four segments from each track to get adequate tension.  Yours may vary.
  4. When wiring the motors, determine the polarity which drives each set of tracks forwards, then solder the wiring.  It makes it easier when it comes to hooking up the controller.  Remember that because the motors are opposed 180 degrees, that they need to turn in opposite directions  for normal motion.
  5. The battery holder takes two 18650 batteries, and while most photos show it on the top of the main deck, it mounts really neatly underneath, and there's even a screw hole or two in the right place.  This frees up space on top for other uses.
  6. Cable-tie your wiring to keep it out of harms way.
All up, the assembly should take 20 - 30 minutes if you've got even modest skills.  It's not a race, but it really is easy.


(Put the batteries underneath and save yourself space.  Looks neater too)

Since keeping the cost down was a major part of this exercise, I used a controller I already had.  Actually it's the original motor controller from Auric.  This is a NodeMCU attached to a common motor shield.  Both parts are readily available, but you could also use an Arduino UNO and Motor shield if you wish.


(Ready for action)


The end result is visually quite pleasing as well as fully functional.  To get you started, the code below can be loaded onto the NodeMCU using the Arduino IDE and and you have a simple web-serving remote controlled robot.  Just make sure you set the WiFi values to suit your home or office network.  The code is really very simple, and for the sake of making it easy to understand there is no authorisation or authentication involved.  Something I intend to fix later.


So there you have it...  A fun afternoon project that could serve as a base for future experiments.  I will definitely be looking into using something like Blynk to build a mobile phone control app for it, as well as adding some additional sensors and whatever navigation I can fit into the NodeMCU's memory.

Finally, all robots need to have a name, and this is no exception.  The newest member of the robot zoo is "Oddjob".  He was Auric Goldfinger's henchman in the movie "Goldfinger".  Curiously, he was supposed to be Korean, but all the "Koreans" in the film were actually speak Cantonese!

#include  <ESP8266WiFi.h>

int PWMA=5;//Right side
int PWMB=4;//Left side
int DA=0;//Right reverse
int DB=2;//Left reverse

const char* ssid = "YOUR_SSID_HERE";
const char* password = "PASSWORD_TO_MATCH";

WiFiServer server(80);

void setup() {
// Debug console
  Serial.begin(9600);
  pinMode(PWMA, OUTPUT);
  pinMode(PWMB, OUTPUT);
  pinMode(DA, OUTPUT);
  pinMode(DB, OUTPUT);
  stop();
  WiFi.begin(ssid, password);
  Serial.print("Network Connect: ");
  while (WiFi.status() != WL_CONNECTED) {
    Serial.print(".");
    delay(100);
  }
  Serial.println("Connected");
  server.begin();
  Serial.print("IP Address of network: ");
  Serial.println(WiFi.localIP());
}

void loop() {
  WiFiClient client = server.available();
  if(!client) {
    return;
  }

  Serial.println("Waiting for new client");
  while(!client.available()) {
    delay(1);
  }

  String request = client.readStringUntil('\r');
  Serial.println(request);
  client.flush();

  // Now decode what we got
  if(request.indexOf("/MODE=STOP") != -1) {
    stop();
  }
  if(request.indexOf("/MODE=FWD") != -1) {
    forward();
  }
  if(request.indexOf("/MODE=REV") != -1) {
    reverse();
  }
  if(request.indexOf("/MODE=LEFT") != -1) {
    left();
  }
  if(request.indexOf("/MODE=RIGHT") != -1) {
    right();
  }

  client.println("HTTP/1.1 200 OK"); // standalone web server with an ESP8266
  client.println("Content-Type: text/html");
  client.println("");
  client.println("<!DOCTYPE HTML>");
  client.println("<html>");
  client.println("<br><br>");
  client.println("<table>");
  client.println("<tr>");
  client.println("<td>&nbsp</td>");
  client.println("<td><a href=\"/MODE=FWD\"\"><button>FWD</button></a></td>");
  client.println("<td>&nbsp</td>");
  client.println("</tr>");
  client.println("<tr>");
  client.println("<td><a href=\"/MODE=LEFT\"\"><button>LEFT</button></a></td>");
  client.println("<td><a href=\"/MODE=STOP\"\"><button>STOP</button></a></td>");
  client.println("<td><a href=\"/MODE=RIGHT\"\"><button>RIGHT</button></a></td>");
  client.println("</tr>");
  client.println("<tr>");
  client.println("<td>&nbsp</td>");
  client.println("<td><a href=\"/MODE=REV\"\"><button>REV</button></a></td>");
  client.println("<td>&nbsp</td>");
  client.println("</tr>");
  client.println("</table>");
  client.println("</html>");

  delay(1);
  Serial.println("Client disonnected");
  Serial.println("");
}

void forward(void) {
  digitalWrite(PWMA, HIGH);
  digitalWrite(DA, HIGH);
  digitalWrite(PWMB, HIGH);
  digitalWrite(DB, HIGH);
}


void reverse(void) {
  digitalWrite(PWMA, HIGH);
  digitalWrite(DA, LOW);
  digitalWrite(PWMB, HIGH);
  digitalWrite(DB, LOW);
}


void right(void) {
  digitalWrite(PWMA, HIGH);
  digitalWrite(DA, HIGH);
  digitalWrite(PWMB, HIGH);
  digitalWrite(DB, LOW);
}


void left(void) {
  digitalWrite(PWMA, HIGH);
  digitalWrite(DA, LOW);
  digitalWrite(PWMB, HIGH);
  digitalWrite(DB, HIGH);
}


void stop(void) {
  digitalWrite(PWMA, LOW);
  digitalWrite(DA, HIGH);
  digitalWrite(PWMB, LOW);
  digitalWrite(DB, HIGH);
}






Seriously, WHY would you do that?





Chapter I  A New (Old Stock) Hope

The first computer I got to use was a PDP-11 owned by a time-sharing bureau in Wollongong in the 1970's.  From memory they ran services for car dealers or some such thing.  The operating system was RSTS/11.

When I finished high school I was able to get access to a VAX/VMS system owned by the Department of Education.  Security wasn't a big thing, and my lecturer even gave me the phone number for a dial-in port so I could get access on the weekends.  I discovered the machine I had access to was part of a larger network of VAXes and with a few simple commands, I could jump from one to another.  Just looking around mind you, nothing even remotely interesting was attempted.

VAX/VMS, and later OpenVMS on Alpha have played a moderate part in my career, and I still enjoy tinkering because of the generous way that Digital,then Compaq and now HP/E have supported the hobbyist community.

Emulators are one thing, but getting your hands on real hardware has something even more special about it.  So let's look at the options shall we?



Getting hold of a VAX in any working form these days is near to impossible, and if one does come on the market, the prices are just stupid.  I live in hope that I will come across a 780 or similar on the side of the road, but realistically, it's not going to happen.



The Alpha was Digital's big bet on RISC, and it did make a good replacement for the aging VAX architecture, and positively screamed under VMS, but Compaq didn't seem to understand it, or see a market so they killed it off.  Like the original VAX machines, these are pretty hard to get now because they just didn't sell all that well in this part of the world.  Sadly I had an Alpha, but I let it get away...

So I'm out of luck, right?  Wrong.  When HP acquired Compaq they did see value in the VMS and other parts of the business that Compaq had neglected.  They also had their own architecture, PA/RISC, which was in serious need of an update.

The timing was great, because Intel had second-generation Itanium processors available.  Rumour says HP and Microsoft were heavily involved in the development of a clean-sheet design.  HP seemed to have more sway, because there is a lot of carry-over from PA/RISC.

HP ran with the Itanium family in it's Integrity and Superdome products even after Microsoft pulled the plug on Windows for IA64 during the Server 2003 lifecycle.  You could until quite recently buy these machines configured for HP/UX or OpenVMS.

The last of the Itanium machines were discontinued somewhere around 2016 or 2017. (Correct me if I'm wrong there), and right now complete systems are coming off maintenance at little more than scrap value.  Snap them up while you can, because they won't be available forever.

There's the two main families you need to consider.  The Superdome, which I know not much about is the heavy hitter.  Modular and built to be fault tolerant.  Most of them need power I can't connect in my garage anyway.  But they can be really cheap for this reason.

The Integrity family were in my opinion more of an entry system, and available in either blade or conventional 19-inch variants.

I think by now, you can see where this is going.  Yep, I found some!
Make sure you get RAM with the machine, as it's ECC and not so easy to find.  You won't need a huge amount.  2GB or 4GB should be heaps for our needs.  The drives are old-school 76GB SCSI (Ultra 320), which are easy enough to find.  I'll grab some spares for future use while I'm at it.

Now we wait for delivery.  And Chapter 2...



Wasting your and my time

I had a really interesting experience recently which I hope might enlighten others as much as it did me: I was approached (via LinkedIn) by ...