Zoomkat's router/arduino/ssc-32 wifi bot

A little while back I got an arduino with an ethernet shield ($63.55 delivered). I loaded the webserver application on it and made some code to parce a get request from a web brouser. I’ve connected my ssc-32 to the arduino serial port so the arduino can send it servo commands received from a web brouser. For testing I modified my webcam page so it sends servo commands to the arduino webserver, which modifies the command and then sends it to the ssc-32. The test flowpath is PC > wifi > netgear wireless router > cat5 > arduino > rs232 > ssc-32. Below are pix of the arduino and the ssc-32/servos. No bot part yet, but this demonstrates that a wireless router bot can be made fairly easily. There is a “black widow” version below with built in wifi. Geeks has a referbished netgear router like I’m using for $20 (supports bridging). The arduino supports servos, but I haven’t tested that yet. The other part to add is a network cam to plug into the router for vision. Just wanting to see if a simple and fairly inexpensive wifi setup could be made that didn’t need a pc on the bot side.

asynclabs.com/store?page=shop.pr … 1&vmcchk=1

http://web.comporium.net/~shb/pix/arduino1.jpg

http://web.comporium.net/~shb/pix/arduino2.jpg

Very interesting! Yes, the Arduino can handle servos. I’ve had as many as five servos running from an Arduino without issues. This should be ideal for controlling a pan/tilt for a camera.

8-Dale

I get an error when I try to go to the link you provided:

It worked for me. :wink: Here, have a cookie. :smiley:

8-Dale

It also worked for me, but they don’t have any of the products in stock…

Kurt

Pix showing the Netgear WGR614 wireless router operating off of a 12v cordless drill battery. Router is using ~170ma from the battery. The voltage regulator on the Arduino has a max rating of 20v and 800ma per the data sheet, so it should also be able to operate off of the drill battery. Also should be able to operate the ssc-32 off of the Arduino +5v header. Getting close to hot glue time.

http://web.comporium.net/~shb/pix/routerbot1.jpg

Edit: Routerbot taking shape. Going to be top heavy, but shouldn’t be a problem just for tinkering.

http://web.comporium.net/~shb/pix/routerbot2.jpg

Just a quick update. I made a simple web control page for the routerbot and programmed the arduino to act as both a web server and servo controller. The continous rotation servos twitch some while being controlled by the arduino, so the ssc-32 connected to the arduino would make for better servo control. Bottom is a quick youtube capture of the servos operating in various directions and speeds being controlled via the web page > pc wifi adapter > wireless router > cat5 > arduino ethernet adapter. The video is bad, but the actual control is click quick.

http://web.comporium.net/~shb/pix/routerbot.jpg

Ah! Moved the servos to pins 6 and 7 and the twitching seems to pretty much gone away. Pins 8 and above must have some additional timing activities going on. Very steady so far.

Below is the basic code for the simple Arduino server setup and the HTML control page.

Arduino server code:

[code]//zoomkat 10-17-10
//routerbot code
//for use with IDE 0018
//open serial monitor to see what the arduino receives
// http://arduino.cc/en/uploads/Tutorial/String.zip for WString.h

#include <WString.h>
#include <Ethernet.h>
#include <Servo.h>

byte mac] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip] = { 192, 168, 1, 102 }; // ip in lan
byte gateway] = { 192, 168, 1, 1 }; // internet access via router
byte subnet] = { 255, 255, 255, 0 }; //subnet mask
Server server(84); //server port

String readString = String(100);
String servo1 = String(10);
String servo2 = String(10);

Servo myservo1; // create servo object to control a servo
Servo myservo2;
//////////////////////

void setup(){

//start Ethernet
Ethernet.begin(mac, ip, gateway, subnet);
server.begin();

//enable serial data print
Serial.begin(9600);
myservo1.attach(7);
myservo2.attach(6);
Serial.println(“bot1”); // so I can keep track of what is loaded
}

