DIY Breathalyzer

About This Project

I wanted to make a fun practical project using the Adafruit Huzzah Feather and the integrated LiPo charge circuitry. Mining AliExpress for various sensors and bits, I happened upon the MQ3 sensor.

Mine came with a comparator that trips an LED if over a certain level, but I’m using the analog output here.

Connections

The MQ-3 is analog so will work fine of the 3.3V supply of the Huzzah Feather. Connect power and ground from the Feather to the MQ-3. Then connect the analog out to the ADC pin on the Feather. It is supposed to go full scale, but the concentrations I’ve been blowing into it don’t register more than half a volt, so don’t need a resistor divider. Note that the ADC pin on the ESP-12 is max 1V, but I have exceeded it without causing any damage.

Next you are going to want to ground GP0 and GP15 and the ground from your USB to Serial cable. Connect RX from your serial cable to TX on the Feather, and TX to the Feather’s RX. Press the reset button, you are ready to program.

##Tips

Select the Huzzah Feather from the Arduino IDE. Plug in your serial cable and verify that the IDE has the right serial port selected. Enter your wifi and Cayenne Token and let her rip.

When creating your dashboard widget, you want to create a analog sensor widget, and use Virtual 1 like in the sketch. Selecting A0 from the integrated ADC selection does not work (I think A3 might). I like the gauge as you can set ranges that change colours as you increase in inebriation :stuck_out_tongue:

This could easily be scaled using the Arduino Map function to give you more BAC type values.

Also note that this sensor is sensitive to temperature, so if you blow hard on it, you will actually get erroneous results. I suggest an apparatus that restricts airflow like a straw. Will probably 3D print a housing for this.

I plan on putting the Cayenne dashboard up on the big screen TV and everyone gets to watch the level of stupor :slight_smile:

##Code
#define CAYENNE_DEBUG
#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
#include “CayenneDefines.h”
#include “BlynkSimpleEsp8266.h”
#include “CayenneWiFiClient.h”
#include <ESP8266WiFi.h>

// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = "...";
// Your network name and password.
char ssid[] = "...";
char password[] = "...";

void setup()
{
  Serial.begin(9600);
  Cayenne.begin(token, ssid, password);
}

void loop()
{
 Cayenne.run();
}

CAYENNE_OUT(V1)
{
  Cayenne.virtualWrite(V1,analogRead(A0));
  Serial.print("Read:");
  Serial.println(analogRead(A0));
}

What’s Connected

Adafruit Feather Huzzah
1200 mAH LiPo battery with JST connector
MQ3 board
USB to Serial Cable.

Triggers & Alerts

Not using triggers yet, but if someone is blowing over, could sure send a text to my wife to come get me :stuck_out_tongue:

Scheduling

It’s a bit early to be drinking yet no?

Dashboard Screenshots


Upps! Red. Better go to bed.

Photos of the Project


The Basics


Programming Connections

3 Likes

So, who is going to QA this project? :smirk:

2 Likes