Monday, 13 August 2018

Embedded PID Temperature Control, Part 4: The Scilab GUI



With USB communications and a Scilab graphical user interface, we can really see what the PID controller is doing.

Supporting Information


Previous Articles in This Series


Before we get started, here is the PID control system diagram presented previously:

And here are PID-related portions of the schematic:


Much Better Than LEDs

The LED visualization scheme used in the previous article was pretty limited. The fact is, just about any visualization scheme based on nothing more than a few LEDs will be pretty weak. We need something that allows us to see exactly what our PID controller is doing—first, because it will be way more interesting, and second, because we need detailed information about the performance of the system in order to properly set the proportional, integral, and derivative gain.
For this stage of the project, then, we are going to incorporate USB capability into the EFM8 firmware and design a Scilab graphical user interface that controls the setpoint and displays, in real time, the actual measured temperatures. The “Supporting Information” section above points you to articles that provide introductory information regarding EFM8 USB functionality and Scilab. You can also scroll through my previous articles and take a look at anything that involves Scilab GUIs or USB communication.

Firmware

USB Commands

The firmware has been changed so that PID operation is governed by Scilab. The EFM8 does not initiate PID functionality until Scilab tells it to, and then Scilab can halt and resume PID functionality at any time. To initiate or resume PID operation, Scilab sends ASCII “C” over the USB link, and to halt PID operation it sends ASCII “H”; both commands are just a single character without carriage return or newline or what not. The heater-drive voltage is set to 0 V whenever PID operation is halted, so keep in mind that the temperature of the heating element will gradually decrease toward room temperature during a halt condition. Scilab can also change the setpoint; this is accomplished by sending ASCII “S” followed by a one-byte binary (i.e., non-ASCII) number that represents the setpoint in degrees Celsius. These three commands are incorporated into the VCPXpress callback function.

                    VCPXpress_API_CALLBACK(myAPICallback)
{
   uint32_t API_InterruptCode;

   //get the code that indicates the reason for the interrupt
   API_InterruptCode = Get_Callback_Source();

   //if the USB connection was just opened
   if (API_InterruptCode & DEVICE_OPEN)
   {
    //start the first USB read procedure
    Block_Read(USBRxPacket, USB_PACKET_SIZE, &USBBytesRcvd);
    /*we will process the received bytes when we get
    a callback with an RX_COMPLETE interrupt code*/
   }

   if (API_InterruptCode & RX_COMPLETE)   //USB read complete
   {
     //'C' tells the EFM8 to begin or resume PID control
     if(USBRxPacket[0] == 'C')
     {
      PID_ACTIVE = TRUE;
     }

     //'H' tells the EFM8 to halt PID control
     else if(USBRxPacket[0] == 'H')
     {
      PID_ACTIVE = FALSE;

      /*The heater-drive voltage is held at 0 V
       * while PID control is halted.*/
      UpdateDAC(DAC_HEATER, 0);
     }

     //'S' indicates that the host is sending the setpoint
     else if(USBRxPacket[0] == 'S')
     {
      /*The setpoint temperature is restricted to
       * positive integers not greater than 100 
       * degrees C. Scilab sends the setpoint as a 
       * normal binary number, not as ASCII characters,
       * so that the EFM8 doesn't have to convert
       * from ASCII to binary.*/
      Setpoint_Temp = USBRxPacket[1];
     }

    //continue with the next USB read procedure
    Block_Read(USBRxPacket, USB_PACKET_SIZE, &USBBytesRcvd);
   }
}

                  

PID Flow

