Tables
| A | A < B | A = B | A > B |
|---|---|---|---|
| 0000 | 7.51 | 0.50 | 0 |
| 0001 | 7.01 | 0.50 | 0.50 |
| 0011 | 6.00 | 0.50 | 1.50 |
| 0111 | 4.01 | 0.50 | 3.51 |
| 1000 | 3.50 | 0.50 | 4.00 |
| 1100 | 1.50 | 0.50 | 6.00 |
| 1110 | 0.50 | 0.50 | 7.01 |
| 1111 | 0 | 0.50 | 7.51 |
| Switch 6 | Switch 5 | Switch 4 | Switch 3 | Motor Response |
|---|---|---|---|---|
| ON | ON | ON | ON | ✓ |
| ON | ON | ON | OFF | ✓ |
| ON | ON | OFF | OFF | ✓ |
| ON | OFF | OFF | OFF | ✓ |
| OFF | OFF | OFF | OFF | ✗ |
Observation: Each stage (descending) causes the motor (running in forward direction) to slow in speed before stopping when all switches are OFF
| Switch 6 | Switch 5 | Switch 4 | Switch 3 | Motor Response |
|---|---|---|---|---|
| ON | ON | ON | ON | ✓ (Starts backwards) |
| ON | ON | ON | OFF | ✓ |
| ON | ON | OFF | OFF | ✓ |
| ON | OFF | OFF | OFF | ✗ (Noise present) |
| OFF | OFF | OFF | OFF | ✓ (Reverses direction) |
Observation: Each stage causes the motor to decrease in speed, before stopping when only 6 is ON, (where a buzzing noise can be observed) and reversing in direction when all switches are OFF
We have chosen to use Table 2’s circuit layout for our car design as we want our vehicle to stop on when reaching a white area rather than perpetually reversing and driving back onto the area.
Purpose (Rewritten)
In this lab, we explored the use of multiplexers (MUX) and comparators in logic circuits and implementing pulse width modulation (PWM) into the control circuit of a model car. PWM enables the adjustment of the car’s speed by varying the wavelength of the digital waveforms, which changes the average voltage supplied to the car’s motors. PWM is advantageous due to it allowing efficient and precise motor control, minimising energy loss, compared to using resistors to reduce voltage, while also maintaining a high level of torque. The car was constructed by connecting MUX and PWM modules to the model and wiring them to the motor driver modules allowing us to observe the improvements in the car’s overall performance.
This lab expands on the concepts introduced in Lab 1, where we practiced constructing a circuit for a model car, meant to follow a pre-set path, using a bang-bang control strategy to steer the vehicle. In Lab 1, the car’s motors were either turned off or fully on as there was no implementation of speed control. This resulted in abrupt and unstable movements by the car, leading it to fall off the track. By applying the use of PWM in Lab 2 to control the speed of the motors smoothly, it results in an increase in the car’s responsiveness and accuracy of following the track. Additionally, Lab 2 developed our use of integrated circuits through using the MUX and comparators, by using it to test our circuits before connecting sensors to the module.
Procedure & Measurements
Using an oscilloscope and probes, we observed the voltage waveforms generated the PWM module under three conditions: when A<B, A=B and A>B. In each case, the signal was measured relative to 0V with the output determined by the positions of the MUX switches 3, 4, 5 and 6 (A is given by the state of each switch as a 4-bit binary code).
We then linked up the circuit to power one motor of the model car and collected data on the motor’s response for different switch combinations, as seen in Table 2. For this circuit (circuit 1) we connected the motor driver modules to the MUX and PWM modules without adjusting anything from the circuit used for Table 1. From the circuit used in Table 2, we observed that as we turned more switches off, there was a reduction in speed on the motor. Turning off all switches caused the motor to stop. This can be explained by the switches controlling the average voltage produced by the PWM module. As the switches are turned OFF (OFF = 1), it causes the time high for A<B to decrease, reducing the time the motor is powered. Thus, the average voltage of the motor is lowered, and the motor runs at a reduced speed. When all switches are OFF, the time high of A<B is 0 and no voltage is supplied to the motor.
We then adjusted the circuit by connecting the A<B output from the PWM module to the motor driver module (circuit 2) and recorded data for the different switch combinations as seen in Table 3. We also observed, that while the motor did decrease in speed as we turned switches OFF, the motor initially ran in the reverse direction. Unlike circuit 1, we observed that the motor stopped despite Switch 6 being ON. In this case, the circuit produced a buzzing noise despite no motion being detected. However, once all switches were turned OFF, the motor began running in the forward direction.
From the data collected from our two circuits, we needed to choose one for implementation in our model car for use in navigating the track. For our car, we would connect the sensor’s output into the circuit to replace the switches to allow the sensors to control the speed of the motor. The sensors produced a “1” (OFF) signal when detecting the white track. Our initial design philosophy was to implement a design similar to circuit 1 as we wanted our car to stop when it reached the end of the track. Although the sensors produced a “0” (ON) output when detecting black, the signal can be inverted by using a NOR or NAND gate as an inverter. We chose to use two sensors, placed right, and left of the centre of the car. As one sensor detected black, it should slow the speed of the motor on the opposite side of the car causing it to turn towards that direction and steer itself back onto the track. The two sensors were linked to switches 5 & 6, and we set the output of switch 6 and 3 to be OFF as to run the car at a lower speed. We found that this design philosophy is flawed, as it was easy for the car to derail of the track and have both sensors output “0” causing the car to get stuck.
Instead, we decided that it would be more effective to use four sensors with circuit 1’s design for our car. By using circuit 1 with four sensors linked up to the switches, it allowed the car to use the external sensors output to steer and the central sensors to make sharper turns (by causing a greater decrease in speed of the opposite wheel). This would provide more reliable steering for the vehicle as by having more sensors, it is less likely that the car gets derailed from the track.
Reflection Re-write
Throughout the lab, we created the circuits to be used for recording data in an efficient and accurate manner as the circuit instructions provided in the lab brief were simple to follow. Overall, we had little issue recording measurements using the oscilloscope.
We did encounter some minor challenges when recording observations for the motor. As there is no way to tell what direction the motor will run when connecting it to the circuit, we had to switch around its wiring between the positive and negative terminals in order for it to run in the correct direction while recording data for circuit 1. We chose not to switch the wiring of the motor when we moved on to circuit 2 resulting in the motor running in reverse. This confusion negatively impacted our formulation of a design philosophy as and the recording of our data as we made errors in clearly outlining what direction the motor was running.
We also faced challenges with formulating a design philosophy. We were suggested to only use some of the sensors as input instead of all four that we had access too, which ended up not fulfilling our goals for the car. Additionally, we were unable to get the motors to work as we expected when implementing our design despite brief testing indicating that the sensors were providing correct input. We are still unsure what the source/s or error could be and were unable to get the system to work as intended. We ended up spending a significant amount of time trying to troubleshoot the car that we were unable to test if our second design philosophy would work due to a lack of time.
Through the course of the lab, we developed our circuit building skills, including maintaining clear, easy-to-follow wiring and using new integrated systems being the MUX and comparator modules. Throughout our circuitry, we used clear colour coding to differentiate our 0V, 5V and 8V lines. We also made effective use of the paths offered by the breadboard to neaten our design. Additionally, it was our first time experimenting with a PWM module and using an oscillator to observe voltage waveforms. We have learnt from this lab the benefits of using a PWM in designs, such as a car, for more effective control of the voltage in a circuit.