Breathalyzer Medallion
We all have a special friend who needs supervision on a night out. Mine is called Geoffrey, and on his stag weekend it seemed prudent to have an outward display of how much of a liability he was likely to be.
This instructable outlines the construction of a medallion which contains a breathalyzer with a progress bar around the edge and an e-ink display in the middle. It is based on arduino code and uses an ESP32 board which is compatible with the arduino IDE.
Supplies
You will need
- Access to a 3D printer
- Access to a laser cutter
- Metalized laser cut material
- Small lipo battery
- Alcohol sensor - MQ3 or MQ4 breakout board [About £1 on eBay]
- E-ink display [waveshare 2.13" SPI module ~ £15 from banggood]
- ESP32 dev board with lipo charger [I used a lolin32 but adafruit now make the huzzah range which is very nice]
- Neopixel compatible ring [32 pixels is the right size if you want to use the attached CAD]
- Slide power switch [I used RS 829-0611]
- Decorations
Print These Parts
Print and cut out these parts. It is important to use a metallized material for the face plate as it will be used as a capacitive button.
Assemble and Wire Together
Wiring:
Cut the battery wire and connect the switch inline. Connect the output from this to a piece of veroboard for distribution. Follow the schematic for the display and ring lines. I found the MQ45 sensor works more repeatably than the MQ3. They both use a reasonable current so are connected directly to the veroboad instead of through the esp32. The button wire is just a flying lead which uses the cap-touch capabilities of the chip. This pokes through a hole and must be scratched into the surface of the metallized faceplate. I added a garland to complete this medallion but any necklace substitute will do.
Upload the Code
It is likely that you will need to tune the thresholds for both the touchsense button and the alcohol sensor. Bear in mind that these sensors need bedding in for many hours so it is worth leaving it charging overnight before spending time on this.
You will need the following code and libraries
- Medallion code https://github.com/No-George/Medallion
- NeoPixelBus by makuna https://github.com/Makuna/NeoPixelBus
- gxEPD library by ZinggJM https://github.com/ZinggJM/GxEPD
You will also need to install the esp32 board definitions into the arduino IDE
You're Done
When you turn it on you will onscreen instructions. The alcohol sensor takes a while to stabalize so it will spend some time letting this warm up.
Afterwards there will be a heartbeat from the lights. Press the button and breath gently on the sensor for several seconds. After this it will give you a reading and offer to save it. The saved value will turn into the heartbeat. This device is not accurate or consistent but provides some decent entertainment. Enjoy The attached images show 1.6 Geoffreys. This is too many. Shortly after this the screen broke. Potential improvements Use a better sensor: Adafruit now offer an I2C sensor on a breakout board which looks promising Use an oled: The eink display allows saving of power and retains the last reading even after the battery dies. It is hopelessly dim in the dark though so the instructions are tough to follow. Make it small Turn it into a PCB