void loop(){
// Create a client connection
Client client = server.available();
if (client) {
while (client.connected()) {
if (client.available()) {
char c = client.read();

//read char by char HTTP request
if (readString.length() < 100) {

//store characters to string
readString.append©;
}

//if HTTP request has ended
if (c == ‘\n’) {

///////////////
Serial.println(readString);

//readString looks like “GET /?-1500-1500 HTTP/1.1”

  if (readString.length() >0) {
  Serial.println(readString);
        
  servo1 = readString.substring(7, 11);
  servo2 = readString.substring(12, 16);
  
  Serial.println(servo1);
  Serial.println(servo2);
  
  int n1;
  int n2;
  
  n1 = atoi(servo1); //convert string to number
  n2 = atoi(servo2);
  myservo1.writeMicroseconds(n1);
  myservo2.writeMicroseconds(n2);
  
  //myservo.write(n);
  readString="";
  } 

///////////////////

//now output HTML data header
client.println(“HTTP/1.1 204 Zoomkat”);
client.println();
client.println();
delay(1);
//stopping client
client.stop();

/////////////////////
//clearing string for next read
readString="";

}}}}}
[/code]

Control web page:

[code]

Zoomkat's Routerbot
Web Control Page

Zoomkat's Routerbot Control Page

Foward-Stop-Reverse

F-F|
S-F|
-Stop-|
S-R|
F-R|




Turn-L-Stop-Turn-R


F-L|
S-L|
-Stop-|
S-R|
F-R|

[/code]

OK, this is interesting!

Could you explain what you’re doing for the uninformed? ;>)

I take it you are using the Arduino Ethernet shield, which is wired into the wireless router (serial?).

You run the HTML code on the router (?).

The C code in the Arduino accesses the router (?).

