ข้ามไปที่เนื้อหาหลัก

ส่งงานครั้งที่ 7

Alcohol Detector Circuit Board
อุปกรณ์
  1. Arduino UNO
  2. Alcohol detector Arduino shield from JLCPCB
  3. Alcohol Sensor (MQ3)
  4. Resistor 10K
  5. Resistor 1K
  6. 16x2 LCD
  7. Power Supply
  8. 10k POT
  9. LED
  10. LM358
  11. Burgstips
  12. Push button
Diagram


Code


#include <LiquidCrystal.h> //เรียกใช้จอLCD
LiquidCrystal lcd(12,11,5,4,3,2); //กำหนดขา

#define sensor A0
#define led 13
#define buz 9
void setup() 
{
  Serial.begin(9600); //ตั้งค่าการรับส่งข้อมูลที่ 9600 บิท
  lcd.begin(16,2); //ให้LCDเริ่มที่ตำแหน่ง 16x2
  lcd.print("Alcohol Detector"); 
  lcd.setCursor(0,1);
  lcd.print(" Circuit Digest ");
  delay(2000);
  pinMode(sensor, INPUT);
  pinMode(buz, OUTPUT);
  pinMode(led, OUTPUT);
  lcd.clear();
}

void loop() 
{
  float adcValue=0;
  for(int i=0;i<10;i++)
  {
    adcValue+= analogRead(sensor);
    delay(10);
  }
    float v= (adcValue/10) * (5.0/1024.0);
    float mgL= 0.67 * v;
    Serial.print("BAC:");
    Serial.print(mgL);
    Serial.print(" mg/L");
    lcd.setCursor(0,0);
    lcd.print("BAC: ");
    lcd.print(mgL,4);
    lcd.print(" mg/L        ");
    lcd.setCursor(0,1);
    if(mgL > 0.8)
    { 
      lcd.print("Drunk   ");
      Serial.println("    Drunk");
      digitalWrite(buz, HIGH);
      digitalWrite(led, HIGH);
    }
    else
    {
      lcd.print("Normal  ");
      Serial.println("    Normal");
      digitalWrite(buz, LOW);
      digitalWrite(led, LOW);
    }

    delay(100);
    
}
Credit By : https://circuitdigest.com/microcontroller-projects/arduino-alcohol-detector-circuit-board

ความคิดเห็น

โพสต์ยอดนิยมจากบล็อกนี้

ส่งงานครั้งที่ 18

12 V Battery Charger อุปกรณ์ Transformer 12V 1Amp IC LM317 (2) Diode Bridge W005 Connector Terminal Block (2) Capacitor 1000uF, 1uF Capacitor 0.1uF (5) Variable resistor 100R Resistor 1k (5) Resistor 10k Diode- Nn007  (3) LM358 – Opamp 0.05R - Shunt Resistor/wire LCD-16*2 (optional) Arduino Nano (optional) Diagram Code #include <LiquidCrystal.h>// ประกาศเมื่อใช้LCD LiquidCrystal lcd(11, 12, 10, 9, 8, 7); float voltage,current;  void setup() {   Serial.begin(9600);   //ตั้งค่าLCD   lcd.begin(16, 2);   // Print a message to the LCD.   lcd.setCursor(0, 0);   lcd.print("12V Charger");   lcd.setCursor(0, 1);   lcd.print("-Circuit Digest");   delay(2000);   lcd.clear();   lcd.setCursor(0, 0);   lcd.print("Voltage = ");   lcd.setCursor(0, 1);   lcd.print("Current = "); } void loop() {   voltage = (analogRead(A0)) * 0.0140625;   current = (an...

ส่งงานครั้งที่ 15

Arduino Solar Tracker อุปกรณ์ Servo Motor (sg90) Solar panel Arduino Uno LDR’s X 2 (Light Dependent Resistor) 10K resistors X 2 Battery (6 to 12V) Diagram Code #include <Servo.h>      //ประกาศเมื่อมีการใช้Servo Servo sg90;             //ตั้งค่าServoด้วยตัวแปรsg90 int initial_position = 90;   //ประกาศตัวแปรไว้ที่ค่า 90 int LDR1 = A0;          //ขาที่LDRต่อไว้ int LDR2 = A1;          //ขาที่LDR2ต่อไว้ int error = 5;          //ตั้งค่าเริ่มต้นของ error ที่ 5 int servopin=9; void setup() {    sg90.attach(servopin);  // ให้ servo ที่ขา 9   pinMode(LDR1, INPUT);   //ให้ขาที่ต่อกับLDRเป็นInput   pinMode(LDR2, INPUT);   sg90.write(initial_position);   //ขยับServoไว้ที่90องศา   delay(2000);            // กำหนดdelay2วินาที } void loop() {   int ...

ส่งงานครั้งที่ 16

Smoke Detector Using MQ2 อุปกรณ์ Arduino UNO Smoke Detector Arduino Shield (Self Designed) Power Supply Smoke Sensor (MQ2) Resistors (10K and 1K) Buzzer 16x2 LCD 10k POT LED LM358 Burg strips Diagram Code #include <LiquidCrystal.h> LiquidCrystal lcd(12, 11, 5, 4, 3, 2); #define buzzer 9 #define sensor A0   #define load_Res 10   #define air_factor 9.83                                                   float SmokeCurve[3] ={2.3,0.53,-0.44};    // (x, y, slope) x,y พิกัดของจุดหนึ่งและความลาดชันระหว่างสองจุด                                                                                     ...