산업 제조
산업용 사물 인터넷 | 산업자재 | 장비 유지 보수 및 수리 | 산업 프로그래밍 |
home  MfgRobots >> 산업 제조 >  >> Manufacturing Technology >> 제조공정

이슬람 기도 시간이 있는 Arduino 시계

구성품 및 소모품

Arduino UNO
× 1
Nokia 5510 디스플레이
× 1
Seed Pi RTC(DS1307)
× 1

필요한 도구 및 기계

프리미엄 남성/수 점퍼 와이어, 40 x 3"(75mm )
브레드보드, 400핀

앱 및 온라인 서비스

Arduino IDE

이 프로젝트 정보

이것은 그레고리력 날짜와 매일기도 시간을 표시하는 기능을 갖춘 실시간 시계입니다. 이 간단한 회로의 경우 Arduino UNO(또는 모든 Arduino 보드), RTC DS1307 및 NOKIA 5110 LCD를 사용해야 합니다.

여기에서 부품을 구입할 수 있습니다(제휴 링크):

<울>
  • 아두이노 UNO
  • DS1307
  • 노키아 5110 LCD
  • 자료

    아두이노 UNO

    Arduino Uno는 ATmega328P 마이크로컨트롤러를 기반으로 하는 오픈 소스 마이크로컨트롤러 보드입니다. 이 보드에는 다양한 센서, 액추에이터, 확장 보드 및 기타 회로에 인터페이스할 수 있는 아날로그 및 디지털 GPIO(범용 입/출력) 세트가 장착되어 있습니다.

    Arduino UNO의 기능:

    <울>
  • 14개의 디지털 입력/출력 핀(이 중 6개는 PWM 출력으로 사용 가능)
  • 6개의 아날로그 입력
  • 16MHz 세라믹 공진기
  • 32KB 플래시 메모리(0.5KB는 부트로더 사용)
  • 2KB SRAM
  • 1KB EEPROM
  • DC 전원 잭 및 USB 포트
  • DS1307

    DS1307 직렬 실시간 클록(RTC)은 저전력, 완전한 BCD(바이너리 코드 십진법) 클록/캘린더입니다.

    시계/달력은 초, 분, 시, 일, 날짜, 월 및 연도 정보를 제공합니다. 윤년 수정을 포함하여 31일 미만의 달은 월말 날짜가 자동으로 조정됩니다.

    DS1307은 AM/PM 표시기가 있는 24시간 또는 12시간 형식으로 작동합니다. 전원 감지 회로가 내장되어 정전을 감지하고 자동으로 배터리 공급 장치로 전환합니다.

    DS1307의 핀 기능

    <울>
  • VCC, GND: 이 핀에서 장치에 DC 전원이 제공됩니다.
  • SCL(직렬 클럭 입력): 직렬 인터페이스에서 데이터 이동을 동기화하는 데 사용됩니다.
  • SDA(직렬 데이터 입력/출력): SDA는 2선식 직렬 인터페이스용 입력/출력 핀입니다. SDA 핀은 외부 풀업 저항이 필요한 오픈 드레인입니다.
  • SQW/OUT(구형파/출력 드라이버): 활성화되면 SQWE 비트가 1로 설정되고 SQW/OUT 핀은 4개의 구형파 주파수(1Hz, 4kHz, 8kHz, 32kHz) 중 하나를 출력합니다. SQW/OUT 핀은 오픈 드레인이며 외부 풀업 저항이 필요합니다. Vcc 또는 Vbat가 적용된 상태에서 작동합니다.
  • X1, X2: 표준 32.768kHz 수정 수정을 위한 연결. 내부 발진기 회로는 12.5pF의 지정된 부하 커패시턴스를 갖는 수정으로 작동하도록 설계되었습니다.
  • 노키아 5110 LCD

    Nokia 5110 LCD는 84*48 픽셀 흑백 화면으로 백라이트가 제공되며 텍스트, 그래픽 또는 이미지를 그리는 데 사용할 수 있습니다. LCD는 PCD8544 컨트롤러(Nokia 3310 LCD에 사용된 것과 동일)를 사용하며, 이 컨트롤러는 SPI와 유사한 직렬 버스 인터페이스를 통해 마이크로 컨트롤러에 인터페이스합니다.

    Nokia 5110 LCD 핀 배치

    <울>
  • VCC, GND: 이 핀에서 장치에 DC 전원이 제공됩니다.
  • RST: 디스플레이를 재설정합니다. 액티브 로우 핀입니다. 이 핀을 Arduino 재설정에 연결하면 화면이 자동으로 재설정됩니다.
  • CE (칩 활성화): 활성 로우 핀, 동일한 SPI 버스를 공유하는 연결된 여러 장치 중 하나를 선택하는 데 도움이 됩니다.
  • D/C(데이터/명령): 데이터를 수신 중인지 표시 중인지 디스플레이에 알려줍니다. HIGH 신호는 데이터용이고 LOW 신호는 명령용입니다.
  • DIN: SPI 인터페이스용 직렬 데이터 핀이며 마이크로 컨트롤러에서 LCD로 데이터를 보냅니다.
  • CLK(시계): LCD와 마이크로컨트롤러는 SPI 통신으로 인해 작동하는 공통 클록이 필요합니다. 이 핀이 도움이 될 것입니다.
  • BL(백라이트): 디스플레이의 백라이트를 제어합니다. 전위차계를 추가하거나 PWM 지원 Arduino 핀(핀 # 3, 5, 6, 9, 10 및 11)에 연결하여 밝기를 제어할 수 있습니다.
  • 프로그램을 편집하는 방법은 무엇입니까?

    코드의 161번째 줄을 수정해야 합니다.

    calcPrayerTimes(년, 월, dayOfMonth, 41.3, 20.6, 3, -18.5, -19, fajr, sunRise, zuhr, asr, maghrib, isha); 

    필요한 매개변수는 다음과 같습니다.

    <울>
  • 원하는 장소의 경도/위도/시간대.
  • Fajr Twilight/ Esha Twilight는 국가마다 계산 방식이 다릅니다.
  • 또한 이슬람파인더 웹사이트를 방문하여 해당 도시를 검색하여 프로그램이 기도 시간을 계산하는 데 필요한 위도 및 경도와 같은 도시의 지리적 좌표를 얻을 수 있습니다.

    위의 이미지에서 알 수 있듯이 카이로 시를 검색한 후 일부 정보와 함께 기도 시간이 나타났습니다. 우리에게 중요한 것은 위도, 경도, Isha 각도 및 Fajr 각도입니다. 프로그램에서 해당 숫자를 도시에 맞게 변경할 것입니다.

    프로그램은 어떻게 작동합니까?

    이 함수는 연도/월/일/경도/위도/TimeZone/FajrTwilight/IshaTwilight의 데이터와 이중 변수(Fajr/SunRise/Zuhr/Asr/Maghrib/Isha)에 대한 6개의 참조를 사용합니다. 이 6개의 변수는 데이터를 반환할 변수입니다. 또한 일부 숫자 변환에 도움이 되는 몇 가지 기능이 있습니다(예:라디안에서 도 또는 그 반대로).

    카이로를 예로 들면:

    <울>
  • 경도:30.2
  • 위도:30
  • 시간대:+2
  • 파즈르 트와일라잇:-19.5
  • 에샤 트와일라잇:-17.5
  • 다음과 같이 161행을 수정해야 합니다.

    calcPrayerTimes(년, 월, dayOfMonth, 30.2, 30, 2, -19.5, -17.5, fajr, sunRise, zuhr, asr, maghrib, isha); 

    이러한 기도 시간은 여전히 ​​"이중"이며 시간 형식으로 변환해야 합니다. Mahmoud Adly Ezzat은 숫자를 시간과 분으로 나누는 doubleToHrMin 함수(calcPrayerTimes 함수보다 먼저 찾을 수 있음)를 만들었습니다. int 변수에 대한 이중 참조와 두 개의 참조가 필요합니다.

    유용하다고 생각되면 추천하는 것을 잊지 마세요.

    추신: 기도 시간 계산 알고리즘은 Mahmoud Adly Ezzat이 작성했습니다. 그의 블로그 게시물에서 자세한 내용을 읽을 수 있습니다.

    <섹션 클래스="섹션 컨테이너 섹션 축소 가능" id="코드">

    코드

    <울>
  • 이슬람 기도 시간이 있는 Arduino 시계
  • 이슬람 기도 시간이 있는 Arduino 시계Arduino
    - Hatem Zehir의 Nokia 5510/3310 디스플레이에서 기도하는 시간
    - 기도 시간 계산은 http://3adly.blogspot.com/2010/07/prayer-times-calculations-pure-c-code.html
    #include "Wire.h#include  #include Adafruit_PCD8544 display =Adafruit_PCD8544(7, 6, 5, 4, 3);int xegg, yegg;#define DS1307_I2C_ADDRESS 0x68 // 이것은 I2C 주소입니다. // 마지막으로 업데이트된 시간을 저장합니다byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;long interval =200;int displayx, displayy, displayradius, x2, y2, x3, y3;int zero =0;char * 일[] ={"", "일", "월", "화", "수", "목", "금", "토"}; 이중 fajr, sunRise, zuhr, asr, maghrib, isha; // 일반 십진수를 이진 코드 십진수로 변환byte decToBcd(byte val){ return ( (val / 10 * 16) + (val % 10) );}// 이진수 코딩 십진수를 일반 십진수로 변환byte bcdToDec(byte val){ return ( (val / 16 * 10) + (val % 16) );}// ds1307에서 날짜와 시간을 가져와 결과를 출력합니다. getDateDs1307(){ // 레지스터 포인터를 재설정합니다. Wire.beginTransmission(DS1307_I2C_ADDRESS); //Wire.write(0x00); Wire.write(제로); Wire.endTransmission(); Wire.requestFrom(DS1307_I2C_ADDRESS, 7); 두 번째 =bcdToDec(Wire.read() &0x7f); 분 =bcdToDec(Wire.read()); 시간 =bcdToDec(Wire.read() &0x3f); dayOfWeek =bcdToDec(Wire.read()); dayOfMonth =bcdToDec(Wire.read()); 월 =bcdToDec(Wire.read()); 연도 =bcdToDec(Wire.read());} 무효 setDateDs1307(){ Wire.beginTransmission(DS1307_I2C_ADDRESS); Wire.write(제로); Wire.write(decToBcd(초)); // 0 ~ 비트 7은 시계를 시작합니다. Wire.write(decToBcd(분)); Wire.write(decToBcd(시간)); // 오전/오후 12시간 동안 비트 6을 설정해야 함(readDateDs1307도 변경해야 함) Wire.write(decToBcd(dayOfWeek)); Wire.write(decToBcd(dayOfMonth)); Wire.write(decToBcd(월)); Wire.write(decToBcd(년)); Wire.endTransmission();} 무효 printTime(){ int 시, 분; 문자 s[12]; display.clearDisplay(); display.setCursor(0, 16); display.print(일[dayOfWeek]); display.print(":"); display.print(char(dayOfMonth / 10 + 0x30)); display.print(char(dayOfMonth % 10 + 0x30)); display.print("/"); display.print(char(월 / 10 + 0x30)); display.print(char(월 % 10 + 0x30)); display.print("/"); display.print("20"); display.print(char(연도 / 10 + 0x30)); display.print(char(연도 % 10 + 0x30)); display.setCursor(18, 26); display.print( char( 시간 / 10 + 0x30) ); display.print( char( 시간 % 10 + 0x30) ); display.print(":"); display.print( char(분 / 10 + 0x30)); display.print( char(분 % 10 + 0x30)); display.print(":"); display.print(char(초 / 10 + 0x30)); display.print(char(두 번째 % 10 + 0x30)); 디스플레이.디스플레이(); 지연(1000); doubleToHrMin(fajr, 시간, 분); display.clearDisplay(); display.setCursor(1, 1); display.print("Fajr "); display.print(시간); display.print(":"); display.print(분); 디스플레이.디스플레이(); doubleToHrMin(zuhr, 시간, 분); display.setCursor(1, 10); display.print("주르"); display.print(시간); display.print(":"); display.print(분); 디스플레이.디스플레이(); doubleToHrMin(asr, 시, 분); display.setCursor(1, 20); display.print("Asr "); display.print(시간); display.print(":"); display.print(분); 디스플레이.디스플레이(); doubleToHrMin(마그리브, 시, 분); display.setCursor(1, 30); display.print("마그립"); display.print(시간); display.print(":"); display.print(분); 디스플레이.디스플레이(); doubleToHrMin(isha, 시간, 분); display.setCursor(1, 40); display.print("이샤"); display.print(시간); display.print(":"); display.print(분); 디스플레이.디스플레이(); 지연(5000);} 무효 설정() { Wire.begin(); display.begin(); display.clearDisplay(); display.setContrast(25); xegg =(디스플레이 너비()) / 2; 예그 =(디스플레이.높이()) / 2; display.setTextColor(검정); display.setTextSize(1); display.setCursor(22, 18); display.print("혐오"); 디스플레이.디스플레이(); 지연(500); display.setCursor(24, 28); display.print("제히르"); 디스플레이.디스플레이(); 지연(500); getDateDs1307();} 무효 루프() { getDateDs1307(); calcPrayerTimes(년, 월, dayOfMonth, 39.8, 21.4, 3, -18.5, -19, fajr, sunRise, zuhr, asr, maghrib, isha); // 년, 월, 일, 경도, 위도, 시간대, Fajr 황혼, Esha 황혼 unsigned long currentMillis =millis(); if (currentMillis - previousMillis> 간격) { previousMillis =currentMillis; //getDateDs1307(); 인쇄시간(); }}/*---------------------------------------------- ---------------------------------------*/// 기도 시간(Mahmoud Adly Ezzat 작성) , Cairo)//도를 Radian으로 변환double degToRad(double degree){ return ((3.1415926 / 180) * degree);}//라디안을 각도로 변환double radToDeg(double radian){ return (radian * (180 / 3.1415926)); }//값이 0과 360 사이인지 확인하십시오.double moreLess360(double value){ while (value> 360 || value <0) { if (value> 360) value -=360; 그렇지 않으면 (값 <0) 값 +=360; } 반환 값;}//값이 0과 24 사이인지 확인하십시오.double moreLess24(double value){ while (value> 24 || value <0) { if (value> 24) value -=24; 그렇지 않으면 (값 <0) 값 +=24; } 반환 값;}//더블 숫자를 시간 및 분으로 변환void doubleToHrMin(더블 숫자, int &hours, int &minutes){ hours =floor(moreLess24(number)); 분 =floor(moreLess24(숫자 - 시간) * 60);}void calcPrayerTimes(int 연도, int 월, int 일, 이중 경도, 이중 위도, int timeZone, 이중 fajrTwilight, 이중 ishaTwilight, 이중 &fajrTime, 이중 &sunRiseTime, 이중 &zuhrTime , 더블 &asrTime, 더블 &maghribTime, 더블 &ishaTime){ 더블 D =(367 * 연도) - ((년 + (int)((월 + 9) / 12)) * 7 / 4) + (((int)(275) * 월 / 9)) + 일 - 730531.5); 더블 L =280.461 + 0.9856474 * D; L =더 적게360(L); 더블 M =357.528 + (0.9856003) * D; M =더 적게360(M); 이중 람다 =L + 1.915 * sin(degToRad(M)) + 0.02 * sin(degToRad(2 * M)); 람다 =moreLess360(람다); 이중 기울기 =23.439 - 0.0000004 * D; 이중 알파 =radToDeg(atan((cos(degToRad(기울기))) * tan(degToRad(Lambda))))); 알파 =moreLess360(알파); 알파 =알파 - (360 * (int)(알파 / 360)); 알파 =알파 + 90 * (바닥(람다 / 90) - 바닥(알파 / 90)); 이중 ST =100.46 + 0.985647352 * D; 이중 Dec =radToDeg(asin(sin(degToRad(Obliquity)) * sin(degToRad(Lambda)))); 이중 Durinal_Arc =radToDeg(acos((sin(degToRad(-0.8333))) - sin(degToRad(Dec)) * sin(degToRad(위도))) / (cos(degToRad(Dec)) * cos(degToRad(위도)) ))); 더블 정오 =알파 - ST; 정오 =moreLess360(정오); 이중 UT_Noon =정오 - 경도; //////////////////////////////////////////// // 기도 시간 계산 호 &시간 ///////////////////////////////////////////// // 2) Zuhr 시간 [현지 정오] zuhrTime =UT_Noon / 15 + timeZone; // Asr Hanafi //더블 Asr_Alt =radToDeg(atan(2+tan(degToRad(latitude - Dec)))); 이중 Asr_Alt =radToDeg(atan(1.7 + tan(degToRad(위도 - 12월)))); // Asr Shafii //이중 Asr_Alt =radToDeg(atan(1 + tan(degToRad(위도 - Dec)))); 이중 Asr_Arc =radToDeg(acos((sin(degToRad(90 - Asr_Alt)) - sin(degToRad(Dec)) * sin(degToRad(위도))) / (cos(degToRad(Dec)) * cos(degToRad(위도) ))))); Asr_Arc =Asr_Arc / 15; // 3) Asr 시간 asrTime =zuhrTime + Asr_Arc; // 1) 쇼루크 시간 sunRiseTime =zuhrTime - (Durinal_Arc / 15); // 4) 마그립 시간 maghribTime =zuhrTime + (Durinal_Arc / 15); 이중 Esha_Arc =radToDeg(acos((sin(degToRad(ishaTwilight)) - sin(degToRad(Dec)) * sin(degToRad(위도))) / (cos(degToRad(Dec)) * cos(degToRad(위도))) )); // 5) 이샤 시간 ishaTime =zuhrTime + (Esha_Arc / 15); // 0) Fajr 시간 더블 Fajr_Arc =radToDeg(acos((sin(degToRad(fajrTwilight))) - sin(degToRad(Dec)) * sin(degToRad(latitude))) / (cos(degToRad(Dec)) * cos( degToRad(위도))))); fajrTime =zuhrTime - (Fajr_Arc / 15); 반환;}

    회로도


    제조공정

    1. Arduino 관점 시계
    2. Arduino로 DIY 가장 간단한 IV9 Numitron 시계
    3. 단순 워드 클럭(Arduino)
    4. 마스터 시계
    5. Arduino로 코인 억셉터 제어
    6. Arduino Temp. 3.2 디스플레이가 있는 모니터 및 실시간 시계
    7. Bluetooth가 탑재된 Arduino로 LED 제어!
    8. Arduino UNO로 LCD TFT 화면에 이미지 표시하기!
    9. DS1302 RTC가 있는 간단한 알람 시계
    10. Arduino Uno를 사용한 25kHz 4핀 PWM 팬 제어