A PC browser opens the router page at 192, 168, 1, 102 (or one of those numbers in the program.

The parameters are then accessible on the PC.

Can you elaborate?

Can something similar be done with the Lantronix?

(And I realize we will be getting a PC program to work as a control program from LM).

Looking to learn a little bit more…

Thanks!

Alan KM6VV

"Could you explain what you’re doing for the uninformed? ;>) "

Generally make a wireless “routerbot” as cheaply and simply as possible. Some powerful routers like the Buffalo ones in bridging mode might get 2,500’ line of sight range. Google for wifi shootout to see what large antennas can do. Also IP cams can be plugged directly into routers to give the bot some vision capability.

“I take it you are using the Arduino Ethernet shield, which is wired into the wireless router (serial?).”

The connection between the ethernet shield and the router is an ethernet connection (which can be a piece of cat3 four conductor phone wire with RJ45 connectors on each end). The ethernet shield functions similar to a network card in a pc. No RS232 type serial communication involved.

“You run the HTML code on the router (?).”

No, the router is stock with no mods. The HTML is just copy/paste in notepad on the desktop. If desired the arduino can serve up such simple web pages.

“The C code in the Arduino accesses the router (?).”

The arduino/ethernet shield communicates with the router just like a pc with a network card. The router sees the arduino as another connected pc or similar. The arduino handles the network traffic as well as the I/O with external devices

“A PC browser opens the router page at 192, 168, 1, 102 (or one of those numbers in the program.”

Yes, this is the IP address assigned to the arduino/ethernet shield. I used this as when the router is disconnected from the internet, as DNS lookups are not possible when disconnected. If the router was bridged to another router connected to the internet, then typical URLs like zoomkat.no-ip.com can be used in the web page. Port fowarding can be used on the net connected router so a connection to the arduino can be made from most anywhere, even a web connected Iphone on the other side of the world.

“The parameters are then accessible on the PC.”
“Can you elaborate?”

This particular web page is set up for only sending commands and receiving webcam feeds if desired. If one wants to also obtain data from the arduino and display it on the web page, then the page would be made with two frames to handle the two types of traffic. Not difficult, just use notepad and a little html knowledge.

“Can something similar be done with the Lantronix?”

I’m not familiar with the lantronix protocols, but I would think it would be more involved and difficult to make into a user GUI, particularly a web based one.

“(And I realize we will be getting a PC program to work as a control program from LM).”

I made some comments on the project when it was announced, but they immediately disappeared. As with other projects, I guess I’ll sit back and see how it goes.

“Looking to learn a little bit more…”

Lots of neat stuff out there.

Thanks Z,

The use of a wireless router is interesting, but a little bulky. I’m hoping to come up to speed with what I think can be done with the Lantronix. But I do have a spare WLAN router…

Ah yes, the “shield” is an add-on “expansion” card to the Arduino. So it’s just like an ethernet card for a PC. I suppose it could be added to a BBII as well? I think the Lantronix can do that as well (guess I’ll find out).

The Arduino Ethernet board

arduino.cc/en/Guide/ArduinoEthernetShield

Is sounding a lot like what I suspect the Lantronix can do. In the Blackfin Camera, the Blackfin talks to the Lantronix, but doesn’t need to use a LAN connection, just one of the high speed serial ports of the WLAN. Does that mean the Blackfin processor is implementing the TCP/IP stack for conversing with the WLAN? (I’m starting to confuse myself, so I’d better stop).

But as you mentioned, you’re not up on the Lantronix or Blackfin; no worries!

I know the Lantronix can support a LAN connection (with the appropriate magnetics), so it could talk to an internet card, and work like your card.

“The arduino Ethernet shield handles the network traffic…”
Yeah, that answers my question!

I copied your HTML code to a file, then opened it up with my PC browser. It looks like you’ve shown with one of your pix. Of course, I don’t have a 192, 168, 1, 102 connection (but I think I know what the Lantronix one I set up is), so I didn’t get anything, but I think I’m catching on slowly…

A few more hints and experiments should help.

I have a little HTML knowledge, looking for more! Yeah, a LOT of stuff out there!

Thanks for the tutorial (I’m looking for more on the web)!

Alan KM6VV

Zoomkat, you would probably save yourself a ton of hassle to just use a Wifi UART adapter.
forums.basicmicro.net/atom-f484/wifi-t9461.html

Furthermore, i want you to check this out.
hackaday.com/2009/09/25/with-zip … a-netbook/
and

I want to try using this eventually, but i need to save up first.
Also the zipit, has an internal serial port, you’ll need to do a little soldering, but it’s just 4 easy to access points.
Zipits Z2’s are less than $40 USD.

I’ll admit zoomkat, you got me beat when it comes to budget robotics. Those look like peanut butter jar lids as wheels. Which if reinforced actually sounds like a great idea come to think of it.
You can probably open up the router to decrease it’s weight and size, as well as allow you to move the antenna, which if i’m not mistaken is attached via a ULF connector.
Edit: Lay the router horizontally and then place the battery ontop of it? It’ll help center the gravity on it, and make it less top heavy. At least it looks like it’ll do that.

I looked at the zipits a couple of years back (below), but they looked like they would take a good bit of tinkering to get going. Maybe since then more hacking info is available. One can get an arduino 328 and W5100 ethernet shield on ebay for ~$60 including postage. Lot of technical info and activity on the arduino forum beyond bots (auto flushing toilets, etc.).

viewtopic.php?f=30&t=2655

A lot more is capable with it.
It supports debian linux without to much effort. It can be hacked in less than 5 minutes.
And linux supports plenty of programs, you just need to remember a few dozen commands.
Terminal applications are readily available.
People have even programmed an arduino using it.

And it would be easy enough to write your own programs, even internally.

Look into the Zipit Z2, i plan on getting on eventually.

Updated code for use with the 0021 arduino IDE.

//zoomkat 10-22-10
//routerbot code
//for use with Arduino IDE 0021
//open serial monitor to see what the arduino receives
// 

#include <SPI.h>
#include <Ethernet.h>
#include <Servo.h>

byte mac] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip] = { 192, 168, 1, 102 }; // ip in lan
byte gateway] = { 192, 168, 1, 1 }; // internet access via router
byte subnet] = { 255, 255, 255, 0 }; //subnet mask
Server server(84); //server port

String readString, servo1, servo2;
 
Servo myservo1;  // create servo object to control a servo 
Servo myservo2;
 //////////////////////

void setup(){

//start Ethernet
Ethernet.begin(mac, ip, gateway, subnet);
server.begin();

//enable serial data print 
Serial.begin(9600); 
myservo1.attach(7);
myservo2.attach(6);
Serial.println("bot1"); // so I can keep track of what is loaded
}

