MQ-3 alcohol sensor with Arduino
FunduinoPublished on
Alkohol in der Luft erfassen und mit zwei LEDs anzeigen
You need this
MQ-3 alcohol sensor - 0.04-4 mg/L, analog output, 5 V
2,70 € *Item no. F23106855About the product — MQ-3 alcohol sensor - 0.04-4 mg/L, analog output, 5 V
Funduino UNO R3 Microcontroller - ATmega328P, 16 MHz, for Arduino
11,12 € *Item no. F23107480About the product — Funduino UNO R3 Microcontroller - ATmega328P, 16 MHz, for Arduino
Breadboard cables male-female - 40 pieces, 20 cm
1,74 € *Item no. FUN-1010554About the product — Breadboard cables male-female - 40 pieces, 20 cm
All 3 parts together 15,56 € *Ready to ship immediately · Delivery time: 1-3 business days
* All prices include statutory VAT, plus shipping costs.
Material
The connections of the MQ-3
Burn in the sensor and determine the reference value
Read sensor value
Sketch 1: Read sensor value
int Wert;
void setup()
{
Serial.begin(9600); // Diese Baudrate muss auch im Seriellen Monitor eingestellt sein.
}
void loop()
{
// Der analoge Sensorwert wird am Pin A0 ausgelesen.
Wert = analogRead(A0);
Serial.print("Alkoholwert: ");
Serial.println(Wert);
delay(500);
}Display with two LEDs
Sketch 2: Display with two LEDs
int Wert;
int LEDgruen = 13; // Die gruene LED wird mit Pin 13 verbunden
int LEDrot = 12; // Die rote LED wird mit Pin 12 verbunden
void setup()
{
Serial.begin(9600);
pinMode(LEDgruen, OUTPUT);
pinMode(LEDrot, OUTPUT);
}
void loop()
{
Wert = analogRead(A0);
Serial.print("Alkoholwert: ");
Serial.println(Wert);
// Liegt der Wert ueber dem Referenzwert, leuchtet Rot,
// andernfalls Gruen. Der Wert 100 ist ein Beispiel -
// trage hier deinen eigenen Frischluftwert ein.
if (Wert > 100)
{
digitalWrite(LEDrot, HIGH);
digitalWrite(LEDgruen, LOW);
}
else
{
digitalWrite(LEDrot, LOW);
digitalWrite(LEDgruen, HIGH);
}
delay(500);
}Rate the instructions