Cov txheej txheem:

Sawv ntxov Buddy: 8 Kauj Ruam
Sawv ntxov Buddy: 8 Kauj Ruam

Video: Sawv ntxov Buddy: 8 Kauj Ruam

Video: Sawv ntxov Buddy: 8 Kauj Ruam
Video: P nyoom Y tsis yog ua si 4/24/2020 2024, Hlis ntuj nqeg
Anonim
Image
Image

Qee tus neeg muaj sijhawm teem ntau heev, uas ua rau nws yooj yim kom hnov qab ib lossis ob yam. Nrog lub tswb moos no koj tuaj yeem teeb tsa ntau lub tswb kom koj nyob raws sijhawm. Lub moos ua haujlwm 24-sijhawm thiab txhua yam koj yuav tsum ua yog program nws kom tawm ntawm lub sijhawm sib txawv ntawm hnub uas haum koj lub sijhawm. Thaum koj ua qhov no lub sijhawm uas koj tau teeb tsa yuav tshwm rau ntawm lub vijtsam LCD, yog li koj tuaj yeem tshawb xyuas kom paub tseeb tias lawv raug thiab ua haujlwm ceeb toom ntxiv.

Kauj Ruam 1: Ntsuas Lub Tswv Yim

Sketching thiab Materials
Sketching thiab Materials

Thaum peb tau sim daws qhov teeb meem peb siv txoj hauv kev fishbone los nrog lub tswv yim thiab ua rau peb lub tswb nrov.

Kauj Ruam 2: Sketching thiab Materials

Sketching thiab Materials
Sketching thiab Materials

Hauv cov theem no peb tau sim ua cov npe ntawm txhua yam uas peb xav tias peb xav tau rau cov khoom siv hluav taws xob thiab txheej sab nrauv. Tom qab ntawd peb los nrog cov duab kos ntawm yam peb xav kom lub tswb nrov zoo li cas thiab peb yuav sib sau ua ke li cas.

Kauj Ruam 3: Tsim Cov Caster Outter

Tsim Cov Caster Casing
Tsim Cov Caster Casing
Tsim Cov Caster Casing
Tsim Cov Caster Casing

Rau thawj tsab ntawv kuv tsuas xav pom yuav ua li cas cov ntiv tes sib koom ua ke, yog li kuv siv lub thawv khau thiab tsis siv qhov ntsuas tseeb.

Kauj Ruam 4: Laser Txiav Txheej Txheej

Laser Txiav Txheej Txheej
Laser Txiav Txheej Txheej

Rau tsab ntawv thib ob kuv xav kom tau txais kev ntsuas meej thiab yuav tsum tsim pdf xa mus rau lub tshuab txiav laser. Txhawm rau ua qhov no Kuv siv lub thawv tsim app lub vev xaib, https://boxdesigner.connectionlab.org. Hauv lub vev xaib ntawd kuv nkag mus rau 3-D qhov ntev ntawm lub npov, tuab ntawm peb cov khoom, ntsuas ntsuas, thiab hom ntaub ntawv twg kuv xav kom nws tsim. Cov thawv qhov ntev yog 7.5 hauv x 3 hauv x 5 hauv thiab kuv siv 1/8 hauv cov khoom siv tuab tuab acrylic. Cov ntiv tes sib koom tes ntsuas qhov ntsuas tom qab tau teeb tsa kom yog 0.46875 ntiv tes. Kuv tau xaiv cov ntawv pdf vim tias yog hom ntaub ntawv uas lub tshuab txiav laser nyeem thiab kuv xav hloov qee qhov hloov pauv hauv adobe rau cov ntawv. Kuv hloov cov kab xim rau xim liab, yog li lub tshuab txiav laser yuav paub txiav lawv tawm es tsis txhob kos duab, thiab kuv ntxiv lub thawv duab plaub nrog qhov ntev ntawm 3.92 hauv los ntawm 1.56 nyob rau hauv dab tsi uas yuav mus rau sab xub ntiag ntawm lub thawv Kuv kuj tau ntxiv daim duab plaub txiav tawm nrog qhov ntev ntawm 1in los ntawm 0.5in nyob rau sab xis ntawm qhov hauv qab kom ua qhov qhib rau qaum txuas nrog lub tswb tswb. Kawg kuv tau ntxiv peb qhov qhib rau sab saum toj rau ob lub suab nrov thiab khawm. Buzzer qhib muaj txoj kab uas hla 0.5 nyob rau hauv thiab lub pob qhib yog 0.375 nyob rau hauv.

Kauj Ruam 5: Muab Nws Ua Ke

Muab tso ua ke
Muab tso ua ke

Thaum txhua daim ntawv raug txiav tawm Kuv tau siv rab koob thiab cov kua nplaum los lo ua ke. Kuv tuav cov khoom ua ke thiab muab cov kua nplaum tso rau hauv nruab nrab ntawm qhov thais kom ua ob sab ua ke, tab sis sab saum toj tsis tau glued.