The PID routine in the main while loop now begins by checking the PID_ACTIVE flag, which is initialized to FALSE. Execution remains at this point until a “C” command from Scilab causes the EFM8 to change this flag to TRUE. Another important difference is that the measured temperature is sent to Scilab at the beginning of every iteration. In previous projects, Scilab first requested data via a USB command, then the EFM8 sent the data as a response to the request. In this project, Scilab does not have to ask for data; the EFM8 sends a three-byte measured-temperature packet during every iteration, and Scilab just receives and displays the data. This reduces the USB traffic and the burden on the EFM8’s processor, and consequently we should have less trouble with the higher update rates required for improved visualization of changes in the controlled variable. The current firmware uses an update interval of two seconds, which seems to provide adequate control and visualization without overburdening the EFM8 or the Scilab GUI. The following code excerpt covers the PID portion of the main while loop:

                    while (1)
{
 /*First, we check PID_ACTIVE.The following while statement
  * suspends PID functionality until the EFM8 is commanded by
  * Scilab to begin or resume PID control.*/
 while(PID_ACTIVE == FALSE);

 GatherMAX31855Data();
 while(TEMP_DATA_READY == FALSE); //wait until the SPI transaction is complete

 Measured_Temp = ConvertMAX31855Data_to_TempC();

 //send measured temperature to Scilab
 TransmitUSB_TempData();

 Error = Setpoint_Temp - Measured_Temp;

 /*We don't want the integral error to get
  * way too large. This is a standard problem
  * referred to as integral windup. One solution
  * is to simply restrict the integral error to
  * reasonable values.*/
 Error_Integral = Error_Integral + Error;
 if(Error_Integral > 50)
  Error_Integral = 50;
 else if(Error_Integral < -50)
  Error_Integral = -50;

 Error_Derivative = Error - Previous_Error;
 Previous_Error = Error;

 PID_Output = (K_proportional*Error) + (K_integral*Error_Integral) + (K_derivative*Error_Derivative);

 /*We need to restrict the PID output to
  * acceptable values. Here we have limited it
  * to a maximum of 200, which corresponds
  * to about 780 mA of heater-drive current, and
  * a minimum of 0, because we cannot drive
  * less than 0 A through the heating
  * element.*/
 if(PID_Output > 200)
  PID_Output = 200;
 else if(PID_Output < 0)
  PID_Output = 0;

 //here we convert the PID output from a float to an unsigned char
 Heater_Drive = PID_Output;

 UpdateDAC(DAC_HEATER, Heater_Drive);
                  

LEDs

Though insufficient by itself, LED feedback is still a handy way to monitor the operation of the system. It is also helpful as a way to confirm that the data displayed by Scilab is consistent with what is really going on in the EFM8. To make the LED feedback more suitable for this second purpose, we will take a different approach in this stage of the project: If the measured temperature is within ±2°C of the setpoint, we turn on only the green LED. If the measured temperature is more than 2°C below the setpoint, we turn on only blue. If the measured temperature is more than 2°C above the setpoint, we turn on only red. So, green = good, blue = too cold, and red = too hot. The advantage of this scheme will be apparent when the measured temperature is oscillating around the setpoint, because the changes in LED color will be in sync with the temperature variations displayed in the GUI. The LED control code is included in the second portion of the main while loop.

                    /*LED visualization: If the measured temperature is within
  * plus/minus 2 degrees C of the setpoint, we turn on the
  * green LED. If the measured temperature is more than
  * 2 degrees below the setpoint, we turn on the blue LED.
  * If the measured temperature is more than 2 degrees
  * above the setpoint, we turn on the red LED.*/
 if(Measured_Temp >= (Setpoint_Temp-2) && Measured_Temp <= (Setpoint_Temp+2))
 {
  UpdateDAC(DAC_RGB_R, 0);
  UpdateDAC(DAC_RGB_B, 0);
  UpdateDAC(DAC_RGB_G, 100);
 }

 else if(Measured_Temp < (Setpoint_Temp-2))
 {
  UpdateDAC(DAC_RGB_R, 0);
  UpdateDAC(DAC_RGB_B, 100);
  UpdateDAC(DAC_RGB_G, 0);
 }

 else if(Measured_Temp > (Setpoint_Temp+2))
 {
  UpdateDAC(DAC_RGB_R, 100);
  UpdateDAC(DAC_RGB_B, 0);
  UpdateDAC(DAC_RGB_G, 0);
 }

 /*Here we wait until the PID interval has expired,
  * then we begin a new iteration. The interval is
  * currently set to 2 seconds.*/
 PID_WAIT = TRUE;
 while(PID_WAIT == TRUE);
}
                  

Here is a link to download all the source and project files.


Scilab

Here is what the GUI looks like when it is not active:
It was designed with the help of the GUI Builder toolbox, which you can download through Scilab’s ATOMS module manager:
Here is a link to download the GUI script (it’s just a single text file).


