Lab 4 Page
Summary
This is the final lab and as such contains the rest of the tasks needed for the robot to finally be able to navigate the maze. This lab involved:- RF communication setup between robot and base station.
- Re-coding of blocking statements to eliminate them.
- Start override button install
- Navigation
- implement PID control
- Combining Everything
- Instant backtracking: This was due to faulty ultrasonic sensors.
- Inaccurate turns: With either servo feedback or timed turns, change in battery voltage, position of wheel at time of start etc, contributed to inaccuracy in some of the turns made.
- False nodes: Due to error in code and inaccurate movement, false and unreachable nodes were added to the frontier stack.
RF Communication
This portion of the lab involved the use of the use of two RF transceivers, one on the robot and the other on the base station. A transceiver is a device capable of sending or receiving signals.
An adapter is attached to the transceiver and then plugged into the breadboard. It has a CS, MISO , MOSI and CE pin, in addition to an SCK, Vin and GND pin. It operates on 3.3V. The presence of MOSI, MISO and SCK indicate SPI(Serial Peripheral Interface). Both transceivers are connected to the Arduino on the robot and the base station in the same manner.
The difference in function will be determined by software. The transceiver on the robot is meant to serve as a transmitter, and that on the base station, as a receiver. To get the transceivers working, a library is employed. Namely, the RF24 library. Based on the formula given a unique set of pipe numbers are chosen for the RF transceiver pair, to be able to transmit and receive correct data. The pipe numbers are input into the code and the Tx code is flashed on the transmitter(robot). The Rx code is flashed on the base station.

Non-Blocking Code
To ensure smooth running of the robot during the final demo, some functions have to be working in tandem with each other. For such parallelism, blocking statements are not expedient. Therefore, they must be removed or replaced with non-blocking code. For example, using delay() is not supported. It should be replaced. delayMicroseconds() may be used.
Override Button
Per the rules of the demo, the robot in its starting position listens to sound all around it and remains motionless until the trigger note of 440Hz is heard. Upon hearing the signal, the robot starts to navigate the maze. This involves modifying the FFT code to specifically detect the 440Hz sound. Should the sound detection feature fail, a pushbutton should be pressed to override the sound detection and cause the robot to start navigating.Navigation
To be able to navigate a maze, any maze, intelligently, the robot requires more than a series of hardcoded timed turns. It requires more than just simply turning when the robot comes into contact with a wall. It requires an algorithm. For the purpose of navigation, algorithms such as DFS and can be used. Simple algorithms such as right wall and random walking was not allowed. For the purposes of navigation my team used the DFS algorithm. This was probably the most challenging part of the whole course and it took several hours of testing and deliberation.Representation of maze to be navigated

PID Control
PID stands for Proportional action, Integral action and Derivative Action. This is mainly employed to correct the robot's path so it keeps moving in a straight line. Changes to the gain in the Proportional part of the controller leads to a large immediate reaction. Changes to the Integral gain leads to small less immediate changes. For the purposes of navigation only the P and I were used.Final Demo
For the Final Demo, the robot has to navigate throught the maze and pick up 2 treasures. The treasures are IR LED's with specific frequencies. At the start of the demo, the robot moves when it hears the 440Hz sound. It moves from square-to-square , where each square indicates a node in the dfs algorithm. Upon picking up a treasure, it displays the value on the base station. After picking up 2 treasures, it stops.Base station showing picked up Treasure Frequencies


Robot trying to navigate maze
Problems Encountered