Kauj ruam 6: Code

Taw qhia:

Txoj haujlwm no tau siv tus lej c ++ ntawm Arduino IDE software. Lub micro-maub los siv yog NodeMCU nrog ESP8266. Txog qhov haujlwm no peb xav tau txoj hauv kev kom raug lub sijhawm, lub suab nrov rau lub suab, lub tswb nrov kom ua rau lub tswb nrov nrov, thiab lub vijtsam los tso saib lub sijhawm txhua lub sijhawm thiab lub tswb. Rau tag nrho cov cai xa mus rau qhov txuas no

Ntshuam tsev qiv ntawv

Thawj yam ua ntej, peb yuav tsum tau import cov tsev qiv ntawv tsim nyog.

#suav nrog "RTClib.h"

#include "Wire.h" #include #include #include #include

Pib Pib

Tom ntej no peb yuav tsum tau pib hloov pauv rau tom qab, muab tus pin teeb tsa rau lub khawm buzzer, teeb tsa RTC, thiab teeb tsa LCD zaub lub I2C chaw nyob.

LiquidCrystal_I2C lcd (0x27, 20, 4);

const int buzzer1 = 12; const int buzzer2 = 0; const int khawm = 2; RTC_DS3231 rtc; char daysOfTheWeek [7] [12] = {"Hnub Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"} int pib sijhawm; int activetime; int lub sij hawm = 0; char ahours1 [3]; char amins1 [3]; teev 1 = 0; int min1 = 0; char ahours2 [3]; char amins2 [3]; int teev 2 = 0; int min2 = 0; char ahours3 [3]; char amins3 [3]; int teev 3 = 0; int min3 = 0; int tswb = 0; koj ByteReceived; char tau txaisChar; const byte numChars = 32; char tau txais Chas [numChars];

Teeb

Tom ntej no, peb yuav tsum muaj lub luag haujlwm uas pib txhua qhov txheej txheem tsim nyog. Hauv txoj haujlwm no, peb yuav tsum pib ua LCD thiab luam tawm thawj zaug, ua haujlwm me dua uas muab rau RTC lub sijhawm tiag tiag yog tias nws tsis muaj nws, thiab pib saib xyuas ntu.