First you use the “Open VCP Port” button to establish a virtual COM port connection to the EFM8. Next, choose the setpoint. Scilab restricts the setpoint to integers less than or equal to 100. If you enter a value greater than 100, Scilab will automatically reduce it to 100 and display “Setpoint reduced to maximum allowable value, i.e., 100°C” in the message bar below the “Open VCP Port” button. Likewise, if you enter a non-integer, Scilab rounds it to the nearest integer and displays a message to that effect. Now you are ready to click the “Activate PID Control” button. The setpoint is not actually sent to the EFM8 until you click this button, and you cannot change the setpoint while PID control is active. This will be obvious because the setpoint text-entry box is grayed out during active PID control. To change the setpoint, you have to click “Halt PID Control,” then change it, then click “Activate PID Control” to resume PID operation.
When you are done using the GUI, first click “Halt PID Control” (unless PID control is already inactive), then click “Close VCP Port,” then close the GUI window. If you don’t follow this procedure, you might need to restart Scilab or reset the EFM8 or some such. It’s annoying, but not catastrophic.
Let’s take a quick look at some salient portions of the Scilab script. First, this is how Scilab sends the “S” (setpoint) and “C” (initiate/resume PID control) commands, after you click “Activate PID Control”:
The Setpoint value is taken from the text-entry box as follows:
When PID control is active, Scilab repeatedly checks the virtual COM port receive buffer. Once three bytes have been received, it reads the three bytes, converts them into a temperature value, and adds them to an array that contains all the measured temperature values received since the last time that “Activate PID Control” was clicked:
The plot that displays the measured temperatures also has a green dotted line that corresponds to the setpoint. The following code is used to generate the setpoint line:

Results

In the previous article, we looked at the (LED- and oscope-based) results for a proportional-only system and a proportional-integral system. In both cases the control task was to bring the heating element from 30°C to a setpoint of 50°C. We were able to determine that 1) the P-only system never reached the setpoint and 2) the PI system did reach the setpoint, though with some amount of overshoot. Now let’s take a look at GUI-based results for the same control task. First the P-only system:
We can see that the P-only system actually gets very close to the setpoint, but without integral gain, the temperature decreases somewhat and reaches a steady-state value that is about 2°C below the setpoint. As we mentioned in the previous article, P-only systems are known for their susceptibility to significant steady-state error.
Here is the plot for the PI system:
We can see here that the PI system is actually worse than we thought. It does indeed reach the setpoint, but it causes more than just overshoot—this particular configuration actually leads to sustained (or at least long-term) oscillation around the setpoint.

Conclusion

The video at the end of this article (it runs at 16x normal speed) shows the LED behavior that corresponds to the plot for the PI system. In the video you will also notice an important hardware detail: the PCB we are using for this project actually has two USB connectors, one for power and one for data. A typical USB port cannot supply more than 500 mA. Thus, to get the higher current we need for the heating element, the board includes the option of taking power from a separate connector. So one of the USB cables is connected to a USB charger that can supply something like 1200 mA, and the other is connected to a USB port on the PC.
In the next article we will use our fancy new GUI to explore how different P, I, and D gains influence the performance of the system.

How to Interface an Ultrasonic Sensor with an LCD Using a Microcontroller Dev Kit




Let's interface an ultrasonic sensor and a lighting system! In this project, we're going to design a system that uses an ultrasonic sensor to trigger a lighting system and an LCD as an information screen.
To show the system in action, we're making a non-contact garage parking sensor system using a C8051 microcontroller development kit and the Simplicity Studio IDE. The measured distance will be displayed on the LCD screen, and two LED floodlights will activate as a function of the distance between the vehicle and the sensor.

System Requirements and Applications

The system we're building here has the following features and requirements:
  • Proximity/detection sensor: The ultrasonic distance sensor serves as a proximity/detection sensor. When an object is detected, it must constantly, in real time and with minimal time lag, measure the distance to a moving object.
  • Small in size: The system should not occupy too much space in the garage or wherever else it is used, and it should fit within a reasonably sized enclosure.
  • Bells and whistles, and/or lights: The system must have a noticeable alarm for announcing when an object has reached its ideal/targeted location.
  • No AC voltage: It must be free of AC voltage (for safety and mobility reasons). Using 12 V as the supply voltage allows the system to run from an off-the-shelf AC-to-DC converter or from a 12 V battery.
Based on these parameters, you should be able to incorporate this system into a number of different applications: 
  • Swimming pool or home garden detection system for sending an alert when the curiosity of children and/or pets gets the better of them…like that never happens.
  • To help prevent your friends and neighbors (or family members!) from stealing the leftover pizza and beer from your fridge—they are free to roam your kitchen, but if they get too close to the fridge…SOUND THE ALARM!
  • Do you like to camp and enjoy the great outdoors? A battery-powered system could be used to help prevent your young children from getting too close to a stream when you’re reading your book or casting that fishing line.
