Overall KiCAD Schematics
The leader PIC32 mainly controls the driving system of the SQRL: encoders for the speed match, opto-reflectance sensors for the tape following, and the phases of the motor input.
The follower PIC32 mainly controls the sub-systems for detections: Acorn detection, IR detection, yard detection, and the servo for shooting
Key Sub-systems
Power Distribution
The self-made power distribution board is powered by one power bank (5V) and two batteries (7.7V each), and distributes the power to each individual component
ICs are powered by 5V and the 3.3V from the power bank
Motor are powered by the 7.7V batteries through the H-bridge(TLE5206)
IR Signal Conditioning Board
The IR received by the IR transistor (LTR3208E) will be processed through the signal conditioning board (MCP6294 and MCP6546), resulting in a measurable clean square wave.
Notes:
The signal conditioning video shows a low-side driven transistor but we are using a high-side drive. Those two work in a similar way; our circuit works well since Lab8(high-side driven) so we decided to keep it.
The comparator looks different from the video for the same reason. R18 and R6 left empty intentionally to keep our circuit the same as Lab8.
IR Transistor positioning servo and Yard Detection Servo
This Servo will turn 90 degree once the Acorn is detected to find the closest Beacon, determining which tree it is
The yard can be determined on the software side according to the tree, the yard servo will move either to the right or left to show the side (Ed/Karl)
DC Motors
The DC motors are powered by external 14V batteries and controlled by PWM through the H-bridge. They allow the SQRL to go forward, backward, CW, and CCW.
Op-reflectance sensors
The opto-reflectance sensors(tape sensors) are used to follow the tape by the reading of the sensors. The black tape will absorb the light so it will have a higher reading than the floor because less light returned is treated as further distance by the sensor. Once the reading passes a certain pre-measured threshold, we know the SQRL is on the tape.
Sensor 1 is located at the rotation center of the SQRL; sensor 2 is next to sensor 1, which is used to detect the big crossroads; sensor 4 is aligned to the sensor 1, which is used to check whether SQRL aligned with the tape; sensor 3 and 5 is to check deviation (if sensor 3 reads the tape, a left rotation is required; if sensor 5 reads the tape, a right rotation is required).
(For a more detailed description, see software page)
Acorn Detection
The system will sense the existence of the acorn; it is made of an IR LED and an IR transistor. At the beginning of the game, we will place an acorn on the tape facing the fence to help the SQRL orient which way is forward.
The LED will shine IR with a preset frequency on the acorn and the acorn will reflect it. Once the system reads the IR with this frequency, SQRL knows there is an acorn in front of it.
Encoders
The performance of each motor may be slightly different due to manufacturing, unsymmetric weight distribution of SQRL, and so on. We used a PI controller to accommodate this: encoders will be used to monitor the RPM of both motors, and one of the motors will be used as a reference and the other will be adjusted based on the RPM of the reference motor.
Shooting Servo
There are two pre-set PWM value to position the servo: one is the initial position and the other one is the hitting position. The servo will turn the gear to sweep the Acorn