Arduino automātiskā skolas / koledžas zvanu sistēma

Izmēģiniet Mūsu Instrumentu Problēmu Novēršanai





Šajā amatā mēs izveidosim automātisku skolas zvana / koledžas zvanu sistēmu, izmantojot Arduino, 16 x 2 displeju un reālā laika pulksteņa moduli. Jūs varat ieprogrammēt šo projektu, lai zvana līdz pat 16 reizēm dienā pēc jūsu vēlamās stundas un minūtes. Zvana signāla garumu var ieprogrammēt sekundēs.

Vai meklējat vienkāršāku versiju bez kodēšanas? Dabūt to ŠEIT



Pārskats

Ir pagājuši laiki, kad peonija skolā zvanīja “skārda skārda alva” un skolēni ar skolas krāsām izskrēja no skolas ieejas. Daži var kļūt vēl priecīgāki, kad peonija piezvanīja pēdējo zvanu dažas minūtes agrāk.

Tas bija scenārijs pirms 15 līdz 20 gadiem, taču tagad visas skolas un koledžas ir stingri noteiktas laikā, un zvani tiek automatizēti.



Autora ātrais bērnības / pusaudžu kapucis atceras:

Manas pamatskolas un vidusskolas laikā digitālais pulkstenis, kuru es nēsāju, ar 1 sekundes precizitāti tika sinhronizēts ar skolas zvanu sistēmu.

Es saucu “zvans zvana pēc 5 sekundēm” pēc zvana atskanēšanas visi studenti ar pārsteigumu skatās uz mani, tas notiek gandrīz katru dienu. Kādu dienu es un mani tuvie draugi sākam skaitīt 10, 9, 8, 7 ... pirms pēdējā zvana.

Visi mani draugi saka, ka tas ir burvju rokas pulkstenis, taču viņi nesaprata vienu vienkāršu faktu, ka skolas zvans tika automatizēts. LOL !!

Mēs gatavosim vienu šādu skolas / koledžas zvanu, izmantojot Arduino.

Displejs ar Arduino savienojumu

Displejs ar Arduino savienojumiem nedaudz atšķiras no tā, kā mēs tos parasti vadām, šeit izmantotie tapas 9, 8, 7, 6, 5 un 4. Tapas numurs 2 un 3 tiek izmantots kā aparatūras pārtraukums, izmantojot spiedpogas .

Izmantojiet 10K potenciometrs kontrasta pielāgošanai displejs .

Arduino skolas zvana LCD

Automātiska skolas / koledžas zvanu sistēma, izmantojot Arduino

Detalizēta informācija par zvana un releja savienojumiem:

skolas zvana taimera ķēde ar Arduino

ATJAUNINĀJUMS: A5 - SCL un A4 - SDA (nevis A4 - SCK)

Reālā laika pulksteņa modulis

The Reālā laika pulkstenis modulis seko līdzi laikam pat pēc ilgstošas ​​strāvas padeves pārtraukšanas. Zvana ieslēgšanai un izslēgšanai ir paredzēts 9V relejs.

Lūdzu, pievienojiet 1N4007 diodi pretējā slīpumā pāri relejam (kas nav parādīts shēmā), kas absorbēs kaitīgo augstsprieguma EMF no releja.

Strāvas padevi ķēdei, izmantojot a 9V / 500mA sienas adapteris .

Trīs spiedpogas ir paredzētas, lai zvana manuāli darbinātu kādā situācijā. Nospiežot pogu “iziet”, zvans tiks apstādināts pēc zvana manuālas atskaņošanas.

“Zvana atspējošanas poga” zvanu uz visiem laikiem atspējos. Lai atkārtoti iespējotu zvanu, nospiediet pogu “Iziet”.

Kā iestatīt laiku RTC modulim:

Lejupielādējiet RTC bibliotēku:
Saite: github.com/PaulStoffregen/DS1307RTC

-------------------------------------------------- ---------------
Lejupielādes laiksLib.h:
github.com/PaulStoffregen/Time
-------------------------------------------------- ----------------

Augšupielādējiet programmu

Augšupielādējiet zemāk esošo programmu, kurā tiks iestatīts laiks uz 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
}
//----------------------------------------------------//

Pēc koda augšupielādes atveriet seriālo monitoru, tajā būs teikts, ka laiks ir iestatīts.
Kad iepriekšminētais solis ir veiksmīgi izpildīts, pārejiet uz nākamo.
Tagad augšupielādējiet tālāk norādīto kodu Arduino.

Galvenais programmas kods:

