Introduction: Anti Face Touch Hat
Intro
Amidst the coronavirus pandemic, one of the biggest recommendations from the CDC is to stop touching your face. This seems easy enough, but you often touch your face without even thinking about it! This is especially true for children. This hat is designed to alert the wearer when they touch their face by detecting the touch and creating a buzzing sound in order to prevent touches and limit the spread of pathogens from the wearer's hands to their face. It can be used indoors and outdoors in any dry weather.
Project Goals
The goal of our project is to design a hat attachment that will detect face touching accurately. The device must be light weight, discrete, comfortable, accurate, and alert the users reliably.
Overview
The sensor detects face touching accurately up to 7 inches away from the sensor on the hat, which is roughly the average face length. This system is a preventative solution that can be replicated by those that have some technical abilities or those who can follow instructions very carefully.
To use the built device, all you need to do is turn the power switch on while wearing the hat, and it will automatically begin sensing face touches.
Video
Evaluation
The device emits a sound whenever the user touches their face. A proximity sensor is attached to a LilyPad arduino and tells it whenever an object get's 5% closer than any object currently is. This triggers a buzzer that is attached to the LilyPad to go off. The LilyPad, buzzer, and battery are attached to the back of the hat via a 3D printed clip attachment. When tested, this device detected face touches 90% of the time.
Supplies
Supplies:
- Bass Pro Shops Hat (or any baseball-style hat)
- LilyPad Arduino USB
- Battery
- Buzzer
- Proximity Sensor
- PLA Filament
- 12" wire x4
- 1.25" wire x2
- Solder
Tools:
- Soldering Iron
- Thick Sewing Needle (1.25mm)
Step 1: Proximity Sensor
The sensor is located under the brim of the hat, while the Arduino LilyPad is located in the back, so you should use the long wires to connect them. Solder your long wires to the GND, 3.3V, SDA, and SCL pins on the sensor. There is no need to solder anything to the INT pin as it isn't used. Use electrical tape to cover up any exposed wire.
It is helpful to color code the wires. We used the following colors:
- White = SCL
- Yellow/Grey = SDA
- Red/Purple = 3.3V
- Blue = GND
Carefully sew your proximity sensor on the underside of the hat brim using a thick needle. Brims are thick and require some force to puncture, so keeping fingers out of the way is essential. We sewed it on very securely so that the sensor would not move and cause false positives. We used a 1.25mm needle and it worked well.
Run the sensor wires to the back of the hat through the hat mesh. In towards front, out towards back. This step can be skipped, but the sensor is much more discrete if it isn't. This step also helps to keep the wires from moving around and getting caught on things, so we recommend doing it for these reasons.
Step 2: 3D Print
We 3D printed the attached Strap Attachment 3D Print file. We printed this on an Ender 5 using 20% infill, gyroid pattern, 0.4mm nozzle at 120mm/s, but any reasonable settings should work. It is best to print the file as pictured because other orientations would require support structure.
Attach the print to the strap on the back of the hat. It should snap snugly into place and should work for many different hat straps.
This enclosure will contain your LilyPad, buzzer and battery.
Link to file on Thingiverse:
https://www.thingiverse.com/thing:4324783
Step 3: Buzzer
Solder the + and - pins of buzzer to the short wires (~1 in, use best judgement). Wrap electrical tape over any exposed wire.
Solder the + wire to pin 9 on LilyPad.
Solder the - wire to the - pin on LilyPad.
Pictured is the bottom side of the LilyPad showing wire connections. It is important to not have too much extra wiring as that can make it difficult to fit the devices into the holder and could make the device obtrusive.
Step 4: Sensor -> LilyPad
Download the HatSensor code and upload it to LilyPad board. Note that the LilyPad must have its power switch turned on to work.
Run wires from the mesh into the holes in print, SCL and SDA through top hole, GND and 3.3V through bottom.
Once the wires are through the 3D print, it's time to solder them to the LilyPad. On the LilyPad, solder the following connections:
- SCL wire to pin 3
- SDA to pin 2
- 3.3V to the + pin
- GND to the - pin.
Our wires:
- White = SCL
- Yellow/Grey = SDA
- Red/Purple = 3.3V
- Blue = GND
To keep the LED on the sensor off while running, remove this line of code. If you want to adjust the LED's brightness, reduce the 200 to any number between 50 and 200 depending on your desired brightness. The device may be more discreet without the LED.
proximitySensor.setLEDCurrent(200);
Here is the full Arduino code, which you can also obtain from the attached .ino file:
#include <wire.h> #include <sparkfun_vcnl4040_arduino_library.h> /* Proximity Sensing with the VCNL4040 IR based sensor Base public domain code by: Nathan Seidle Adapted by: Andrew Fulmer */ //Click here to get the library: http://librarymanager/All#SparkFun_VCNL4040 VCNL4040 proximitySensor; int buzzPin = 9; long startingProxValue = 0; long deltaNeeded = 0; boolean nothingThere = false; void setup() { Serial.begin(9600); Serial.println("IsSomethingThere Example"); Wire.begin(); //Join i2c bus if (proximitySensor.begin() == false) { Serial.println("Device not found. Please check wiring."); while (1); //Freeze! } //Set the current used to drive the IR LED - 50mA to 200mA is allowed. proximitySensor.setLEDCurrent(200); //For this example, let's do max. //The sensor will average readings together by default 8 times. //Reduce this to one so we can take readings as fast as possible proximitySensor.setProxIntegrationTime(1); //1 to 8 is valid //Take 5 readings and average them // The first few readings tend to be inaccurate, but readings 200+ seem to be accurate for(byte x = 0 ; x < 210 ; x++) { if (x > 200 && x < 205) { startingProxValue += proximitySensor.getProximity(); } } startingProxValue /= 5; // To make up for averaging 5 startingProxValue /= 6; // To make up for inaccuracies // Must be 5% change, or at least 3 different deltaNeeded = (float)startingProxValue * .05; if(deltaNeeded < 3) deltaNeeded = 3; } void loop() { unsigned int proxValue = proximitySensor.getProximity(); Serial.print("Proximity: "); Serial.print(proxValue); Serial.print(" "); //Let's only trigger if we detect a 5% change from the starting value //Otherwise, values at the edge of the read range can cause false triggers if(proxValue > (startingProxValue + deltaNeeded)) { Serial.print("Something is there!"); nothingThere = false; tone(buzzPin, 1000, 500); } else { if(nothingThere == false) Serial.print("I don't see anything"); Serial.print("Starting: "); Serial.print(startingProxValue); nothingThere = true; } Serial.println(); delay(10); }<br>
Attachments
Step 5: Attach Battery
Attach battery to LilyPad and set it in the battery slot.
One convenient thing about the LilyPad, is the battery can be charged directly through the LilyPad. To charge the battery, turn the switch on the LilyPad from ON to CHG and plug it into a micro usb charger.
If you wish to turn the device off so to save the battery, you can turn the LilyPad back to CHG.
Step 6: USE
Turn on the power switch on the LilyPad, and make sure nothing is covering the sensor.
The code will sense what is in front of the sensor and set it's baseline. If things move 5% closer to it than what is tested when initially turned on, the buzzer will buzz.
Put the hat on and it should buzz whenever you attempt to touch your face after it has set its baseline.
Common problems:
- Make sure every connection is secure.
- Make sure LilyPad is turned on