Drexel University

Mechanical Engineering and Mechanics
Special Topic: Autonomous Vehicle Control
Dr. Harry Kwatny

Thursday, January 28, 2010

Bluetooth Transceiver Testing

Alan and Venkat suspect some problems with our Parallax EB500 "Embedded Blue 500" Bluetooth transceiver, so I removed it from the truck for testing independent of the Propeller microcontroller.

The board itself is shown on the left.  Apparently, it has been discontinued by Parallax (Parallax store), but what we have is what we have.  The EB500 is part of a line of Bluetooth transceivers designed by  A7 Engineering.  Luckily, the user manual containing the technical specifications, circuit board layout, and pinouts is still available (EB500 User Manual).

I have an Arduino Nano 3.0 (Atmel ATmega 328, manufactured by Gravitech) that I'll use to test the EB500.  According to the user manual, we need to connect a total of seven pins for communications without flow control:  two grounds, transmit, receive, status, mode, and power.  The status and mode pins aren't crucial, but I'll connect them for debugging purposes.  Two grounds are specified, pins 1 and 2, and should both be connected.  The data sheet says the EB500 draws 35 mA at maximum speed and can accept 5 to 12 volts - within the specifications of the Arduino.  The connections I made are as follows:

     EB500 Pin (Signal)  Arduino Pin
     -------------------------------
       1 (GND)    <------->  GND
       2 (GND)    <------->  GND
       3 (TX)     <------->   12
       4 (RX)     <------->   11
       8 (STATUS) <------->   10
       9 (MODE)   <------->    9
       20(VCC)    <------->   5V



Note that pin 1 on the EB500 is the lower-right most pin, marked with a white dot, and has a white box around it.  Pin 20 is the upper-right most pin; be sure to check this connection before powering up the Arduino.  The Arduino will be powered directly from the PC via the USB connection.  After verifying all the connections, I connect the USB to the computer.  The blue LED power indicator lights up and within half a second the green connection indicator on the EB500 briefly flashes once.

I open the Arduino development environment (download here) and load up the program I've written.  The sketch depends on one external library, NewSoftSerial.




The complete code listing is at the bottom of this post.  I compile and upload the software to the Arduino, and open the built in Serial Monitor, setting the transmission rate to 9600 baud.  On the Bluetooth-enabled netbook, I start up HyperTerminal, connecting to the COM port the to the associated EB500 serial port.  (The EB500 serial port was created when the device was previously added in My Bluetooth Places.  The default password for the EB500 is 0000 (four zeroes).)


The port settings are 9600 bits per second, 8 data bits, no parity, 1 stop bit, and no flow control.  After accepting the port settings, HyperTerminal automatically connects to the EB500.  The indicator light turns on solid green, and "Bluetooth:  Connected" is displayed on the Arduino serial monitor.  This lets us know that the EB500 has set its status pin (8) high and confirms that it is connected.  Everything looks good so far!  On the netbook, I type some characters into the HyperTerminal window.  If everything's working right, they'll appear in the Arduino serial monitor window...okay!  Also, the red LED blinks with every character sent.  The characters don't appear in the HyperTerminal window because we haven't set the terminal up to echo the characters locally.  That's not really necessary.  Lastly, I'll send a message back to the netbook.  In the field at the top of the serial monitor I type my message and press enter to send it.  


And presto, there they are!  Lastly, I'll click the "hang up" button in HyperTerminal to disconnect the Bluetooth connection.  The green LED switches off and the Arduino sees that pin 8 has gone low, resulting in a "Bluetooth:  Disconnected" message.



It looks like the EB500 Bluetooth module is functioning well - maybe the problems are stemming from our PS/2 connector...?


-Ted


The test code follows.



//eb500_test.pde - EB500 Test Program
//Theodore A. Bieniosek
//January 27, 2010
//MEM380-003, Autonomous Vehicle Control
//This sketch was developed to test the Embedded Blue EB500 Bluetooth Module,
//demonstrating simple serial communications.
//Serial settings should be 9600 bps, 8 data bits, no parity, 1 stop bit, and no flow control.
//Utilizes the interrupt-based NewSoftSerial library instead of the built in software serial.
//http://arduiniana.org/libraries/NewSoftSerial/

