Arduino 자동 학교 / 대학 벨 시스템

문제를 제거하기 위해 도구를 사용해보십시오





이 포스트에서는 Arduino, 16 x 2 디스플레이 및 실시간 시계 모듈을 사용하여 자동 학교 종 / 대학 종 시스템을 구축 할 것입니다. 원하는 시간과 분에 하루에 최대 16 번 벨을 울리도록이 프로젝트를 프로그래밍 할 수 있습니다. 벨 링의 길이는 초 단위로 프로그래밍 할 수 있습니다.

코딩없이 더 간단한 버전을 찾고 계십니까? 그것을 얻으십시오 여기



개요

학교에서 일하는 사람이“tin tin tin”종을 울리고 학생들이 날아 다니는 색으로 학교 입구에서 뛰어 내렸던 시대는 지났습니다. 어떤 사람들은 피온이 몇 분 전에 마지막 종을 울 렸을 때 더 행복해질 수 있습니다.

이것은 15 년에서 20 년 전의 시나리오 였지만 이제는 모든 학교와 대학이 시간 제한이 있고 종소리가 자동화되었습니다.



작가의 빠른 유년기 / 십대 후드 기억 :

초등학교와 중학교 때 내가 착용 한 디지털 시계는 1 초의 정밀도로 학교 벨 시스템과 동기화되었습니다.

벨이 울린 후 모든 학생들이 놀랍게 저를 쳐다 보면“5 초 후에 벨이 울릴 것입니다”라고 외쳤습니다. 이것은 거의 매일 발생합니다. 언젠가 나와 친한 친구들이 마지막 벨 전에 10, 9, 8, 7… .. 카운트 다운을 시작합니다.

내 친구들은 모두 그것이 마법의 손목 시계라고 말했지만 학교 종이 자동화되었다는 간단한 사실을 깨닫지 못했습니다. LOL !!

아두 이노를 사용하여 그런 학교 / 대학 종을 만들 것입니다.

Arduino 연결에 표시

Arduino 연결에 대한 디스플레이는 일반적으로 여기에 사용되는 핀 9, 8, 7, 6, 5 및 4와 약간 다릅니다. 핀 번호 2와 3은 다음을 통해 하드웨어 인터럽트로 사용됩니다. 푸시 버튼 .

10K 사용 전위차계 대비를 조정하기 위해 디스플레이 .

Arduino 학교 종 LCD

Arduino를 이용한 자동 학교 / 대학 벨 시스템

벨 및 릴레이 연결에 대한 자세한 정보 :

Arduino를 사용한 학교 종 타이머 회로

업데이트 : A5 ~ SCL 및 A4 ~ SDA (A4 ~ SCK 아님)

실시간 클록 모듈

그만큼 실시간 시계 모듈은 긴 전원 차단 후에도 시간을 추적합니다. 벨을 켜고 끌 수 있도록 9V 릴레이가 제공됩니다.

릴레이에서 유해한 고전압 역기전력을 흡수하는 릴레이 (회로도에 표시되지 않음)에 역방향 바이어스로 1N4007 다이오드를 연결하십시오.

다음을 사용하여 회로에 전원 공급 9V / 500mA 벽면 어댑터 .

어떤 상황에서 수동으로 벨을 조작 할 수 있도록 3 개의 푸시 버튼이 제공됩니다. '종료'버튼을 누르면 수동으로 벨을 울린 후 벨이 중지됩니다.

'벨 비활성화 버튼'은 벨을 영원히 비활성화합니다. 벨을 다시 활성화하려면 '종료'버튼을 누르십시오.

RTC 모듈에 시간을 설정하는 방법 :

RTC 라이브러리 다운로드 :
링크 : github.com/PaulStoffregen/DS1307RTC

-------------------------------------------------- ---------------
timeLib.h 다운로드 :
github.com/PaulStoffregen/ 시간
-------------------------------------------------- ----------------

프로그램 업로드

시간을 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
}
//----------------------------------------------------//

코드를 업로드 한 후 시리얼 모니터를 열면 시간이 설정되었다는 메시지가 표시됩니다.
위의 단계가 성공적으로 완료되면 다음으로 이동하십시오.
이제 아래 코드를 Arduino에 업로드하십시오.

주요 프로그램 코드 :

//------------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------------//

위 코드를 업로드하면 디스플레이에 시간이 표시됩니다.

이것으로 프로그램 코드를 마칩니다.

이 자동 벨 시스템을 사용하는 방법 :

완료된 하드웨어 설정으로이 작업을 수행하십시오.

1. 먼저 '시간 설정'코드를 업로드하고 직렬 모니터를 엽니 다.
2. 메인 프로그램에서 여기에서 릴레이를 트리거해야하는 시간을 설정합니다.

//---- 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

• h1을 1 ~ 23 시간으로 설정하고 m1을 0 ~ 59 분으로 설정합니다.
• h1 ~ h16 및 m1 ~ m16에 대해 동일합니다.
• 예를 들어, h = 0 및 m = 0 값을 비활성화하려면 h5 = 0 및 m5 = 0, 0은 해당 특정 벨을 비활성화합니다.

3. 벨이 켜지고 꺼지는 시간 길이를 설정합니다.

// --------------- 벨 링 길이 (초) ------- //
const int Lenght = 3 // 초

기본적으로 값은 3 초로 설정됩니다. 설정된 시간이되면 계전기 3 초 동안 켜졌다가 꺼집니다. 필요한 경우 변경하십시오.

4. 수정 된 코드를 Arduino에 업로드합니다.
5. 벨을 비활성화하려면 '벨 비활성화 버튼'을 누르십시오. 다시 활성화하려면 'Exit'버튼을 누르십시오.
6. 벨을 수동으로 울리려면 '수동 벨 스위치'를 누르고 벨을 멈추려면 '종료'를 누르십시오.

이것으로 프로젝트를 마칩니다.이 프로젝트와 관련하여 질문이 있으시면 언제든지 의견란에 말씀해주십시오.




너무 이른 : 배터리없이이 모기 박쥐 만들기 다음 : RFID 기반 출석 시스템을 만드는 방법