Control design and development code for Baja Bruin Racing ECVT.
All scripts are organized into three main folders:
testcontains test code for all hardware including sensors, microcontrollers, IC's, etc. They are often single use and do not include wiring diagrams.system_idcontains system identification code for independent actuators or the whole car. Wiring diagrams are shown in EasyEDA and are the overall car schematic or just the isolated actuator components.controlcontains control code for independent actuators or the whole car. Wiring diagrams are shown in EasyEDA and are the overall car schematic or just the isolated actuator components.
The first section in this document is a short tutorial for the primary development environment used in this repo. The following sections are some documentation about the control systems for various years.
Refer to our Environment Setup wiki page
Model 20 uses the Baja ECVT Reworked THomson Actuator (BERTHA) mechanism, Bruin Racing's first ever custom actuation system. It is based on a Racerstar BLDC motor which drives a ball-screw mechanism. The mechanism is similar to the Thomson Max Jac used in Model 19, but with greatly increased shift speed. Additional sensors include a potentiometer for absolute position feedback, unipolar digital hall effect sensors for limit detection, and hard stop limit switches to prevent overshifting. The BLDC has internal digital hall effect sensors to closed loop speed control through a supporting ESC. The motor driver of choice is an ODrive 3.6, accepting a commanded velocity through serial communication and running an internal closed loop velocity controller.
The BLDC three-phase power wires may be connected to the motor driver power channels in any order. If the observed velocity is not in the intended direction, any two power wires may be switched to reverse the direction. The ODrive has two possible channels for power and sensor feedback, and each has been internally tuned for a different motor. The correct motor channel is marked on the back of each Racerstar motor.
The encoder wires have been fixed in a Dupont connector so that their order matches that of the ODrive headers, listed as follows:
- red - 5V
- blue - A
- white - B
- yellow - Z
- black - GND
The order of the encoder channels may be changed if desired by recalibrating the ODrive channel after the wires have been switched to the desired order.
The potentiometer has not yet been wired in the final housing.
The limit switches have not yet been wired in the final housing.
The control law has not yet been designed.
Blue Car uses a Thompson Max Jac ball-screw linear actuator. The mechanism is a brushed DC motor which is geared to drive a ball-screw. A Syren motor driver is used to power the actuator based on an RC servo signal interpreted as an open loop commanded velocity. A built-in potentiometer provides optional position feedback which can be read by the microcontroller.
- pot 5V (green)
- pot signal (brown)
- motor + (white)
- motor - (red)
- pot GND (black)
- min reading: 163 (on car)
- max reading: 254 (on car)
- engagement: 245
- max: 2000
- min: 1000
- stop: 1515
An Arduino Uno was used as the microcontroller to drive this setup. Engine RPM was measured with an analog hall effect sensor that triggered once per engine revolution, concurrent with the spark plug firing. Gearbox RPM was measured with a bipolar digital hall effect sensor that triggered four terms per rotation of the compound gear, thanks to four magnets or alternating polarity pressed into the gear.
At this time there is no complete wiring diagram for all hardware on Blue Car. thomaskost17 is designing a reworked schematic which makes use of the ATMEGA328P-PU microcontroller alone rather than the full Arduino platform. A schematic of this project is available on EasyEDA as Blue Car Rework.
A single sketch exists to control the actuator position using potentiometer feedback and velocity PWM control signals. It is a P controller with Kp = 4. Works very well.
The controller which maximized performance for complexity was a unity gain P controller, stored in eCVT_Competition_Controller. It is likely that more complicated controllers were not correctly implemented and thus did not perform as expected.
This component was never successfully implemented with the full system. It worked in bench tests as an isolated component, but not on the car with all other components. It is suspected that the Arduino was unable to supply enough output current to drive all of the sensors and the display, and that the long I2C wires which spanned the length of the car were unable to preserve the signal integrity.
- SCL (green)
- SDA (white)
- NC (brown)
- 5V (red)
- GND (black)
I like to nickname and abbreviate things. Here are some common ones.
- BECCY - Baja ECVT Controls Console, Yeet: control system for Model 20
- BERTHA - Baja ECVT Reworked THomson Actuator: actuation system for Model 20
- BFS - Basic Feasible Solution
- eg: engine
- enc: encoder
- ERA: Eigensystem Realization Algorithm
- gb: gearbox
- gts: geartooth sensor
- METIS - Modular Externally-Threaded Insertable Sensor:
- LST-HSP - Low Speed Torque High Speed Power
- OKID - Observer Kalman filter IDentification
- pot: potentiometer
- SAFRON - Spectral Average Frequency Response ONline