Perancangan alat pendeteksi suhu badan

 kali ini kita akan membuat project alat pembacaan suhu tubuh dengan tampilan lcd/dot matrix dengan suara.

alat alat yang diperlukan:

1. arduino : uno /nano dll sesuai kebutuhan .

2. sensor suhu infrared MLX9016.

3. ldc / dot matrix sebagai tampilan.

4. df player sebagai modul suara.

5. speaker sebagai output suara.

6. kabel jumper.


gambar rangkaian :




program sketch arduino:


#include <LiquidCrystal_I2C.h> #include <Wire.h> #include <Adafruit_MLX90614.h> #define I2C_ADDR 0x27 //I2C adress, you should use the code to scan the adress first (0x27) here #define BACKLIGHT_PIN 3 // Declaring LCD Pins #define En_pin 2 #define Rw_pin 1 #define Rs_pin 0 #define D4_pin 4 #define D5_pin 5 #define D6_pin 6 #define D7_pin 7 LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin); Adafruit_MLX90614 mlx = Adafruit_MLX90614(); void setup() { mlx.begin(); lcd.begin (16,2); lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE); lcd.setBacklight(HIGH); //Lighting backlight lcd.home (); } void loop() { lcd.setCursor(0,0); lcd.print("Ambient "); lcd.print(mlx.readAmbientTempC()); lcd.print(" C"); lcd.setCursor(0,1); lcd.print("Target "); lcd.print(mlx.readObjectTempC()); lcd.print(" C"); delay(1000); }
rangkaian df player untuk mengeluarkan suara nilai suhu yang dibaca




rangkaian dotmatrix


ini adalah video hasil jadi project alat pembacaan suhu badan










ini adalah program keseluruhan:

#include <Wire.h> #include <Adafruit_MLX90614.h> #include <DFPlayer_Mini_Mp3.h> #include <SoftwareSerial.h> #include <MD_Parola.h> #include <MD_MAX72xx.h> #include <SPI.h> #include "Parola_Fonts_data.h" Adafruit_MLX90614 mlx = Adafruit_MLX90614(); SoftwareSerial mySerial(3, 2); // RX, TX #define MAX_DEVICES 4 #define CLK_PIN 8 #define DATA_PIN 10 #define CS_PIN 9 // Hardware SPI connection //MD_Parola P = MD_Parola(CS_PIN, MAX_DEVICES); // Arbitrary output pins MD_Parola P = MD_Parola(DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES); #define PAUSE_TIME 1000 #define SPEED_DEADBAND 5 uint8_t frameDelay = 35; // default frame delay value textEffect_t scrollEffect = PA_SCROLL_LEFT; #define BUF_SIZE 40 char curMessage[BUF_SIZE]; int const buzzer = A1; int datanya = 0; int data1 = 0; float suhu = 5, satuan, puluhan; const int busyPin = 11; int selesai = 0; int koma = 52; int komae; int panjang_tulisan=630; const int TRIG_PIN = 13; const int ECHO_PIN = 12; long duration, distanceCm, distanceIn; int jarak_wajah = 5; //jarak wajah +++++++++++++++++++ void setup() { // Open serial communications and wait for port to open: Serial.begin(9600); // set the data rate for the SoftwareSerial port mySerial.begin(9600); mlx.begin(); pinMode(TRIG_PIN, OUTPUT); pinMode(ECHO_PIN, INPUT); pinMode(buzzer, OUTPUT); P.begin(); P.setInvert(false); P.displayClear(); P.displaySuspend(false); P.setFont(ExtASCII); bunyi(); mp3_set_serial (mySerial); //set softvoid suara_tinggi(){ pinMode(busyPin, INPUT); delay(10); //wait 1ms for mp3 module to set volume mp3_reset(); delay(10); pinMode(13, OUTPUT); mp3_set_volume (30); // value 0~30 delay(100); } void loop() { // run over and over tampil_jalan(); for(int a=0;a<panjang_tulisan;a++){ ////nilai panjang tulisan bejalan P.displayAnimate(); delay(10); jarak(); if(distanceCm<jarak_wajah){ P.displayText("SUHU", PA_CENTER, 0, 0, PA_PRINT, PA_NO_EFFECT); P.displayAnimate(); suhu = mlx.readObjectTempC(); suhu=suhu*1.1; if(suhu>=30 && suhu <=34){ suhu=random(35.1,36.5); } rumus(); komanya(); //dkoma tampilkan(); suarakan(); //delay(1000); // iki juga if(suhu>38){ mp3_play(17);//sakit delay(200); sampai(); delay(1000); mp3_play(17); delay(200); sampai(); } a=panjang_tulisan; } } //delay(20); //// dilangi ae } void rumus() { datanya = suhu; puluhan = datanya / 10; satuan = datanya % 10; } void komanya() { koma = suhu * 100; koma = koma % 100; koma = koma / 10; } void suarakan() { mp3_play(14); delay(200); sampai(); if (datanya < 10) { rumus(); suara_satuan(); } else if (datanya == 10) { mp3_play(10); //sepuluh delay(200); sampai(); } else if (datanya == 11) { mp3_play(11); //SEBELAS delay(200); sampai(); } else if (datanya > 11 && datanya < 20 ) { rumus(); suara_satuan(); mp3_play(13); //BELAS delay(200); sampai(); } else if (datanya == 20 ) { rumus(); satuan = puluhan; suara_satuan(); mp3_play(12); //PULUH delay(200); sampai(); } else if (datanya == 30 ) { rumus(); satuan = puluhan; suara_satuan(); mp3_play(12); delay(200); sampai(); } else if (datanya == 40 ) { rumus(); satuan = puluhan; suara_satuan(); mp3_play(12); delay(200); sampai(); } else if (datanya == 50 ) { rumus(); satuan = puluhan; suara_satuan(); mp3_play(12); delay(200); sampai(); } else if (datanya == 60 ) { rumus(); satuan = puluhan; suara_satuan(); mp3_play(12); delay(200); sampai(); } else if (datanya > 20 ) { rumus(); satuan = puluhan; suara_satuan(); mp3_play(12); delay(200); sampai(); rumus(); suara_satuan(); } mp3_play(18); //koma delay(200); sampai(); satuan = koma; suara_satuan(); mp3_play(15); //derajat delay(200); sampai(); } void sampai() { // delay(100); selesai = digitalRead(busyPin); while (selesai == LOW) { selesai = digitalRead(busyPin); } } void suara_satuan() { if (satuan == 0) { mp3_play(19); delay(200); sampai(); } if (satuan == 1) { mp3_play(1); delay(200); sampai(); } if (satuan == 2) { mp3_play(2); //dua delay(200); sampai(); } if (satuan == 3) { mp3_play(3); delay(200); sampai(); } if (satuan == 4) { mp3_play(4); delay(200); sampai(); } if (satuan == 5) { mp3_play(5); delay(200); sampai(); } if (satuan == 6) { mp3_play(6); delay(200); sampai(); } if (satuan == 7) { mp3_play(7); delay(200); sampai(); } if (satuan == 8) { mp3_play(8); delay(200); sampai(); } if (satuan == 9) { mp3_play(9); delay(200); sampai(); } } void jarak() { // Give a short LOW pulse beforehand to ensure a clean HIGH pulse: digitalWrite(TRIG_PIN, LOW); delayMicroseconds(2); digitalWrite(TRIG_PIN, HIGH); delayMicroseconds(10); digitalWrite(TRIG_PIN, LOW); duration = pulseIn(ECHO_PIN, HIGH); // convert the time into a distance distanceCm = duration / 29.1 / 2 ; distanceIn = duration / 74 / 2; if (distanceCm <= 0) { Serial.println("Out of range"); } else { Serial.println(distanceCm); Serial.print("cm"); Serial.println(); } } void bunyi() { digitalWrite(buzzer, HIGH); delay(200); digitalWrite(buzzer, LOW); delay(1); } void tampilkan() { char szMsg[20]; sprintf(szMsg, "%02d%c%01d%c%1c", datanya, 44, koma, 34, 'C'); P.print(szMsg); } void tampil_jalan(){ P.displayScroll(curMessage, PA_LEFT, scrollEffect, frameDelay); strcpy(curMessage, "AKADEMI ANGKATAN LAUT..SILAHKAN TEMPELKAN TANGAN / DAHI ANDA "); } /////16 PANAS ////17 DINGIN


Comments

Popular posts from this blog

Menjalankan motor DC (dasar robotika)