At the end of this project, I'll show you a sensing system for a garage in action.
Let's get started by going through our bill of materials.

BOM

Item #Description / SourceCost (each)Other Information
1  C2400DK development kit  $148.75  User guide (PDF)
  Quick-start guide (PDF)
  C8051F930 datasheet (PDF)
  Note: schematics are on pages 25-31
  of the User Guide.
2  Breadboard  $8.98  or equivalent
3  Jumper wire kit  $6.20  or equivalent
4  Ultrasonic sensor  $29.99  Datasheet (PDF)
5  N-Channel MOSFET  $1.17  Datasheet (PDF)
6  5V voltage regulator  $2.66  Datasheet (PDF)
7  LED floodlight (qty 2)  $10.50  10W (12V DC or AC)
8  10μF capacitor  $0.22  or equivalent
9  10μF capacitor (Tantalum)  $0.98  or equivalent

LCD Display

The LCD used in the project is part of the Silicon Labs CP2400DK development kit.

Figure 1. Silicon Labs CP2400DK development kit (C8051 microcontroller and LCD controller). Image courtesy of Digi-Key.

Refer to this article for information on the LCD and driver.

Figure 2. LCD screen with 16 segments for each of the eight digits (total of 128 segments). Image courtesy of Digi-Key.

Figure 3. 128-segment LCD driver. Images courtesy of Silicon Labs (pages 1 and 22).

Non-Contact Ultrasonic Distance Sensor

