Electrical

Schematic

In this project, we utilized 2 PIC32 components. SPI  was utilized in the communication between two PICs and controlled by SS, MISO, MOSI, and SCK lines. The Leader PIC mainly received the sensors and user input signals that will not immediately affect motor motion, including buttons, LEDs, an ultrasonic sensor, and IR receiver signals. While the Follower PIC mainly controls the servo that raised the "fork" to indicate starting of the game, motor drivers (TLE5206), and reflectance sensors.

Signal Conditioning Circuit

There were 3 stages and a coupling stage in the signal conditioning circuits. The first stage was the phototransistor circuit utilizing op-amp (MCP6294) to generate current, which the value was decided by the resistor connected with the output of the op-amp. The phototransistor generated current when detected the beacon that served as a team identification in the game. 

We optimized the resistance value (10k) to only detect the beacon source that was the closest within 1 meter of radius. Vref stands for reference voltage and we used voltage dividers to generate a 2.5 V reference voltage. A coupling stage followed up with the first stage to create a high pass filter for reducing DC noise and tuning the cutoff frequency. The second stage was an amplifying stage utilizing op-amps to increase the gain of the signals. The 0.1 uF capacitor created a low-pass filter to clean the signals further. In the last stage, we had a comparator stage which created a hysteresis effect for stable switching properties to generate digital signals for PIC32.

Ultrasonic Sensor

The HC-SR04 Ultrasonic sensor has 4 pins - 5v power, ground, trigger (TRIG), and echo (ECHO). TRIG is an input to the sensor, of a fixed 10us pulse which starts the measurement process. ECHO is driven high when the pulse is received by TRIG, and remains high until the emitted ultrasonic waves are not reflected back and received by the sensor. Using the speed of sound and the knowledge that the wave traveled from the sensor to the wall and back, the time the ECHO is high can be used to calculate the distance between Bikbucket and the wall.


Reflectance Sensors

There were in total 5 reflectance sensors to incorporate the algorithm for line following. The layout and circuit are shown on the left. The sensor signal outputs were directly connected to the follower PIC32 and analog values were read. The threshold value of on-tape and off-tape was set to 750/1023. When pushing the branch, sensors 1 and 4 should ideally always be on the tape. However, whenever sensors 3 or 5 were detected, the left or right wheels moved at different rates for adjustment until they were not on the tape again. Sensor 2 served as the clockwise and counterclockwise turning guard. As soon as sensor 2 touched the tape, we considered the turning action had been completed. For the navigating branch algorithm, we counted the numbers of sensor 1 reaching threshold value to represent the number of branches passed which enabled us to understand the branch position of the robot was in.

Limit Switch

The limit switch was configured with pull-down 2.2k ohm resistors to ensure that the current into the PIC, which would be 1.5mA, is below the max "maximum output current sourced/sunk by any I/O pin ."

User Input Buttons

The user input buttons (start, branch selection, and rotation adjustments), were all configured with pull-up 2.2k ohm resistors to ensure that the current into the PIC, which would be 1.5mA, is below the max "maximum output current sourced/sunk by any I/O pin". The user input buttons include "Start", "Branch 1", "Branch 2", "Branch 3", "CW" and "CCW".

Motor Drivers

TLE 5206s and the PCB boards were used to drive the motors. Output was directly connected to the DC motors and the input signals were controlled by Follower PIC32 with output compare (PWM) and directional information (digital).

Components

Resistors

Capacitors

Buttons

Servo

Op-Amp     (MCP6294)

Motor Driver    (TLE5206)

IR Receiver (LTR3208E)

Comparator    (LM339)

Reflectance Sensor

Ultrasonic Sensor

Limit Switch