Output Devices


Color Color EveryWhere!

Output of Fall Detection

For my fall detection device (my final project), I needed a way to output the states of human motion to the outside world. My fall detection device only recorded three states: still, walk, fall. My output device therefore esentially only needed to output three states. When I realized this, almost immediately I realized that I could convey human motion states using LEDs. Three LEDs, red for fall, green for still and blue for walk states would perfectly solve the problem. However, regular LEDs sounded very simplistic and unflexible. If I wanted to add a new state, I would have to add another LED. A better component would be the RGB LED, which would occupy smaller space on the board, would be flexible and was something I had never used before.

Responsive image RGB LED Strip

Design and Board

On the schematic design for my final board, I added the RGB LED part from the FABLAB Eagle Library. I connected its three inputs to three IO pins on the ESP32 with 499 Ohm resistors in between.

Lights RGB LED on schematic
Lights RGB LED on board, resistors inside dotted blue outline

Flashing the RGB LED

ArduinoModules has a nice page explaining how to use RGB LED's in Arduino. For the first shot, I just tried running the exact code on their page. However, for the ESP32 there was no method called analogWrite() which they use in their code. The method analogWrite() is a way to output pusle-width modulated (PWM) signal on the Arduino Uno. To perform a similar operation on the ESP32, we must first configure LED PWM funcionalities using the ledcSetup() method. Then, choose which pin the PWM signal will be output using ledcAttachPin(). Finally, set the PWM value for each pin using ledcWrite(). This page goes into more detail about outputing PWM on ESP32. Using all this information, I modified the original code from ArduinoModules to make the RGB LED flash. The final code can be found here. Running this script made the RGB LED flash and change colors every fraction of a second as the LED cycled through different colors.

RGB LED Changing Color

Configuring LED for Fall Detection Device

After learning how to program the LED, I configured it to use for displaying the results of the fall detection device. The LED would flash green when still, blue when walking, and red when falling. I programmed it accordingly. While testing, the RGB LED consistently flashed the colors blue and red, however, the it would only flash green sometimes. I checked on the serial monitor and confirmed that the results were being output correctly. The code for flasing green also looked fine. After some tinkering, I figured the connection for the green pin of the LED was faulty. I put in some more solder and made the connection sound. The LED worked well after that.

Lights RGB LED soldered on PCB
Lights Red Outline Marking Point of Flawed Soldering

RGB LED In Action