ระบบแจ้งเตือนน้ำประปาด้วย SMS

ลองใช้เครื่องมือของเราเพื่อกำจัดปัญหา





ในโพสต์นี้เราจะสร้างวงจรซึ่งจะแจ้งให้ผู้ใช้ทราบทาง SMS หากมีการเริ่มต้นการจ่ายน้ำให้กับคุณในพื้นที่ / บ้าน สามารถแสดงเวลาที่น้ำเริ่มจ่ายและสิ้นสุดความเร็วการไหลของน้ำเฉลี่ยเป็นลิตรต่อนาทีและน้ำทั้งหมดที่ส่งไปยังถังของคุณเป็นลิตร

บทนำ

เราทุกคนรู้ดีว่าชีวิตบนโลกเป็นไปไม่ได้หากไม่มีน้ำเช่นเดียวกับมนุษย์ เราใช้น้ำมากขึ้น มากกว่าสิ่งมีชีวิตอื่น ๆ บนโลกที่บริโภคไม่เพียง แต่เพื่อความอยู่รอดของเรา แต่ยังเพื่อตอบสนองความต้องการอันหรูหราของเราด้วย



เราไม่เพียง แต่บริโภคน้ำ แต่ยังทำให้แหล่งน้ำปนเปื้อนด้วย ปริมาณการใช้น้ำและความต้องการจะเพิ่มสูงขึ้นในอีกไม่กี่ทศวรรษข้างหน้า

ในฐานะพลเมืองโลกเป็นหน้าที่ของเราที่จะต้องประหยัดน้ำ แต่ในฐานะปัจเจกบุคคลเราไม่อาจสนองความกระหายของคนทั้งโลกได้ด้วยการประหยัดน้ำ แต่เราสามารถตอบสนองความกระหายของครอบครัวเราได้อย่างแน่นอนเพราะเราอาจมีน้ำในปริมาณที่ดีต่อสุขภาพในช่วงเวลาสั้น แม้ว่ารอบ ๆ ตัวเราจะไม่มีใครช่วยน้ำไว้ใช้ในอนาคต



ปริมาณน้ำในอินเดียและประเทศกำลังพัฒนาอื่น ๆ มี จำกัด และยังมีความต้องการสูงนอกจากนี้การจัดหาน้ำยังสามารถเริ่มต้นได้โดยไม่ต้องมีการแจ้งอย่างเป็นทางการจากรัฐบาลท้องถิ่น โครงการนี้จะแก้ปัญหานี้ให้เรา

ตอนนี้เรามาดูรายละเอียดทางเทคนิคของโครงการกัน

วงจร:

วงจรประกอบด้วย เซ็นเซอร์การไหลของน้ำ YF-S201 บอร์ด Arduino ซึ่งเป็นสมองของโครงการก โมดูล GSM (SIM 800 หรือ SIM 900) สำหรับรับการแจ้งเตือนทาง SMS เกี่ยวกับการจ่ายน้ำและโมดูลนาฬิกาแบบเรียลไทม์สำหรับการติดตามเวลาที่ถูกต้องสำหรับการเริ่มต้นจ่ายน้ำและการยุติการจ่ายน้ำ

แหล่งจ่ายไฟ 9 โวลต์เป็นที่พึงปรารถนาสำหรับการจ่ายไฟให้กับบอร์ด Arduino และโมดูล GSM ขอแนะนำให้จัดหาแหล่งจ่ายไฟจากอะแดปเตอร์ 9V หรือแหล่งจ่ายไฟที่สร้างขึ้นเองแบบโฮมเมด (LM 7809)

วงจรแจ้งเตือนน้ำประปาโดยใช้ SMS

การเชื่อมต่อระหว่างโมดูล Arduino และ GSM ดังต่อไปนี้:

โมดูล Arduino TX ถึง RX GSM

โมดูล Arduino RX เป็น TX GSM

โมดูล Arduino GND ถึง GND GSM

อย่าพยายามจ่ายไฟให้โมดูล GSM จากขาเอาต์พุต 5V ของ Arduino เป็นอินพุต 5V ของโมดูล GSM

โมดูลนาฬิกา RTC หรือเรียลไทม์จะติดตามเวลาที่น้ำมาถึงและการหยุดจ่ายน้ำ

นั่นสรุปฮาร์ดแวร์

ในการตั้งเวลาใน RTC เราจำเป็นต้องอัปโหลดโปรแกรมการตั้งค่าเวลาไปยัง RTC ด้วยการตั้งค่าฮาร์ดแวร์ที่สมบูรณ์ การดำเนินการนี้จะซิงค์เวลาบนคอมพิวเตอร์ของคุณกับ RTC

