top of page
TECHNICAL PROJECT | CONTROLS
VOICE CONTROLLED CAR
PROJECT INTRODUCTION
The goal of this project is to create a voice controlled car that was able to identify and respond to commands to go forward for a long distance, go forward for a short distance, turn left, and turn right. This was a part of a electrical engineering course at UC Berkeley. In addition, I worked closely with a partner throughout an entire semester to complete it.
FRONT END CIRCUIT
Mic Board: The mic board has four main components, the microphone gain, the variable gain amplifier, a buffer, and capacitor. The microphone gain section converts the variable current from the microphone to a voltage signal. It consists of the microphone and the 10k resistor. The variable gain amplifier changes the gain of the microphone through a potentiometer. The non-inverting side of the amp is connected to OS2 or the level shift (discussed below) and a capacitor to remove any DC offset and noise. The mic and the amplifier are separated by a buffer to ensure the capacitor and the amplifier do not affect the microphone.
Band Pass Filter: The human voice ranges from 180 to 2000 Hz but the microphone picks up a much wider range than that. So, a band pass filter is used to ensure that we only record data in this range. Our band pass filter has a low pass filter, a buffer, a high pass filter, and another buffer. A low pass filter has a “voltage divider” of first a resistor then a capacitor with the resistor taking in the signal and the capacitor connected to ground. The high pass has the resistor and the capacitor switched. The low pass filter cutoff frequencies higher than 3120 Hz and the high pass filter cutoff frequencies lower than 159 Hz. The buffers were used to prevent damage to the MSP.
Voltage Divider: The voltage regulator takes the 9V from the battery and converts it into 5V. The mic board needs for the op amps, and the 5V is also used to power the MSP.
DC Offset: Since our MSP does not like negative inputs, we are unable to use negative voltages in our circuit. This causes us to lose a lot of information if we center our signal around ground like usual. To fix this, we use the DC offset to shift the signal to a usable range (0-3.3) which is centered around 1.65V. This is accomplished by using a voltage divider with two 10k resistors.
Level Shift: The DC offset will also be amplified if we allow it to reference from ground, so the level shift is used to shift everything from ground to 1.65V (in other words match the voltages of OS1 and OS2). The level shift also solves another problem. Since resistors vary greatly, it is difficult to match the voltages of OS1 and OS2. Therefore, a potentiometer is used to make the process easier.
PCA CLASSIFICATION
We used four words: banana bread (go forward far), slower (go forward short), outrigger (turn left), and go (turn right). All four commands worked well because each word has a different number of syllables and sound patterns, resulting in four distinct clusters. One post-processing method that helped us achieve distinct clusters was opening up the .csv files in Excel, plotting the shape of each word, and deleting graphs that did not adhere to the general pattern. We achieved nearly 100% accuracy testing on the workbench using the classify.ino file, but testing in the field proved slightly challenging. Initially, “go” was assigned to the command for driving far and “banana bread” was for turning right. However, we found that “slower” and “banana bread” were often mistaken for the other in field tests. To attempt to solve this issue, we increased the loudness threshold and decreased the KMEANS threshold, but doing so resulted in more cases of the MSP not classifying any commands. We were not satisfied with this result as it increased the effort it took to operate the car, so we compromised by assigning “banana bread” as the command to drive far and “go” to turning right. This way, even if “banana bread” and “slower” are mis-classified as one another, the car would still go straight.
CONTROLS
Open-loop control model:
vL[k] = dL[k +1]−dL[k] = θLuL[k]−βL
vR[k] = dR[k +1]−dR[k] = θRuR[k]−βR
Where uL[k] = v* +βLθL and uR[k] = v* + βRθR
The open-loop control scheme accounts for the physical parameters of the car, θ and β, and inputs a desired velocity, v*, to the controller. However, open-loop does not account for model mismatch. The actual θ and β may be different from their estimates, and real-world perturbations would also cause one wheel to get ahead of the other, resulting in δ[k] = dL[k]−dR[k] increasing without bound and causing the car to turn. To solve this problem, we introduced a closed-loop control model:
vL[k] = dL[k +1]−dL[k] = θL [(v* +βL)/θL − (kLδ[k]) / θL] − βL
vR[k] = dR[k +1]−dR[k] = θR [(v* +βRθR) / θR + (kR δ[k]) / θR ] −βR
Where
uL[k] = (v* + βL) / θL − (kLδ[k]) / θL
uR[k] = (v* + βR) / θR + (kRδ[k]) / θR
The closed-loop control scheme works because of the proportional kL and kR gains. If the car starts turning right (left wheel has traveled more than right wheel), δ[k] > 0 and uL decreases while uR increases (note the -kL and + kR. This sends more power to the right wheel and less to the left to straighten the car. Without loss of generality, the same concept can be applied if the car starts turning left. A closed-loop control scheme accounts for physical parameter mismatches and perturbations, and straightens the car before it starts veering too far in one direction. We chose our proportional gains to be kL = 0.1 and kR = 1.5 because our car tend to veer to the right when it is meant to go straight, so we wanted a larger input to the right wheel to correct that. Since minimizing δ[k] straightens the car, it makes sense that increasing δ[k] turns the car. We implemented a turning via reference tracking scheme, where we input a desired velocity v* and turn radius r, and used δ[k] = (v*lk)/r, where l is the width of the car and k is the number of time steps.
bottom of page