#include

#define MO 9              //Mode, EB500 Pin No. 9
#define ST 10             //Status, EB500 Pin No. 8
#define TX 11             //Transmit, EB500 Pin No. 4 (EB500's RX)
#define RX 12             //Receive, EB500 Pin No. 3 (EB500's TX)
#define IOLED 13          //Use Arduino's built-in LED to flash when transmitting/receiving

boolean LEDstate = 0;
boolean STATUS;
char data_in;
char data_out;

NewSoftSerial eb500( RX, TX );

void setup()
{
  //Initialize data pins
  pinMode( MO, OUTPUT );
  pinMode( ST, INPUT );
  pinMode( RX, INPUT );
  pinMode( TX, OUTPUT );
  digitalWrite( MO, LOW );
  //Start serial connections
  Serial.begin( 9600 );
  eb500.begin( 9600 );
}

void loop()
{
  //Check Bluetooth for incoming data
  if( eb500.available() > 0 )
  {
    data_in = eb500.read();
    Serial.print( data_in );
    flash();
  }

  //Check serial buffer for outgoing data
  if( Serial.available() > 0 )
  {
    data_out = Serial.read();
    eb500.print( data_out );
    flash();
  }

  //Check for change in status of Bluetooth connection
  checkStatus();
}

//Function to check Bluetooth connection status
void checkStatus()
{
  boolean previous_status = STATUS;
  STATUS = digitalRead(ST);
  if( STATUS != previous_status )
  {
    if( STATUS )
    {
      Serial.println( "Bluetooth: Connected" );
    }
    else
    {
      Serial.println( "Bluetooth: Disconnected" );
    }
  }
}

//Function to flash the onboard LED
void flash()
{
  LEDstate = !LEDstate;
  digitalWrite( IOLED, LEDstate );
}


Monday, January 25, 2010

January 21, 2010

Issues with the bluetooth connection today, takes up majority of time.
  1. Connection keeps "dropping".
  2. Inconsistent signal connection while trying to parse codes to vehicle.
This may be due to hardware problems in the vehicle setup.

Other notes:
At one point, vehicle throttles suddenly, this may be due to energy residue left in the system. Venkat tested voltages of components to determine if there are any energy leak. Wire connections are tighten.

When bluetooth connection was available, vehicle was able to take inputs to steer left and right, increase speed in forward motion and reverse.

Vehicle crashed into wall when tested on the ground caused by delay in the feedback to steer. Fortunately, not much damage was done except the battery pack fell out from inside the vehicle. Front bumper did its job.

January 18, 2010

We further tested the vehicle today and outline what we want to achieve with this vehicle.

Previous groups working on this project have been able to achieve the following:
  1. Vehicle able to recognize and follow a particular color
  2. Vehicle avoids wall and back out from corners
Additional goals outlined for our vehicle:
  1. Start and Stop according to traffic light colors
  2. Collision avoidance when traveling in the presence of other trucks/moving objects
  3. Flees when in pursuit by another vehicle or chase another vehicle
Ted to build LED traffic light for his Robotics class which we can utilize for our new goal; outcome to be determined.

January 14, 2010

Successful in connecting and sending signals from netbook to vehicle via EmbeddedBlue.

Basic Spin code to effect blinking with variations in delay and frequency of blinking in Parallax's Propeller microcontroller. This is similar to Hello World.

Resource used: http://www.parallax.com/dl/docs/prod/prop/WebPM-v1.01.pdf

Code:
CON
  PIN           = 16
  DELAY         = 3_000_000

PUB toggle                                         
  dira[16]~~
  repeat
    !outa
[16]
    waitcnt(3_000_000 + cnt)

Wednesday, January 13, 2010

January 12, 2010

Today we received the truck and electronic components. We were successful in powering up the Parallax Propellor, servo controller, and EmbeddedBlue Bluetooth transceiver. The majority of the class was spent trying to communicate wirelessly with the Bluetooth transceiver from Alan's computer, but our efforts were unsuccessful. Chiu Yen was successful in creating this weblog, which will be our journal for all the work we do on the robot.

We'll come back on Thursday and continue trying the Bluetooth card and writing a "hello world" program for the Propellor.