ดาวน์โหลดไฟล์ไลบรารี RTC: github.com/PaulStoffregen/DS1307RTC

โปรแกรมสำหรับตั้งเวลาใน RTC:

//-----------------------------------------------------------//
#include
#include
#include
int P = A3 //Assign power pins for RTC
int N = A2
const char *monthName[12] = {
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
}
tmElements_t tm
void setup() {
pinMode(P, OUTPUT)
pinMode(N, OUTPUT)
digitalWrite(P, HIGH)
digitalWrite(N, LOW)
bool parse = false
bool config = false
// get the date and time the compiler was run
if (getDate(__DATE__) && getTime(__TIME__)) {
parse = true
// and configure the RTC with this info
if (RTC.write(tm)) {
config = true
}
}
Serial.begin(9600)
while (!Serial) // wait for Arduino Serial Monitor
delay(200)
if (parse && config) {
Serial.print('DS1307 configured Time=')
Serial.print(__TIME__)
Serial.print(', Date=')
Serial.println(__DATE__)
} else if (parse) {
Serial.println('DS1307 Communication Error :-{')
Serial.println('Please check your circuitry')
} else {
Serial.print('Could not parse info from the compiler, Time='')
Serial.print(__TIME__)
Serial.print('', Date='')
Serial.print(__DATE__)
Serial.println(''')
}
}
void loop() {
}
bool getTime(const char *str)
{
int Hour, Min, Sec
if (sscanf(str, '%d:%d:%d', &Hour, &Min, &Sec) != 3) return false
tm.Hour = Hour
tm.Minute = Min
tm.Second = Sec
return true
}
bool getDate(const char *str)
{
char Month[12]
int Day, Year
uint8_t monthIndex
if (sscanf(str, '%s %d %d', Month, &Day, &Year) != 3) return false
for (monthIndex = 0 monthIndex <12 monthIndex++) {
if (strcmp(Month, monthName[monthIndex]) == 0) break
}
if (monthIndex >= 12) return false
tm.Day = Day
tm.Month = monthIndex + 1
tm.Year = CalendarYrToTm(Year)
return true
}
//-----------------------------------------------------------//

·อัปโหลดโค้ดด้านบนด้วยฮาร์ดแวร์ที่สมบูรณ์

·เปิดจอภาพอนุกรมและแสดงเวลาที่ตั้งไว้

·ตอนนี้คุณพร้อมที่จะไปยังขั้นตอนต่อไป

คุณตั้งเวลาให้กับโมดูล RTC สำเร็จแล้ว

ตอนนี้มาอัปโหลดโปรแกรมหลักซึ่งจะแจ้งให้เราทราบทาง SMS

โปรแกรมหลัก:

//-----Program Developed by R.Girish-----//
#include
#include
#include
int X
int Y
int sec = 50
int t = 0
int i = 0
int check = 1
int chk = 0
int P = A3
int N = A2
int tim = 0
float Time = 0
float frequency = 0
float waterFlow = 0
float total = 0
float LS = 0
float average = 0
const int input = A0
const int test = 9
void setup()
{
Serial.begin(9600)
pinMode(input, INPUT)
pinMode(test, OUTPUT)
analogWrite(test, 100)
pinMode(P, OUTPUT)
pinMode(N, OUTPUT)
digitalWrite(P, HIGH)
digitalWrite(N, LOW)
for (i = 0 i {
delay(1000)
}
Serial.println('AT+CNMI=2,2,0,0,0')
delay(1000)
Serial.println('AT+CMGF=1')
delay(500)
Serial.println('AT+CMGS='+91xxxxxxxxxx' ') // Replace x with mobile number
delay(1000)
Serial.println('Your water supply notification system is ready.')// The SMS text you want to send
delay(100)
Serial.println((char)26) // ASCII code of CTRL+Z
delay(1000)
}
void loop()
{
tmElements_t tm
if (RTC.read(tm))
{
if (tm.Hour > 12) //24Hrs to 12 Hrs conversion//
{
if (tm.Hour == 13) tim = 1
if (tm.Hour == 14) tim = 2
if (tm.Hour == 15) tim = 3
if (tm.Hour == 16) tim = 4
if (tm.Hour == 17) tim = 5
if (tm.Hour == 18) tim = 6
if (tm.Hour == 19) tim = 7
if (tm.Hour == 20) tim = 8
if (tm.Hour == 21) tim = 9
if (tm.Hour == 22) tim = 10
if (tm.Hour == 23) tim = 11
}
else
{
tim = tm.Hour
}
X = pulseIn(input, HIGH)
Y = pulseIn(input, LOW)
Time = X + Y
frequency = 1000000 / Time
waterFlow = frequency / 7.5
LS = waterFlow / 60
if (frequency >= 0)
{
if (isinf(frequency))
{
if (chk == 1)
{
Serial.println('AT+CNMI=2,2,0,0,0')
delay(1000)
Serial.println('AT+CMGF=1')
delay(500)
Serial.println('AT+CMGS='+91xxxxxxxxxx' ') // Replace x with mobile number
delay(1000)
Serial.print('Time: ')
delay(10)
Serial.print(tim)
delay(10)
Serial.print(':')
delay(10)
Serial.print(tm.Minute)
delay(10)
if (tm.Hour >= 12)
{
Serial.println(' PM')
}
if (tm.Hour <12)
{
Serial.println(' AM')
}
delay(10)
Serial.println('Water Supply is Ended.')// The SMS text you want to send
delay(100)
Serial.print('Average Water Flow (Litre/Min): ')
delay(100)
Serial.println(average)
delay(100)
Serial.print('Total Water Delivered: ')
delay(100)
Serial.print(total)
delay(100)
Serial.println(' Litre')
delay(100)
Serial.println((char)26) // ASCII code of CTRL+Z
delay(5000)
t = 0
total = 0
average = 0
chk = 0
check = 1
}
}
else
{
if (check == 1)
{
Serial.println('AT+CNMI=2,2,0,0,0')
delay(1000)
Serial.println('AT+CMGF=1')
delay(500)
Serial.println('AT+CMGS='+91xxxxxxxxxx' ') // Replace x with mobile number
delay(1000)
Serial.print('Time: ')
delay(10)
Serial.print(tim)
delay(10)
Serial.print(':')
delay(10)
Serial.print(tm.Minute)
delay(10)
if (tm.Hour >= 12)
{
Serial.println(' PM')
}
if (tm.Hour <12)
{
Serial.println(' AM')
}
delay(10)
Serial.println('The water is being supplied now.')// The SMS text you want to send
delay(100)
Serial.println((char)26) // ASCII code of CTRL+Z
delay(1000)
check = 0
chk = 1
}
t = t + 1
total = total + LS
average = total / t
average = average * 60
}
}
delay(1000)
}
}
//-----Program Developed by R.Girish-----//

บันทึก : คุณต้องอัปโหลดโปรแกรมการตั้งค่าเวลา RTC ไปยัง Arduino ก่อนและโปรแกรมหลักที่สอง (ด้วยการตั้งค่าฮาร์ดแวร์ที่เสร็จสมบูรณ์) หากทำตรงกันข้ามโครงการจะไม่ทำงาน

นี่คือภาพหน้าจอ SMS ของต้นแบบที่ผ่านการทดสอบ:

ภาพหน้าจอ SMS ของต้นแบบที่ทดสอบ:

·หลังจากเปิดวงจรเป็นเวลาหนึ่งนาทีคุณจะได้รับ SMS แจ้งว่าระบบพร้อมแล้ว

·เมื่อน้ำเริ่มไหลผ่านเซ็นเซอร์ระบบจะแจ้งเวลาให้ผู้ใช้ทราบ

·หลังจากยุติการจ่ายน้ำระบบจะส่งการแจ้งเตือนอีกครั้งและสรุปช่วงเวลาการไหลของน้ำโดยเฉลี่ยและปริมาณน้ำทั้งหมดที่ส่งไปยังถังของคุณ

ต้นแบบของผู้แต่ง:

ต้นแบบวงจรแจ้งเตือนน้ำประปาโดยใช้ SMS

โปรดทราบว่าเมื่อน้ำมาถึงน้ำจะต้องไหลอย่างอิสระหมายความว่าหากมีสิ่งกีดขวางหรือก๊อกน้ำที่ปิดอยู่จะไม่แจ้งให้คุณทราบ

หากคุณมีคำถามใด ๆ เกี่ยวกับโครงการนี้อย่าลังเลที่จะแสดงความคิดเห็นในส่วนความคิดเห็นคุณอาจได้รับคำตอบอย่างรวดเร็ว




คู่ของ: ศูนย์บ่มเพาะโดยใช้ Arduino พร้อมระบบควบคุมอุณหภูมิและความชื้นอัตโนมัติ ถัดไป: 3 วงจรอินเวอร์เตอร์ไร้หม้อแปลงที่ดีที่สุด