Project ROBot

Dependencies:   C12832_lcd HCSR04 TB6612FNG WiflyInterface mbed USBDevice

Welcome to Project ROBot!

ROBot is a robot based on an mbed platform. It is remotely controlled from a PC via a WiFi connection. The vehicle is also equipped with an ultrasonic range finder to detect any obstacles in the direct path of the ROBot and stop any forward motion if a collision is deemed imminent.

/media/uploads/rabad1/20131124_140455.jpg

Components

The major components of the ROBot are:

  • mbed application board
  • RN-XV WiFly wireless board (datasheet)
  • Toshiba TB6612FNG motor driver (datasheet)
  • HC-SR04 ultrasonic range finder (datasheet)
  • Redbot kit (just the chassis, motors, and wheels)
  • 5V power source
  • 6V power source

Schematic

Here is a schematic of the ROBot: schematic

Software Block Diagram

A state machine processes all input and sets the output /media/uploads/rabad1/robot_-_sw_block2.jpg

Standard Operation

A wireless remote connection from a PC sends commands /media/uploads/rabad1/robot_-_standard_ops.jpg List of commands:

  • 'e' - move forward
  • 'c' - move backward
  • 'f' - move right
  • 's' - move left
  • 'd' - stop

commands are case-sensitive

Collision Warning/Avoidance

The range finder ranges every 65 millisecs /media/uploads/rabad1/robot_-_collision.jpg

When an obstacle is within 50cm, a warning is sent back to the remote host (PC)

When an obstacle is within 30cm, all forward motion ceases. The remote host operator must use other commands to move the ROBot away from the obstacle.

Video

  • ROBot and its parts
  • Using a terminal emulator (Tera Term) to connect to the ROBot via a USB connection for wireless configuration. Once connected, the ROBot's IP address is shown in the terminal and on the LCD screen.
  • Creating a telnet session to remotely control the ROBot. Connect to the IP address given in the previous step.
  • Remote host operation of the ROBot
  • Collision Warning/Avoidance

Things To Do

I'm not sure when I'll get to these but here are some things I need/would like to do eventually:

  • improve the logic for collision
  • incorporate the accelerometer on the mbed application board
  • develop an Android/iPhone app for remote operation
  • add video for true remote operation

Acknowledgements

This project would not have been possible without the following people (in no particular order)... Andrew, Bob, Morgan, Avnish. Thank you for your support! <3

Files at this revision

API Documentation at this revision

Comitter:
rabad1
Date:
Sat Dec 07 04:49:05 2013 +0000
Parent:
4:228fd78e44fd
Commit message:
updated ranging interval and collision threshold

Changed in this revision

ROBot.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/ROBot.cpp	Fri Dec 06 08:18:16 2013 +0000
+++ b/ROBot.cpp	Sat Dec 07 04:49:05 2013 +0000
@@ -65,12 +65,12 @@
 // Range Finder
 #define HCSR04_PIN_TRIGGER  (p14)
 #define HCSR04_PIN_ECHO     (p15)
-#define RANGE_FINDER_MEAS_INTERVAL  (0.5) 
+#define RANGE_FINDER_MEAS_INTERVAL  (0.065f)
 HCSR04 rangeFinder( HCSR04_PIN_TRIGGER, HCSR04_PIN_ECHO );
 void rangeFinderTimer_cb(void);
 Ticker rangeFinderTimer;
 #define RANGE_WARNING               (0.5f)      // meters
-#define RANGE_COLLISION             (0.15f)      // meters
+#define RANGE_COLLISION             (0.30f)     // meters
 
 // MotorDriver
 #define TB6612FNG_PIN_PWMA      (p22)
@@ -239,6 +239,7 @@
   #endif /* DEBUG */
     lcdScreen.locate(0,0);
     lcdScreen.printf("IP: %s", wiFly->getIPAddress());
+    console.printf("\n\rIP: %s\n\r", wiFly->getIPAddress());
     server->bind(WIFI_ECHO_SERVER_PORT);
     server->listen();
 
@@ -307,13 +308,14 @@
 #endif /* DEBUG */
         if ( range < RANGE_COLLISION )
         {
-            strcpy( wiflyBuffer, "\n\r**** COLLISION AVOIDANCE ****\n\r");
-            client->send_all(wiflyBuffer, strlen(wiflyBuffer));
             if ( ROBot_STATUS != STATUS_NEAR_COLLISION )
             {
                 moveStop();
             }
             ROBot_STATUS = STATUS_NEAR_COLLISION;
+            strcpy( wiflyBuffer, "\n\r**** COLLISION AVOIDANCE ****");
+            sprintf(wiflyBuffer, "%s %0.3f\n\r", wiflyBuffer, range);
+            client->send_all(wiflyBuffer, strlen(wiflyBuffer));
 #ifdef DEBUG
             printf("%s", wiflyBuffer);
 #endif /* DEBUG */