//------------Program developed by R.GIRISH------------//
#include
#include
#include
#include
#include
LiquidCrystal lcd(9, 8, 7, 6, 5, 4)
int i = 0
int H = 0
int M = 0
int S = 0
int setting_value
const int bell = 10
const int P = A3
const int N = A2
const int setting_address = 0
const int over_ride_off = 11
boolean bell_status = true
boolean Over_ride = true
//------------------- Set Bell Timings from hours 1 to 23 hrs -------------------//
//---- 1st bell ------//
const int h1 = 0 //hours
const int m1 = 0 //Minutes
//---- 2nd bell ------//
const int h2 = 0
const int m2 = 0
//---- 3rd bell ------//
const int h3 = 0
const int m3 = 0
//---- 4th bell ------//
const int h4 = 0
const int m4 = 0
//---- 5th bell ------//
const int h5 = 0
const int m5 = 0
//---- 6th bell ------//
const int h6 = 0
const int m6 = 0
//---- 7th bell ------//
const int h7 = 0
const int m7 = 0
//---- 8th bell ------//
const int h8 = 0
const int m8 = 0
//---- 9th bell ------//
const int h9 = 0
const int m9 = 0
//---- 10th bell ------//
const int h10 = 0
const int m10 = 0
//---- 11th bell ------//
const int h11 = 0
const int m11 = 0
//---- 12th bell ------//
const int h12 = 0
const int m12 = 0
//---- 13th bell ------//
const int h13 = 0
const int m13 = 0
//---- 14th bell ------//
const int h14 = 0
const int m14 = 0
//---- 15th bell ------//
const int h15 = 0
const int m15 = 0
//---- 16th bell ------//
const int h16 = 0
const int m16 = 0
//--------------- bell ring lenght in seconds -------//
const int Lenght = 3 //in seconds
//-------------------------- -------------------------//
void setup()
{
lcd.begin(16, 2)
pinMode(P, OUTPUT)
pinMode(N, OUTPUT)
pinMode(bell, OUTPUT)
pinMode(over_ride_off, INPUT)
digitalWrite(P, HIGH)
digitalWrite(N, LOW)
digitalWrite(over_ride_off, HIGH)
attachInterrupt(0, over_ride, RISING)
attachInterrupt(1, bell_setting, RISING)
if (EEPROM.read(setting_address) != 1)
{
bell_setting()
}
}
void loop()
{
tmElements_t tm
lcd.clear()
if (RTC.read(tm))
{
H = tm.Hour
M = tm.Minute
S = tm.Second
lcd.setCursor(0, 0)
lcd.print('TIME:')
lcd.print(tm.Hour)
lcd.print(':')
lcd.print(tm.Minute)
lcd.print(':')
lcd.print(tm.Second)
lcd.setCursor(0, 1)
lcd.print('DATE:')
lcd.print(tm.Day)
lcd.print('/')
lcd.print(tm.Month)
lcd.print('/')
lcd.print(tmYearToCalendar(tm.Year))
} else {
if (RTC.chipPresent())
{
lcd.setCursor(0, 0)
lcd.print('RTC stopped!!!')
lcd.setCursor(0, 1)
lcd.print('Run SetTime code')
} else {
lcd.clear()
lcd.setCursor(0, 0)
lcd.print('Read error!')
lcd.setCursor(0, 1)
lcd.print('Check circuitry!')
}
}
if (EEPROM.read(setting_address) == 1)
{
if (H == 0 && M == 0 && S == 0)
{
digitalWrite(bell, LOW)
}
if (H == h1 && M == m1 && S == 0)
{
for (i = 0 i {
digitalWrite(bell, HIGH)
delay(1000)
}
digitalWrite(bell, LOW)
i = 0
}
if (H == h2 && M == m2 && S == 0)
{
for (i = 0 i {
digitalWrite(bell, HIGH)
delay(1000)
}
digitalWrite(bell, LOW)
i = 0
}
if (H == h3 && M == m3 && S == 0)
{
for (i = 0 i {
digitalWrite(bell, HIGH)
delay(1000)
}
digitalWrite(bell, LOW)
i = 0
}
if (H == h4 && M == m4 && S == 0)
{
for (i = 0 i {
digitalWrite(bell, HIGH)
delay(1000)
}
digitalWrite(bell, LOW)
i = 0
}
if (H == h5 && M == m5 && S == 0)
{
for (i = 0 i {
digitalWrite(bell, HIGH)
delay(1000)
}
digitalWrite(bell, LOW)
i = 0
}
if (H == h6 && M == m6 && S == 0)
{
for (i = 0 i {
digitalWrite(bell, HIGH)
delay(1000)
}
digitalWrite(bell, LOW)
i = 0
}
if (H == h7 && M == m7 && S == 0)
{
for (i = 0 i {
digitalWrite(bell, HIGH)
delay(1000)
}
digitalWrite(bell, LOW)
i = 0
}
if (H == h8 && M == m8 && S == 0)
{
for (i = 0 i {
digitalWrite(bell, HIGH)
delay(1000)
}
digitalWrite(bell, LOW)
i = 0
}
if (H == h9 && M == m9 && S == 0)
{
for (i = 0 i {
digitalWrite(bell, HIGH)
delay(1000)
}
digitalWrite(bell, LOW)
i = 0
}
if (H == h10 && M == m10 && S == 0)
{
for (i = 0 i {
digitalWrite(bell, HIGH)
delay(1000)
}
digitalWrite(bell, LOW)
i = 0
}
if (H == h11 && M == m11 && S == 0)
{
for (i = 0 i {
digitalWrite(bell, HIGH)
delay(1000)
}
digitalWrite(bell, LOW)
i = 0
}
if (H == h12 && M == m12 && S == 0)
{
for (i = 0 i {
digitalWrite(bell, HIGH)
delay(1000)
}
digitalWrite(bell, LOW)
i = 0
}
if (H == h13 && M == m13 && S == 0)
{
for (i = 0 i {
digitalWrite(bell, HIGH)
delay(1000)
}
digitalWrite(bell, LOW)
i = 0
}
if (H == h14 && M == m14 && S == 0)
{
for (i = 0 i {
digitalWrite(bell, HIGH)
delay(1000)
}
digitalWrite(bell, LOW)
i = 0
}
if (H == h15 && M == m15 && S == 0)
{
for (i = 0 i {
digitalWrite(bell, HIGH)
delay(1000)
}
digitalWrite(bell, LOW)
i = 0
}
if (H == h16 && M == m16 && S == 0)
{
for (i = 0 i {
digitalWrite(bell, HIGH)
delay(1000)
}
digitalWrite(bell, LOW)
i = 0
}
}
delay(1000)
}
void over_ride()
{
lcd.clear()
while (Over_ride)
{
digitalWrite(bell, HIGH)
lcd.setCursor(0, 0)
lcd.print('Press Exit to')
lcd.setCursor(0, 1)
lcd.print('Stop the bell!!!')
if (digitalRead(over_ride_off) == LOW)
{
Over_ride = false
digitalWrite(bell, LOW)
}
}
Over_ride = true
}
void bell_setting()
{
setting_value = 0
EEPROM.write(setting_address, setting_value)
lcd.clear()
while (bell_status)
{
lcd.setCursor(0, 0)
lcd.print('Bell is Disabled')
lcd.setCursor(0, 1)
lcd.print('Press Exit.')
if (digitalRead(over_ride_off) == LOW)
{
bell_status = false
}
}
bell_status = true
setting_value = 1
EEPROM.write(setting_address, setting_value)
}
//------------Program developed by R.GIRISH------------//

Pēc iepriekš minētā koda augšupielādes displejā vajadzētu redzēt laiku stundās.

Ar to tiek noslēgts programmas kods.

Kā izmantot šo automātisko zvanu sistēmu:

Dariet to ar pabeigtu aparatūras iestatīšanu.

1. Vispirms augšupielādējiet “laika iestatīšanas” kodu un atveriet seriālo monitoru.
2. Galvenajā programmā iestatiet laiku, kad šeit jāiedarbina relejs.

//---- 1st bell ------//
const int h1 = 0 //hours
const int m1 = 0 //Minutes
//---- 2nd bell ------//
const int h2 = 0
const int m2 = 0
//---- 3rd bell ------//
const int h3 = 0
const int m3 = 0
//---- 4th bell ------//
const int h4 = 0
const int m4 = 0

• Iestatiet h1 stundās no 1 līdz 23 stundām un m1 minūtēs no 0 līdz 59.
• Tas pats attiecībā uz h1 līdz h16 un m1 līdz m16.
• Ja vēlaties atspējot kādu zvana atstāšanas vērtību h = 0 un m = 0, piemēram: h5 = 0 un m5 = 0, nulle atspējo šo konkrēto zvanu.

3. Šeit iestatiet zvana ieslēgšanas un izslēgšanas perioda ilgumu:

// --------------- zvana signāla garums sekundēs ------- //
const int Garums = 3 // sekundēs

Pēc noklusējuma vērtība tiek iestatīta uz 3 sekundēm. Kad ir pienācis noteiktais laiks, stafete tiks ieslēgts uz 3 sekundēm un izslēgsies. Ja nepieciešams, mainiet to.

4. Augšupielādējiet modificēto kodu vietnē Arduino.
5. Lai atspējotu zvanu, nospiediet “zvana atspējošanas poga”. Lai atkārtoti iespējotu, nospiediet pogu “Iziet”.
6. Lai zvana manuāli, nospiediet “zvana manuālo slēdzi” un, lai apturētu zvanu, nospiediet “izeja”.

Tas noslēdz projektu, ja jums ir kādi jautājumi par šo projektu, nekautrējieties izteikties komentāru sadaļā.




Pāri: Uzbūvējiet šo moskītu sikspārni bez akumulatora Nākamais: Kā izveidot RFID balstītu apmeklēšanas sistēmu