This week, Ian's objectives were to fix the thermistor on window 2, redesign and reprint the nozzles for the back window, and implement the ultrasonic sensors in the control module.
Thermistor Resolder
The thermistor attached to the window 2 vent visor gave values like an open circuit, so Daniel determined it was likely a connection issue. Ian stripped back the thermistor cable, resoldered, and re-wrapped it. Testing the thermistor with the control module, the circuit read the temperature accurately.
Nozzle Redesign
With the reorientation of the back window intake fans, a nozzle redesign was in order. The new nozzles had to be shorter so that they wouldn't be obstructed by the lip between the window and the car door. The following model was created in Fusion 360 based on the previous design. Since these nozzles are for the back windows, only six of them were needed. Ian employed Duncan Kurtz once more to 3D print them. The nozzles were completed on Sunday, 3/12/2023.
Ultrasonic Sensor Implementation
To replace the IR Proximity sensor, the HC-SR04 Ultrasonic Proximity Sensor was acquired. Luckily, this sensor has the same number of pins that the IR sensor had, so implementing it into the control module was relatively painless.
To start, the following schematic was drawn up. The HC-SR04 requires 5V for the Vcc, so a boost converter was required. The Echo pin is also 5V, so a voltage divider was used to cut the voltage in half at the ADC.
Next, the IR circuit components were desoldered from the MCU board. The schematic above was used as a reference while placing and soldering the new components. The completed circuit is shown below.
2-pin connectors were used to connect the ultrasonic sensors to the control module. These were soldered and wrapped directly to the pins. The green indicator LED's cathode was also soldered directly to the ground pin of the window 1 ultrasonic sensor. A single-pin connector was used to connect the LED's anode.
Next, the proximity sensor code had to be modified. Ian kept the code very similar to the original proximity code. It essentially pulses the Trig pin at 50 Hz and reads the Echo pin at the same rate. When an object approaches the sensor, the average voltage at the Echo pin should increase.
To determine whether the window is up or down, the threshold is set in the code below.
To test the sensors, all four of them were connected and set up on the bench such that they were aimed out into the room. A hard reflective object was placed in front of each ultrasonic sensor and then removed one at a time. The distance value was observed. With no object present, the distance value came out to about 50000. When an object was placed right in front of any of the sensors, a drop of about 5000 occurred, putting the distance around 45000. The threshold was set so that if the distance exceeded 48000, the window would be registered as "Down". Else, the window registers as "Up".
With the threshold set properly, Ian ran the code and moved the object in front of each of the sensors in three-cycle intervals to produce the printout shown below. The green LED attached to the window 1 sensor lit up when the window was "Down" and turned off when the window was "Up," as expected.
While this program produced desirable results in a lab setting, it proved to be unviable once placed in the car. There was some cross-talk between the sensors making the threshold impossible to set, so the code had to be revised to amend this. This will be covered in the group report for this week.
Summary
This week, Ian fixed the thermistor for window 2, redesigned and reprinted the nozzles for the rear window intake fans, and implemented ultrasonic proximity sensors in place of the IR proximity sensors. The ultrasonic sensors proved to function well in a lab setting with only slight modifications to the IR program. Ian updated the engineering specifications and main block diagram to accommodate the new sensors.
Kommentare