void teeb tsa () {

#ifndef ESP8266 thaum (! Serial); #endif yog (! rtc.begin ()) {Serial.println ("Tsis pom RTC"); thaum (1); } yog (rtc.lostPower ()) {Serial.println ("RTC poob lub zog, cia teem sijhawm!"); rtc.adjust (DateTime (F (_ DATE_), F (_ TIME_))))} lcd.init (); lcd.backlight (); // ua rau Baklight ON. lcd.clear (); // Clear LCD lcd.print ("00:00"); // tso tawm ntawm LCD tom qab tus lej xa tawm lcd.setCursor (10, 0); lcd.print ("00:00"); lcd.setCursor (0, 1); lcd.print ("Sijhawm"); lcd.setCursor (10, 1); lcd.print ("Tswb 1"); lcd.setCursor (0, 3); lcd.print ("Tswb 2"); lcd.setCursor (0, 2); lcd.print ("00:00"); lcd.setCursor (10, 3); lcd.print ("Tswb 3"); lcd.setCursor (10, 2); lcd.print ("00:00"); rtc.begin (); pinMode (khawm, INPUT); // Teeb tus pin rau qhov ntsiag to khawm pinMode (buzzer1, OUTPUT); // teeb tus pin rau buzzer tso zis pinMode (buzzer2, OUTPUT); // teeb tus pin rau buzzer tso tawm Serial.begin (9600); Serial.println ("Lub sijhawm nkag ntawm lub tswb hauv HHMM hom ntawv uas tsis muaj chaw nyob nruab nrab ntawm lub tswb"); pib = millis ()/1000; }

Tau Txais Cov Ntaub Ntawv

Tam sim no, peb yuav tsum muaj peev xwm tau txais lub sijhawm ceeb toom. Txhawm rau ua qhov ntawd peb tsim txoj haujlwm kom tau txais cov ntaub ntawv los ntawm daim ntawv saib xyuas thiab khaws nws hauv ib qho array.

void recvWithEndMarker () {

zoo li qub int ndx = 0; Txoj hlua sijhawm = Serial.readString (); for (ndx = 0; timein [ndx]; ndx ++) {receivedChars [ndx] = timein [ndx]; } receivedChars [ndx] = '\ 0'; Serial.print (tau txais Chas); }

Teeb Tswb

Cov kauj ruam tom ntej yog tuaj yeem teeb tsa lub tswb. Nov yog tus lej rau tswb 1. Rau tswb 2 thiab 3 tib txoj kev tau rov ua dua nrog ob peb tus lej hloov pauv.

/* Tswb 1*/

recvWithEndMarker (); tus h, m. rau (h = 0; h <2; h ++) {ahours1 [h] = receivedChars [h]; } rau (m = 2; m <4; m ++) {amins1 [m-2] = receivedChars [m]; } ahours1 [h] = '\ 0'; amins1 [m-2] = '\ 0'; Serial.print (ahours1); Serial.print (amins1); teev 1 = atoi (ahours1); min1 = atoi (amins1); Serial.print (teev 1); Serial.print (min1);

Buzzer/Khawm

Nrog qhov ua tiav, peb yuav tsum ua kom lub suab nrov nrov tawm thaum lub sijhawm tiag tiag thiab lub sijhawm ceeb toom sib npaug. Tsis tas li hauv cov kauj ruam no peb ua snooze zoo li khawm uas nres lub buzzer thaum koj tuav nws.

/ * Khawm ntsiag to */

koj silence; tus b; b = digitalRead (2); yog (b == LOW) {silence = 1; } lwm {ntsiag to = 0; } / * Pib Tswb * / yog (teev == hour1 && feeb == min1) {tswb = 1; } lwm yog (teev == hour2 && feeb == min2) {tswb = 1; } lwm yog (teev == hour3 && feeb == min3) {tswb = 1; } lwm {tswb = 0; ntsiag to = 0; } yog (tswb == 1 && ntsiag to == 0) {suab (buzzer1, 4000, 1000); suab nrov (buzzer2, 4000, 1000); ncua (1000); noTone (buzzer1); noTone (buzzer2); ncua (1000); }

Lub Sijhawm Luam Ntawv

Thaum kawg, peb yuav tsum sau lub tswb lub sijhawm thiab lub sijhawm tiag tiag rau lub vijtsam LCD.

Hnub tim tam sim no = rtc.now ();

int teev = (tam sim no.hour ()); int feeb = (tam sim no.minute ()); / * Lub sijhawm ceeb toom hauv 00:00 hom ntawv */ lcd.setCursor (10, 0); lcd.print (ahours1); lcd.setCursor (13, 0); lcd.print (amins1); lcd.setCursor (0, 2); lcd.print (ahours2); lcd.setCursor (3, 2); lcd.print (amins2); lcd.setCursor (10, 2); lcd.print (ahours3); lcd.setCursor (13, 2); lcd.print (amins3); / * Zaub Sijhawm los ntawm RTC */ lcd.setCursor (0, 0); lcd.print (teev); lcd.print (":"); lcd.print (feeb);

Kauj Ruam 7: Electronics

Electronics
Electronics
Electronics
Electronics
Electronics
Electronics

Muaj ntau daim rau cov khoom siv hluav taws xob ntawm txoj haujlwm no, raws li pom hauv daim nqi ntawm cov ntaub ntawv. Thawj daim duab yog cov phiaj xwm ntawm cov phiaj xwm hluav taws xob kawg. Daim duab thib ob yog peb qhov kev tsim hluav taws xob zaum kawg. Daim duab Peb yog ntawm peb txoj haujlwm nyob hauv nruab nrab ntawm tsab ntawv thib ob.

Txhawm rau pib txuas koj NodeMCU mus rau qhov kawg ntawm koj daim ntawv qhia zaub mov. Tom qab ntawd koj yuav tsum txuas txhua yam ntawm koj lwm cov khoom siv hluav taws xob mus rau NodeMCU thiab lub khob cij. Pib los ntawm kev txuas koj lub vijtsam LCD rau tus pin D1 rau SCL thiab D2 rau SDA. LCD yuav tso cai rau tus neeg siv pom lub sijhawm tam sim no thiab teeb tsa lub sijhawm tswb. Tam sim no muaj xaim txuas koj lub suab nrov rau tus pin D3 thiab D6. Cov buzzers yuav tso lub tswb ceeb toom rau tus neeg siv thaum lub sijhawm teem tau mus txog. Tam sim no koj yuav tsum txuas lub pob kom tso lub tswb kom nres. Txuas lub pob no rau tus pin D4. Tam sim no koj yuav txuas koj lub Sijhawm Sijhawm Tiag rau ntawm daim ntawv qhia zaub mov. Xaim Lub Sijhawm Sijhawm tiag yog li nws siv tib SDA thiab SCL pins siv rau LCD zaub.

Kauj Ruam 8: Kawg

Kawg
Kawg

Yog tias koj tau ua raws cov ntaub ntawv muab rau koj txoj haujlwm yuav zoo li cov duab saum toj no. Peb cia siab tias koj muaj hmoo hauv koj kev rov tsim dua qhov haujlwm no thiab thaum koj ua tiav koj txoj haujlwm peb txhawb kom koj qhia cov duab thiab cov lus nrog peb hauv cov lus. Ua tsaug thiab hmoov zoo cov phooj ywg Makers.

Pom zoo: