Manufaktur industri
Industri Internet of Things | bahan industri | Pemeliharaan dan Perbaikan Peralatan | Pemrograman industri |
home  MfgRobots >> Manufaktur industri >  >> Manufacturing Technology >> Proses manufaktur

Peringatan Email & SMS Instan untuk Detak Jantung Tidak Normal

Komponen dan perlengkapan

Modul Sensor Pengukur Detak Jantung
×1
Peringatan Email & SMS Instan untuk Detak Jantung Tidak Normal
Arduino Mega 2560
×1
Peringatan Email & SMS Instan untuk Detak Jantung Tidak Normal
Modul WiFi Bolt IoT Bolt
×1
Peringatan Email & SMS Instan untuk Detak Jantung Tidak Normal
Kabel jumper (umum)
×7

Aplikasi dan layanan online

Peringatan Email & SMS Instan untuk Detak Jantung Tidak Normal
Bolt IoT Bolt Cloud
DigitalOcean
Layanan VPS untuk menjalankan kode pemantauan detak jantung.
Mailgun
Layanan otomatisasi email
Peringatan Email & SMS Instan untuk Detak Jantung Tidak Normal
Twilio SMS Messaging API

Tentang proyek ini

Alat pemantauan detak jantung 24x7 seperti gelang kebugaran sudah umum di pasar saat ini dan Anda mungkin memiliki satu atau dua bahkan!. Bagaimana jika Anda bisa membuat perangkat serupa tetapi juga dapat mengirim SMS atau email atau keduanya jika terjadi kekurangannya dalam detak jantung Anda? Tertarik? Proyek ini tentang bagaimana melakukannya dengan cara paling mudah.

Lihat proyek ini dalam aksi:

Langkah 1: Menghubungkan Modul Sensor Detak Jantung ke Arduino

Menggunakan kabel jumper jantan-ke-betina, buat koneksi berikut :

Langkah 2: Pemrograman di Arduino

Instal Arduino IDE dari https://www.arduino.cc/en/Main/Software dan tulis kode berikut:

