AtomBot

The idea behind this project was to incorporate a complete x86 computer into a mobile robot.  With netbooks becoming more powerful every year, they maintain low prices.  Salvaging the parts from a $60 broken netbook, I slapped the guts onto a tank tread Arduino controlled robot.  Connecting the Arduino to the netbook USB supplies it power but also gives a communication channel.  The netbook WiFi allows a world of possibilities such as communication, VNC remote admin, and even video streaming.  I wrote client/server scripts in Python to provide joystick control from a client machine to the AtomBot in which it relayed the data to the Arduinos.

One Arduino controls the sensors while the second is equipped with a MotorShield and governs the tank treads.  For manual joystick control the sensor Arduino is not used.  When autonomous control is selected, the MotorShield Arduino and sensor Arduino communicate with each other via serial.

To assist with manual control I use an old Logitech webcam streamed via VLC media player over the LAN using UDP.  It's slow, not sure if it's the 802.11G or 5 year old camera, but either way it gets AtomBot around better than your own view from the joystick machine.  Future additions include pan/tilt for the webcam selected by a button on the joystick.  Yaw motion controlling the servo mounted IR rangefinder would be nice too.  If I knew anything about video I'd like to display sensor values in the video stream, but that's way above my head, lol.

The Arduino sketches and Client/Server Python scripts are attached at the bottom of the page.


The latest version of the robot:



Thanks to Brian D. Wendt at PrincipiaLabs for the Arduino servo/joystick Python script.


This is a video showing the autonomous roving abilities of the Arduinos, netbook isn't turnd on.


Manual control via the joystick, while streaming video and playing Green Day.



Server Python script is running on the AtomBot.  It connects to the Motor Arduino and the Sensor Arduino via USB and the Python Serial library.  TCP port 9000 is opened and listening for a connection.  The client computer with the USB joystick initiates it's client Python script and connects to the server.  A simple command prompt waits keyboard input.  Here's the commands so far:
  • m = Manual Control via Joystick
  • a = Autonomous Roving
  • i = Infrared Distance Readings
  • x = Stop Autonomous Roving
  • q = Quit
When controlling in manual mode with the joystick a single motion input will move the robot forever until the center joystick button is pressed which halts the current motion command and waits for another.  Pressing the trigger button exits the manual mode and returns to the client command prompt.  Autonomous roving will continue until the client sends the 'x' command, in which the robot halts and the client can send another command.  The 'i' command takes a distance reading from the IR sensor in forward, left and right positions and sends the measurements to the client.

Due to the nature of polling both USB and Sockets in the server script, Threading is used in autonomous rove.  This takes a lot of CPU power and affects the streaming video as well as netbook battery life.  Starting a thread that listens for Socket input while the main thread communicates with the sensor and motor Arduinos is the only way I could figure out how to accomplish this.  If you've used Python threading before and are wondering if I kill the thread when not in autonomous roving - yes I do, and it was a pain to figure out!  When not in autonomous roving the extra thread doesn't exist so the video stream, CPU resources and battery life are all under normal conditions.

When the AtomBot netbook is powered on, I switch the Sensor Arduino to external power (off) because /dev/ttyUSB0 must be Motor Arduino and /dev/ttyUSB1 must be Sensor Arduino.  Once the netbook is powered on, I switch the Sensor Arduino to USB power, connect via VNC from the client, start the Python server script and VLC.  I setup VLC streaming manually because I can't get the command line to work correctly in order to make this automatically start up.  After the server script is running and video is streaming I close out VNC to hopefully conserve battery life and lower the network traffic to the netbook with hopes of helping the video quality.  Client/server communication is very small, single characters are sent and the socket is closed when the server is working and the client is silent.

I haven't implemented a battery monitor on the netbook server yet.  I'd like to interface with ibam via os.system with output redirected to a temporary file and read by the server script and sends a warning to the client when battery time left is less than 5 minutes.  This netbook blinks the amber battery light when less than 20% battery life is left, but that indication is too early for me to plug it in.  Hopefully I'll have this implemented soon.




 


Parts List:


2 x Sharp Digital Distance Sensor (10cm) from Pololu
Sharp Infrared Proximity Sensor from SparkFun
DFRobot Mobile Tank Base from RobotShop
MotorShield for Arduino from Ladyada
2 x Arduino Duemilanove
Intel Atom N270 Netbook
Logitech USB Webcam
Standard Servo
7.2V 1800mAh RC Battery (for MotorShield)

ċ
Atom_Motor_3.pde
(2k)
Robert Svec,
Sep 21, 2010, 9:39 AM
ċ
Atom_Sensor_3.pde
(2k)
Robert Svec,
Sep 21, 2010, 9:40 AM
ċ
atom_joystick_x.py
(5k)
Robert Svec,
Sep 21, 2010, 9:40 AM
ċ
atom_server_x.py
(3k)
Robert Svec,
Sep 21, 2010, 9:40 AM
Comments