Skip to content

hannahvsawiuk/Line-Following-Robot-Car

Repository files navigation

Line following robot

Project Specifications

Brief description: An autonomous robot car controlled by a magnetic field produced by a signal generated by a transmission system through a guide wire track. Instructions were sent to the transmitter through an Android app that interfaced with a Bluetooth module (voice and touch capabilities).

Subjects: signal processing, resonance, electromagnetism, interrupts and service routines, interrupt prioritization, C, encoded instruction, pulse width modulation, app development, interfacing between microcontrollers and external devices, Bluetooth

Language: C

IDE: CrossIDE

Microcontrollers: C8051F38x for the car and AVR ATmega328p for the transmitter

Electronic components: DC motors, opto-isolator, MOSFETS, tank circuits, operational amplifiers, comparators, precision peak detectors, the HC-06 Bluetooth module

Photos and diagrams:
Receiver hardware block diagram
Receiver software block diagram
Transmitter system block diagram
H-bridge circuit photo

Detailed description
The transmitter sent an oscillating signal at a 15-kHz frequency through a guide wire track, which generated a magnetic field surrounding the wire. A tank circuit – an inductor in parallel with a capacitor – with a resonant of frequency of 15-kHz acted as an inductive sensor in which a voltage was induced by the magnetic field from the guide wire. To allow for signal processing, the voltage was amplified by a factor of 100 and then fed into a precision peak detector. The peak detector - comprised of a non-inverting operational amplifier, Schottky diode, and a capacitor - served as a peak detector and a rectifier. The output of the rectifier portion was a DC voltage whose magnitude was proportional to that of the amplified signal.

Since the DC output voltage of the precision peak detector circuit fluctuated, it would not always indicate a logic 1 when the signal was oscillating if the car was slightly off the track or turning. So, a comparator with a low threshold voltage was used to output 5 volts if the input voltage was above the adjusted threshold voltage, and the signal would be grounded (logic 0) if it was below. The output of the comparator was used to communicate instructions through the triggering of an external interrupt that would be activated by a rising edge. This allowed for binary encoded instructions.

The instructions were sent in five portions: start of instruction indicator, three bits, and end of instruction indicator. Each indicator and bit began with a rising edge of the signal. So, to receive instructions, an external interrupt was configured to execute a service routine in the event of a rising edge at the digital input pin on the F38x. A counter in the interrupt service routine kept track of the number of rising edges. For the bits, at certain intervals, the value of the digital input pin was sampled and stored into a vector. On the edge indicating the end of an instruction, a flag was set which called a function from main that decoded the binary vector and stored the result in a variable. The variable was an input into a set of conditional statements which called the function matching the instruction.

As a bonus feature, an android app was created using the MIT app creator. The app interfaced with a Bluetooth module (HC-06) which was connected to the transmission system. The app allowed for touch selection of instructions, but voice activated controls as well.