High level overview of our electrical system, with the various inputs and outputs of our system that our micro-controller needs to talk with. Each block's individual schematic will be shown below.
We chose to use the Teensy 4.0 family of microcontrollers as they have many more features than an Arduino which we wanted to use, such as having more flash memory, more GPIO pins, all interruptable pins for our encoders, a floating point unit, and a smaller footprint. The only issue is that Teensy uses 3.3V logic levels so we had to ensure all inputs to the Teensy were less than that, and that all logic outputs we were using would turn on with 3.3V logical high.
We used a LM7805 voltage regulator to take in the battery voltage and provide a constant 5V output for any downstream boards, like the Teensy, IMU, IR sensor, potentiometer, and switch.
We used an LTR-3208E IR phototransistor to detect the IR beacon, specifically in a transresistive amplifier configuration (on the left) whose output depends on the strength of the IR beacon's signal. We found in testing that the signals of the irrelevant IR beacon(s) were too far away from our robot to interfere with our localization process, and so no additional filters were necessary. The output of the circuit is directly fed into the A9 analog input port of the Teensy.
We used 2 L298N motor drivers to control our 4 DC motors, 3 for the drivetrain and 1 for the shooter. The 3.3V logical voltage supply is provided by the 3.3V output pin of the Teensy 4.0 board. The enable pins were used as PWM inputs to change the duty cycle of the motors.
We used a Sparkfun ICM-20948 9-axis IMU for relative orientation, specifically to get a fused Euler angle estimate. We also wanted to use the magnetometer to detect magnetic north to get absolute orientation, but the magnetometer readings were too noisy to use. The IMU was connected to the Teensy through an I2C bus and was powered by the 5V regulator.
We used 4 quadrature encoders which keep track of the number of revolutions of each of the 3 drive motors and shooter motor and are used to do velocity control of the motors. As they are an input into the Teensy, we made sure their supply voltage was the 3.3V which is outputted by the Teensy.
We used a small SG90 micro servo to actuate our intake mechanism which lets balls roll into our flywheel shooter. The servo is controlled through a PWM signal by the Teensy and powered by the 5V regulator.
We added a potentiometer and an on-off-on SPDT (Single Pole, Double Throw) switch to allow the robot to take inputs from us in the middle of the match. The potentiometer is used to tune the RPM of our shooter to account for the scale in the middle going up/down. The switch is used to start the robot as well as choose the strategy we want to go for. One way is shooting in the far bucket (good press), and the other way is shooting in the close bucket (bad press). As these are inputs into the Teensy, we again used a voltage divider to cut the 5V from the regulator to 3.3V.