ECE juniors' worst nightmare ECE 3400

Lab/Milestone 4 - Radio Communication, Robot Detection, and Full Robot Integration

Objectives

In Lab 4, we finalized the interface between the Arduino and FPGA to update the display accurately using the maze data from the robot and fully integrated all components onto the robot, including the override button, finished mapping LED, microphone, and IR emitters.


In Milestone 4, we set up radio communication between the radio and base station, connected our Arduino and FPGA in the base station, and finalized our robot avoidance scheme.



Materials Used


Procedure


Radio

For the Radio, tested and adapted the radio code given to have the robot send maze information while navigating and have the base station draw to the screen using that data. To do this we had to encode the x, y, wall detection, and done signals into a 16 bit value with left shifts, and have the base station arduino decode that signal and set the correct output pins to high. Finally we had to wire up 12 voltage dividers (1 for each output pin) to convert the 5V output from the Arduino pins into 3V inputs for the FPGA pins. We decided to send all 12 bits of our maze data signal in parallel as it made for the easiest software side implementation. Several code snippits and images are below for demonstration.

Below is the function used to encode and send maze data from the robot:

      
void sendIntersectData(int x, int y, bool leftWall, bool frontWall, bool rightWall) { radio.stopListening(); senddata = 0; senddata += x << 7; senddata += y << 3; senddata += leftWall << 2; senddata += frontWall << 1; senddata += rightWall; radio.write( &senddata, sizeof(unsigned short int) ); radio.startListening(); }

Below is a small portion of the function used to decode data and set the appropriate Arduino pins:

      
if(data & 1){ //right wall detected digitalWrite(A0, HIGH); } if(data & 2){ //front wall detected digitalWrite(A1, HIGH); } if(data & 4){ //left wall detected digitalWrite(A2, HIGH); } if(data & 2048) { //other robot detetcted digitalWrite(7, HIGH); }

Below is a circuit diagram of the voltage divider used to connect the Arduino and FPGA pins:

comm

Below is a picture of the base station wiring with 12 of the above voltage dividers(note how both analog and digital pins are used for output from the Arduino):

comm