void loop(){
// Create a client connection
Client client = server.available();
if (client) {
while (client.connected()) {
if (client.available()) {
char c = client.read();

//read char by char HTTP request
if (readString.length() < 100) {

//store characters to string 
readString += c; 
} 

//if HTTP request has ended
if (c == '\n') {

///////////////
Serial.println(readString);

//readString looks like "GET /?-1500-1500 HTTP/1.1"

      if (readString.length() >0) {
      Serial.println(readString);
            
      servo1 = readString.substring(7, 11);
      servo2 = readString.substring(12, 16);
      
      Serial.println(servo1);
      Serial.println(servo2);
      
      int n1;
      int n2;
      
      char carray1[6];
      servo1.toCharArray(carray1, sizeof(carray1));
      n1 = atoi(carray1); 
      
      char carray2[6];
      servo2.toCharArray(carray2, sizeof(carray2));
      n2 = atoi(carray2); 
      
      myservo1.writeMicroseconds(n1);
      myservo2.writeMicroseconds(n2);
      
      //myservo.write(n);
      readString="";
      } 
  ///////////////////
  
  //now output HTML data header
  client.println("HTTP/1.1 204 Zoomkat");
  client.println();
  client.println();
  delay(1);
  //stopping client
client.stop();

/////////////////////
//clearing string for next read
readString="";
  
}}}}} 

The below routers and antennas look like they would be good for use with an extended range routerbot.

radiolabs.com/products/wirel … router.php

radiolabs.com/products/wirel … ess-2.html

radiolabs.com/products/anten … tenna.html

One more possible addition for a larger router bot would be the below video server. It can serve up video from four seperate video inputs. As a plus, it uses analog NTSC input so the inexpensive secutity typecams can be used.

geeks.com/details.asp?invtid … -N&cat=VID

Arduino code for use with IDE 0019 and later.

//zoomkat 10-22-10
//routerbot code
//for use with IDE 0019 and later
//open serial monitor to see what the arduino receives
// 

#include <SPI.h>
#include <Ethernet.h>
#include <Servo.h>

byte mac] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip] = { 192, 168, 1, 102 }; // ip in lan
byte gateway] = { 192, 168, 1, 1 }; // internet access via router
byte subnet] = { 255, 255, 255, 0 }; //subnet mask
Server server(84); //server port

String readString, servo1, servo2; 
 
Servo myservo1;  // create servo object to control a servo 
Servo myservo2;
 //////////////////////

void setup(){

//start Ethernet
Ethernet.begin(mac, ip, gateway, subnet);
server.begin();

//enable serial data print 
Serial.begin(9600); 
myservo1.attach(7);
myservo2.attach(6);
Serial.println("bot21"); // so I can keep track of what is loaded
}

void loop(){
// Create a client connection
Client client = server.available();
if (client) {
while (client.connected()) {
if (client.available()) {
char c = client.read();

//read char by char HTTP request
if (readString.length() < 100) {

//store characters to string 
readString += c; 
} 

//if HTTP request has ended
if (c == '\n') {

///////////////
Serial.println(readString);

//readString looks like "GET /?-1500-1500 HTTP/1.1"

      if (readString.length() >0) {
      Serial.println(readString);
            
      servo1 = readString.substring(7, 11);
      servo2 = readString.substring(12, 16);
      
      Serial.println(servo1);
      Serial.println(servo2);
      
      int n1;
      int n2;
      
      char carray1[6];
      servo1.toCharArray(carray1, sizeof(carray1));
      n1 = atoi(carray1); 
      
      char carray2[6];
      servo2.toCharArray(carray2, sizeof(carray2));
      n2 = atoi(carray2); 
      
      myservo1.writeMicroseconds(n1);
      myservo2.writeMicroseconds(n2);
      
      //myservo.write(n);
      readString="";
      } 
  ///////////////////
  
  //now output HTML data header
  client.println("HTTP/1.1 204 Zoomkat");
  client.println();
  client.println();
  delay(1);
  //stopping client
client.stop();

/////////////////////
//clearing string for next read
readString="";
  
}}}}} 

Network cam that might be of interest to modify and use on a router bot.

walmart.com/ip/Plustek-IPCAM … C/13021119