The PING (part # 28015) is a non-contact, ultrasonic (40kHz), distance measurement sensor made by Parallax.

Figure 4. Ultrasonic distance sensor. Image courtesy of Digi-Key.

The PING ultrasonic sensor is quite easy to use, and it only requires three electrical connections:
  • 5VDC
  • GND
  • A digital signal referred to as SIG
With an advertised measurement sensing distance ranging from 0.8 inches (2 cm) to 118 inches (3 meters), this device works by first transmitting an ultrasonic burst and then providing an output pulse (on the "SIG" signal) that corresponds to the time required for the ultrasonic burst echo to return to the sensor. The distance to the target can then be calculated by measuring the echo pulse width. The image below helps describe this transmit-and-measure dance.

Figure 5. Ultrasonic distance sensor implementation and timing diagram. Image from this sensor datasheet (PDF).

And because this device uses sound for determining the distance to an object, one must be certain to take into consideration the air temperature when calculating the measured distance. As shown in the equation below, air temperature can significantly impact the measurement results.

cair=(331.5+0.606∗TC)m/s

where TC=air temperature in degrees Celsius (∘C)


LED Flood Lights

The reasons I chose these particular 12V LED flood lights are as follows:
  • I had them in my lab.
  • They are easy to mount using their built-in adjustable mounting bracket.
  • They don't pull too much current (only 830mA each).
  • They are IP65 rated, making them perfect for this project.

Figure 6. 12V LED Flood Light. Image courtesy of Amazon.

Voltage Regulator

Because the LED flood lights require 12 V (AC or DC) for operation, and because the PING sensor requires 5 VDC for operation, I decided to use a single 12 VDC power supply and then use a linear voltage regulator(LM1084IT-5.0 (PDF)) to generate the 5 VDC for the PING sensor; the microcontroller development kit will also use the 5V. Although the LM1084 series includes an adjustable-voltage variant, I opted for the fixed 5.0V version, which makes its implementation easier given that only two external components are needed, namely:
  • a 10µF capacitor for the input voltage
  • a 10µF capacitor (tantalum, as recommended by the datasheet) for the output voltage

Figure 7. LM1084 linear regulator. Diagrams from this datasheet (PDF).

N-Channel MOSFET

The N-Channel MOSFET (FQP19N20C (PDF)) is simply used as a switch for turning the LED floodlights on and off. Because this FET is rated for 19A (much more than the ~2A required to energize the two LED flood lights), it's obviously overkill. But hey, it was in my lab so I made use of it.

Figure 8. FQP19N20C N-channel MOSFET. Images from the datasheet (PDF).

Making the Connections / Schematic

SPI is used for communicating with the LCD driver. Figure 9 below shows the hardware configuration for the SPI module.

Figure 9. SPI configuration.

I've selected port P1.4 for communicating with the PING sensor (it both initiates the ultrasonic transmission, by sending a pulse to the PING, and then monitors the return signal); port P2.1 controls the LED floodlights.

Figure 10. Connection diagram. Click to enlarge.

Configuring the Microcontroller Development Kit

Prior to powering up the microcontroller development kit, after all the connections have been made, be sure to configure it as follows:
Jumpers:
  • J11: VBAT to WALL_PWR
  • J12: VDD to VIO
  • J17: VBAT_PIN to VBAT

Switches:
  • SW4: set to "2 CELL"
  • Power switch (SW5) to "OFF" position

Cables:
  • Connect the ribbon cable debug adapter to J9
  • Connect the USB debug adapter to your PC
  • Apply 5.0 VDC to connector P2

Example Application: Parking Sensor System

Now that we've designed our system, let's use it.

The Firmware

The code that controls the LED flood lights uses the following conditions:
  • If the vehicle is greater than or equal to 97 inches from the sensor the lights are OFF.
  • If the vehicle is less than 97 or greater than 30 inches from the sensor, the lights flash.
  • If the vehicle is less than or equal to 30 inches from the sensor, the lights are ON.
Note: There's 1 inch of hysteresis built-in between 97 and 96 inches, and again between 31 and 30 inches.

                    //-----------------------------------------------------------------------------
// Display Value Routine
// ----------------------------------------------------------------------------

if(DisplayResults == 1)
{
 // Serial port.

 // Note: the format "%3.3f" --> "3" = width of 3 positions; ".3" = 3 digits after decimal point;
 printf("\nDistance: %3.3f inches          ", (float) MeasuredDistanceInches);

 // Set cursor to home position on screen.
 printf("\033[0;0H");

 MeasuredDistanceInches = MeasuredDistanceInches*10.0;

 // Note: the format "d" --> "0" = Left-pads the number with zeroes (0) instead of spaces.
 // "4" = width of 4 positions; "d" = Signed decimal integer.
 sprintf(display_string, "d in ", (unsigned int) MeasuredDistanceInches);

 LCD_OutString(display_string); // Send data to LCD.
 DisplayResults = 0;  // Reset flag.

 // If the measured distance is less than 30 inches, then turn ON the lights.
 if(MeasuredDistanceInches <= 300)
 {
  LightsOn = 1;
  LightOnFlag = 1; // Set flag signifying that the lights are ON.
  LightOffFlag = 0; // Set flag signifying that the lights are not OFF.
  LightBlinkFlag = 0; // Set flag signifying that the lights are not blinking.
 }

 // If the measured distance is less than or equal to 96 and greater than or equal to 31 inches,
 // then blink the lights.
 else if((MeasuredDistanceInches <= 960) && (MeasuredDistanceInches >= 310))
 {
  if((LightsOn == 1) && (LightBlinkCounter == 0))
  {
   LightsOn = 0;
   LightBlinkCounter = 1;
   LightOnFlag = 0; // Set flag signifying that the lights are not ON.
   LightOffFlag = 0; // Set flag signifying that the lights are not OFF.
   LightBlinkFlag = 1; // Set flag signifying that the lights are blinking.
  }

  else if((LightsOn == 1) && (LightBlinkCounter > 0))
  {
   LightBlinkCounter--;
  }

  else if((LightsOn == 0) && (LightBlinkCounter == 0))
  {
   LightsOn = 1;
   LightBlinkCounter = 1;
  }

  else if((LightsOn == 0) && (LightBlinkCounter > 0))
  {
   LightBlinkCounter--;
  }
 }

 // If the measured distance is less than 97 inches and greater than 96 inches,
 // and the lights are currently off, then leave the lights off.
 else if((MeasuredDistanceInches < 970) && (MeasuredDistanceInches > 960) && (LightOffFlag == 1))
 {
  LightsOn = 0;
  LightOnFlag = 0; // Set flag signifying that the lights are not ON.
  LightOffFlag = 1; // Set flag signifying that the lights are OFF.
  LightBlinkFlag = 0; // Set flag signifying that the lights are not blinking.
 }

 // If the measured distance is less than 97 inches and greater than 96 inches,
 // and the lights are currently blinking, then leave the lights blinking.
 else if((MeasuredDistanceInches < 970) && (MeasuredDistanceInches > 960) && (LightBlinkFlag == 1))
 {
  LightOnFlag = 0; // Set flag signifying that the lights are not ON.
  LightOffFlag = 0; // Set flag signifying that the lights are not OFF.
  LightBlinkFlag = 1; // Set flag signifying that the lights are blinking.

  if((LightsOn == 1) && (LightBlinkCounter == 0))
  {
   LightsOn = 0;
   LightBlinkCounter = 1;
   LightOnFlag = 0; // Set flag signifying that the lights are not ON.
   LightOffFlag = 0; // Set flag signifying that the lights are not OFF.
   LightBlinkFlag = 1; // Set flag signifying that the lights are blinking.
  }

  else if((LightsOn == 1) && (LightBlinkCounter > 0))
  {
   LightBlinkCounter--;
  }

  else if((LightsOn == 0) && (LightBlinkCounter == 0))
  {
   LightsOn = 1;
   LightBlinkCounter = 1;
  }

  else if((LightsOn == 0) && (LightBlinkCounter > 0))
  {
   LightBlinkCounter--;
  }
 }

 // If the measured distance is less than 31 inches and greater than 30 inches,
 // and the lights are either currently on or off (off would occur at startup), then leave/turn
 // the lights on.
 else if((MeasuredDistanceInches < 310) && (MeasuredDistanceInches > 300) && ((LightOnFlag == 1) ||
 (LightOffFlag == 1)))
 {
  LightsOn = 1;
  LightOnFlag = 1; // Set flag signifying that the lights are ON.
  LightOffFlag = 0; // Set flag signifying that the lights are not OFF.
  LightBlinkFlag = 0; // Set flag signifying that the lights are not blinking.
 }

 // If the measured distance is less than 31 inches and greater than 30 inches,
 // and the lights are currently blinking, then leave the lights blinking.
 else if((MeasuredDistanceInches < 310) && (MeasuredDistanceInches > 300) && (LightBlinkFlag == 1))
 {
  LightOnFlag = 0; // Set flag signifying that the lights are not ON.
  LightOffFlag = 0; // Set flag signifying that the lights are not OFF.
  LightBlinkFlag = 1; // Set flag signifying that the lights are blinking.

  if((LightsOn == 1) && (LightBlinkCounter == 0))
  {
   LightsOn = 0;
   LightBlinkCounter = 1;
   LightOnFlag = 0; // Set flag signifying that the lights are not ON.
   LightOffFlag = 0; // Set flag signifying that the lights are not OFF.
   LightBlinkFlag = 1; // Set flag signifying that the lights are blinking.
  }

  else if((LightsOn == 1) && (LightBlinkCounter > 0))
  {
   LightBlinkCounter--;
  }

  else if((LightsOn == 0) && (LightBlinkCounter == 0))
  {
   LightsOn = 1;
   LightBlinkCounter = 1;
  }

  else if((LightsOn == 0) && (LightBlinkCounter > 0))
  {
   LightBlinkCounter--;
  }
 }

 // If the measured distance is more than or equal to 970 inches, then turn OFF the lights.
 else if(MeasuredDistanceInches >= 970)
 {
  LightsOn = 0;
  LightOnFlag = 0; // Set flag signifying that the lights are not ON.
  LightOffFlag = 1; // Set flag signifying that the lights are OFF.
  LightBlinkFlag = 0; // Set flag signifying that the lights are not blinking.
 }
}
                  

All the code for this project can be downloaded from the link below.


Building and Loading the Code, Testing the System

After downloading, building, and loading the code, I moved the entire system, including my benchtop DC power supply, to my garage for actual "in-field" testing (see video below). And I'm happy to report that the system worked as designed, and I didn't back into the rear wall/shelving of my garage!

Figure 11. The breadboard/system is energized and functional. Click to enlarge.


Next Steps for Making a Real Product

The next steps for this project would include:
  1. Integrating all the electronics into a custom-designed PCB.
  2. Adding a temperature sensor so that the system can determine the measured distance more accurately.
  3. Implementing, via firmware, a timer routine for turning off the LED lights after the vehicle is safely parked. After all, we don't want to waste electricity by keeping the lights on whenever the car is in the garage.
  4. Placing the custom-designed PCB in a suitable electronics enclosure.
  5. Replacing the benchtop 12V power supply with an OTS (off the shelf) 12V power adaptor, such as this one, and making sure its ampacity is adequate for powering the LED floodlights.
  6. Additional testing in both hot (100°F) and cold (0°F) environments.

Happy parking!



L