Week 11, Working on my Final Project
This week I focused on laying some of the groundwork for my final project. My idea is to use the Huzzah board to setup up an intrahospital communication system. A lot of hospitals currently are struggling to keep track of patients, PPE, and what's needed given how inundated they are with COVID-19 cases. My project aims to create an easy, hands free system for doctors and nurses to communicate their needs and their patients' conditions and needs to a centralized hospital system.
The first intrahospital connection device I wanted to set up was a sensor that doctors and nurses could use to inform the hospital when they needed more Personal Protective Equipment (PPE). Essentially, I wanted it to be easy for nurses and doctors to communicate to their floor and some central hospital database when they needed PPE
Given COVID-19 transmission in hospitals, I wanted this to be hands free. One way to do this, I thought, is to use capacitive sensors. My idea became for each PPE sensor to have one capacitive sensor that indicates a floor/unit needs PPE when a doctor or nurse waves their hand in front of it, and a second that indicates a floor/unit does not need PPE. This capacitive sensor would 1) light up or turn off an LED indicating whether the floor needs PPE, 2) communicate this information to a larger database so the hospital can see this information at a centralized location, and 3) be completely hands free.
If each floor or unit has one of these sensors, people walking around could see the LED and know whether they need PPE. Also, the hospital could use the centralized database to see if specific floors/units need PPE.
Materials Needed: a Huzzah board, wires, a resistor, and an LED. Downloads needed: Adafruit ESP32 Feather board download, Firebase account
The first way I learned how to communicate with the Huzzah is through my house's local wifi. This involved a Simple Wifi tutorial that allowed us to use our laptop's IPN's to control an LED. The way this works is by following the simple wifi tutorial and essentially this uses your wifi information to send information to the Huzzah board when you click input buttons on your computer screen.
But, what if we want to control this Huzzah board without being in our wifi network? What if we wanted to control this Huzzah from somewhere else anywhere around the world? The answer is Databases! Firebase is one site that can help with this. Essentially our Arduino IDE communicates with Firebase to set the state of something on our Huzzah (for instance, an LED). We can thus write the state of the LED directly into Firebase, and don't need to be within our wifi network.
The first step was figuring out how to use some kind of input to change the state of the LED in the firebase database without manually changing it in the database console or using the webpage. Last week, I used a firebase webpage to power an LED, but my first step this week was figuring out how to do this with buttons.
I used buttons in a pull down resistor scenario. I.E. the buttons were connected to the 3.3V pin of the Huzzah and to other input pins, so when they were clicked, the input pins would read high voltage.
I then wrote my code to essentially write the state of the LED to be ON in the firebase console when one button was clicked, and OFF when the other button was clicked. This code looked like:
And all together, these buttons were able to write to the database and turn on and off an LED.
The next thing I wanted to do was set up a Capacitive Sensor with the Huzzah. I realized that I couldn't use the capactive sensor library for the Huzzah, and instead had to figure out another way to do this. I learned that the Huzzah has some General Purpose Input/Output (GPIO) pins setup to be touch sensors, and looked up which GPIO corresponded to which touch sensor.
I then read about the touch functions on the huzzah and ended up realizing that these touch pins work directly as capacitive sensors with touch functions built in. You can read more about this here:
The problem is, that these touch sensors are not as sensitive as capacitive sensors can be. I tried playing with the resistance values to change the sensitivity, but readings were just not sensitive enough to get this to be as hands free as I hoped.
So instead, I set up a capactive sensor using an Arduino Uno, resistor, and a spoon using the capacitive sensor library and circuit describes in output devices (Week 7). I then measured values of the capacitve sensor, and got a threshold value for what it crosses when I bring my hand close to the spoon. I was able to then use this threshold value to turn on and off an LED!
This is what the capacitive sensor circuit looked like:
But at this point I still didn't know how to use capacitive touch to write to the firebase database. For this, I really needed the Huzzah. So, instead of doing things just on the Uno, I set up a wired connection between the Arduino Uno (transmitter) and the Huzzah by connecting the grounds, and the 5V of the Arduino Uno to the 3V of the Huzzah. I also set up one more output pin on the Arduino and connected this to an input pin on the Huzzah.
This wired connection looked like:
Next, I needed to set up the code. To do this, I followed this logic: Once the capactive sensor (spoon) on the arduino uno reads a value greater than the threshold (meaning your hand is close to it), it sends an output signal on the wired connection pin on the uno to the input pin on the Huzzah. The Huzzah, when it reads an input voltage on this pin, writes "ON" for the LED state in the database, and this turns on the LED connected to the Huzzah.
And this worked! Check it out:
After getting one spoon set up to turn on the LED, it wasn't too hard to create a second capacitive sensor on my arduino uno, create a second wired connection to the Huzzah, and get a second spoon set up to turn off the LED, indicating the floor/unit does not need PPE.
I wanted to make this look slightly more ~ attractive ~, so I constructed a cardboard holder for my spoons and circuitry with the LED. This looks like:
And here's a video of this project in it's current state!