unsigned long highCounter = 0; int pulse = 0; int val = 0; int lastPulse = LOW; unsigned long oldMillis = 0; void setup() { pinMode(2, INPUT); Serial.begin(9600); } void loop() { pulse = digitalRead(2); if (pulse != lastPulse) { lastPulse = pulse; if (pulse == HIGH) highCounter++; } // print and reset highCounter every seconds if ( millis() - oldMillis >= 10000 ) { oldMillis = millis(); val = highCounter * 6; if (highCounter > 1) Serial.println(val); highCounter = 0; } } 

Simpan, Verifikasi dan Unggah kode.

Kode ini akan:

Langkah 3: Menghubungkan Modul WiFi BOLT ke Arduino

Menggunakan kabel jumper jantan-ke-jantan, buat koneksi berikut:

Koneksi ini memberikan daya pada Modul WiFi BOLT dan mendirikan komunikasi serial antara Modul WiFi BOLT dan Arduino.

Titik ini semua koneksi perangkat keras selesai

Langkah 4: Menyiapkan Layanan Otomatisasi Email menggunakan Mailgun

Peringatan Email & SMS Instan untuk Detak Jantung Tidak Normal

Peringatan Email & SMS Instan untuk Detak Jantung Tidak Normal

Langkah 5: Menyiapkan Layanan SMS menggunakan Twilio

Peringatan Email & SMS Instan untuk Detak Jantung Tidak Normal
Peringatan Email & SMS Instan untuk Detak Jantung Tidak Normal
Peringatan Email & SMS Instan untuk Detak Jantung Tidak Normal
Peringatan Email & SMS Instan untuk Detak Jantung Tidak Normal

Langkah 6: Menggunakan VPS DigitalOcean untuk Menjalankan Kode Pemantauan Detak Jantung

Catatan: Anda juga dapat menyimpan komputer linux khusus atau menjalankan linux dalam virtual machine alih-alih menggunakan VPS seperti DigitalOcean.

Untuk memperbarui paket pada Ubuntu

sudo apt-get -y update 

Untuk Instal python3 pip3

sudo apt install python3-pip 

Untuk menginstal library boltiot menggunakan pip

sudo pip3 install boltiot 

Untuk membuat file python bernamaconf.py

sudo nano confi.py 
#Credentials from Twilio SID = 'You can find SID in your Twilio Dashboard' AUTH_TOKEN = 'You can find on your Twilio Dashboard' FROM_NUMBER = 'This is the no. generated by Twilio. You can find this on your Twilio Dashboard' TO_NUMBER = 'This is your number. Make sure you are adding +91 in beginning' #Credentials from Mailgun MAILGUN_API_KEY = 'This is the private API key which you can find on your Mailgun Dashboard' SANDBOX_URL= 'You can find this on your Mailgun Dashboard' SENDER_EMAIL = 'This would be test@your SANDBOX_URL' RECIPIENT_EMAIL = 'Enter your Email ID Here' #Credentials from Bolt API_KEY = 'This is your Bolt Cloud accout API key' DEVICE_ID = 'This is the ID of your Bolt device' 
sudo nano heart_rate.py 
import conf, json, time from boltiot import Email, Bolt from boltiot import Sms, Bolt minimum_limit = 57 #the minimum threshold of heart rate maximum_limit = 100 #the maximum threshold of heart rate mybolt = Bolt(conf.API_KEY, conf.DEVICE_ID) mailer = Email(conf.MAILGUN_API_KEY, conf.SANDBOX_URL, conf.SENDER_EMAIL, conf.RECIPIENT_EMAIL) sms = Sms(conf.SSID, conf.AUTH_TOKEN, conf.TO_NUMBER, conf.FROM_NUMBER) while True: response = mybolt.serialRead(2) data = json.loads(response) sensor_value = data['value'] try: sensor_value = data['value'] if sensor_value > maximum_limit or sensor_value < minimum_limit: response = mailer.send_email("Alert", "The Current Heart Rate is " +str(sensor_value)) response = sms.send_sms("Alert! The Current Heart Rate is " +str(sensor_value)) except Exception as e: print () time.sleep(10) 
sudo python3 Heart_rate.py 

Ketika detak jantung menjadi tidak normal, SMS dan email akan dikirim ke ponsel dan email ID Anda masing-masing.

Peringatan Email & SMS Instan untuk Detak Jantung Tidak Normal
Peringatan Email & SMS Instan untuk Detak Jantung Tidak Normal

Kode

Kode ArduinoArduino
Kode untuk menghitung nilai detak.
unsigned long highCounter = 0; int pulse = 0; int val = 0; int lastPulse = LOW; unsigned long oldMillis = 0; void setup() { pinMode(2, INPUT); Serial.begin(9600); } void loop() { pulse = digitalRead(2); if (pulse != lastPulse) { lastPulse = pulse; if (pulse == HIGH) highCounter++; } // print and reset highCounter every seconds if ( millis() - oldMillis >= 10000 ) { oldMillis = millis(); val = highCounter * 6; if (highCounter > 1) Serial.println(val); highCounter = 0; } } 
conf.pyPython
Kode yang berisi kunci API dan kredensial lainnya untuk menggunakan Bolt, MailGun dan Twilio
#Credentials from Twilio SID = 'You can find SID in your Twilio Dashboard' AUTH_TOKEN = 'You can find on your Twilio Dashboard' FROM_NUMBER = 'This is the no. generated by Twilio. You can find this on your Twilio Dashboard' TO_NUMBER = 'This is your number. Make sure you are adding +91 in beginning' #Credentials from Mailgun MAILGUN_API_KEY = 'This is the private API key which you can find on your Mailgun Dashboard' SANDBOX_URL= 'You can find this on your Mailgun Dashboard' SENDER_EMAIL = 'This would be test@your SANDBOX_URL' RECIPIENT_EMAIL = 'Enter your Email ID Here' #Credentials from Bolt API_KEY = 'This is your Bolt Cloud accout API key' DEVICE_ID = 'This is the ID of your Bolt device' 
heart_rate.pyPython
Kode untuk mengumpulkan nilai detak dan memeriksa anomali
import conf, json, time from boltiot import Email, Bolt from boltiot import Sms, Bolt minimum_limit = 57 #the minimum threshold of heart rate maximum_limit = 100 #the maximum threshold of heart rate mybolt = Bolt(conf.API_KEY, conf.DEVICE_ID) mailer = Email(conf.MAILGUN_API_KEY, conf.SANDBOX_URL, conf.SENDER_EMAIL, conf.RECIPIENT_EMAIL) sms = Sms(conf.SSID, conf.AUTH_TOKEN, conf.TO_NUMBER, conf.FROM_NUMBER) while True: response = mybolt.serialRead(2) data = json.loads(response) sensor_value = data['value'] try: sensor_value = data['value'] if sensor_value > maximum_limit or sensor_value < minimum_limit: response = mailer.send_email("Alert", "The Current Heart Rate is " +str(sensor_value)) response = sms.send_sms("Alert! The Current Heart Rate is " +str(sensor_value)) except Exception as e: print () time.sleep(10) 

Skematik

Buat koneksi seperti yang ditunjukkan dalam skematik iniPeringatan Email & SMS Instan untuk Detak Jantung Tidak Normal

Proses manufaktur

  1. Cara Menggunakan Data dan Storytelling untuk Mengamankan Persetujuan Proyek Pemeliharaan
  2. Sembilan Strategi Teruji untuk Mengamankan Pekerjaan Anda dan Mempercepat Pertumbuhan Karier
  3. 5 Cara Pelumas Anti-Seize Hemat Waktu, Uang, dan Mencegah Kesulitan di MRO
  4. Panduan Ahli: Memelihara Alat Pemulihan Pelarut untuk Kinerja Maksimal
  5. Respons Cepat: Bagaimana Kami Mengatasi Penghentian Tiba-tiba pada Mesin Cetak Offset Komori 28”
  6. Mengoptimalkan Pasangan Excavator dan Hauler untuk Efisiensi dan Keuntungan Maksimal di Pertambangan
  7. 4 Faktor Utama Saat Membeli Blade Pemotong Industri
  8. Memilih Pompa Penguat Air Otomatis yang Tepat untuk Rumah Anda: Panduan Praktis
  9. Memahami Tipe Baut dan Sekrup untuk Pemasangan Optimal
  10. Sekrup vs. Baut: Perbedaan Utama, Tipe, dan Aplikasi