제조공정
| × | 1 | ||||
| × | 1 | ||||
| × | 1 |
| ||||
|
|
이것은 그레고리력 날짜와 매일기도 시간을 표시하는 기능을 갖춘 실시간 시계입니다. 이 간단한 회로의 경우 Arduino UNO(또는 모든 Arduino 보드), RTC DS1307 및 NOKIA 5110 LCD를 사용해야 합니다.
여기에서 부품을 구입할 수 있습니다(제휴 링크):
<울>
자료
아두이노 UNO
Arduino Uno는 ATmega328P 마이크로컨트롤러를 기반으로 하는 오픈 소스 마이크로컨트롤러 보드입니다. 이 보드에는 다양한 센서, 액추에이터, 확장 보드 및 기타 회로에 인터페이스할 수 있는 아날로그 및 디지털 GPIO(범용 입/출력) 세트가 장착되어 있습니다.
Arduino UNO의 기능:
<울>DS1307
DS1307 직렬 실시간 클록(RTC)은 저전력, 완전한 BCD(바이너리 코드 십진법) 클록/캘린더입니다.
시계/달력은 초, 분, 시, 일, 날짜, 월 및 연도 정보를 제공합니다. 윤년 수정을 포함하여 31일 미만의 달은 월말 날짜가 자동으로 조정됩니다.
DS1307은 AM/PM 표시기가 있는 24시간 또는 12시간 형식으로 작동합니다. 전원 감지 회로가 내장되어 정전을 감지하고 자동으로 배터리 공급 장치로 전환합니다.
DS1307의 핀 기능
<울>노키아 5110 LCD
Nokia 5110 LCD는 84*48 픽셀 흑백 화면으로 백라이트가 제공되며 텍스트, 그래픽 또는 이미지를 그리는 데 사용할 수 있습니다. LCD는 PCD8544 컨트롤러(Nokia 3310 LCD에 사용된 것과 동일)를 사용하며, 이 컨트롤러는 SPI와 유사한 직렬 버스 인터페이스를 통해 마이크로 컨트롤러에 인터페이스합니다.
Nokia 5110 LCD 핀 배치
<울>
프로그램을 편집하는 방법은 무엇입니까?
코드의 161번째 줄을 수정해야 합니다.
calcPrayerTimes(년, 월, dayOfMonth, 41.3, 20.6, 3, -18.5, -19, fajr, sunRise, zuhr, asr, maghrib, isha);
필요한 매개변수는 다음과 같습니다.
<울>또한 이슬람파인더 웹사이트를 방문하여 해당 도시를 검색하여 프로그램이 기도 시간을 계산하는 데 필요한 위도 및 경도와 같은 도시의 지리적 좌표를 얻을 수 있습니다.
위의 이미지에서 알 수 있듯이 카이로 시를 검색한 후 일부 정보와 함께 기도 시간이 나타났습니다. 우리에게 중요한 것은 위도, 경도, Isha 각도 및 Fajr 각도입니다. 프로그램에서 해당 숫자를 도시에 맞게 변경할 것입니다.
프로그램은 어떻게 작동합니까?
이 함수는 연도/월/일/경도/위도/TimeZone/FajrTwilight/IshaTwilight의 데이터와 이중 변수(Fajr/SunRise/Zuhr/Asr/Maghrib/Isha)에 대한 6개의 참조를 사용합니다. 이 6개의 변수는 데이터를 반환할 변수입니다. 또한 일부 숫자 변환에 도움이 되는 몇 가지 기능이 있습니다(예:라디안에서 도 또는 그 반대로).
카이로를 예로 들면:
<울>다음과 같이 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="코드">#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); 반환;}
제조공정
구성품 및 소모품 Arduino Nano R3 × 1 LED 매트릭스 × 1 포토 저항기 × 1 브레드보드(일반) × 1 DS3231 × 1 앱 및 온라인 서비스 Arduino IDE 이 프로젝트 정보 몇 미터 떨어진 방의 시계 디스플레이를 읽으려면 이러한 LED 매트릭스 디스플레이가 필요합니다. 좋은 가격에 4셀 디스플레이를 구입한 후 Hackster에서 사용 가능한 프로젝트를
구성품 및 소모품 Arduino UNO × 1 Microchip Technology ATtiny85 × 1 전해 디커플링 커패시터 - 10uF/25V × 1 점퍼 와이어 M/M × 1 이 프로젝트 정보 저는 다른 위치에서 여러 센서 데이터를 읽어야 하는 프로젝트를 진행 중입니다. 여기에는 몇 개의 PWM 핀만 필요하므로 여러 Arduino Uno를 사용하는 것은 비용이 많이 들고 불필요합니다. 그래서 Arduino Uno 개발 보드 대신 A