Cov txheej txheem:

Arduino Open Window Detector - rau Lub Caij Ntuj No: 6 Kauj Ruam
Arduino Open Window Detector - rau Lub Caij Ntuj No: 6 Kauj Ruam

Video: Arduino Open Window Detector - rau Lub Caij Ntuj No: 6 Kauj Ruam

Video: Arduino Open Window Detector - rau Lub Caij Ntuj No: 6 Kauj Ruam
Video: Amazing arduino project 2024, Hlis ntuj nqeg
Anonim
Arduino Open Window Detector - rau Lub Caij Ntuj No
Arduino Open Window Detector - rau Lub Caij Ntuj No

Nws tau txias txias sab nraum, tab sis qee zaum kuv xav tau cua huv hauv kuv chav. Yog li, kuv qhib lub qhov rais, tawm hauv chav, kaw lub qhov rooj thiab xav rov qab los hauv 5 txog 10 feeb. Thiab tom qab ob peb teev kuv nco tias lub qhov rais qhib… Tej zaum koj paub qhov no lossis muaj menyuam yaus, uas muab rau koj qhov kev paub no.

Kuv qhov kev daws teeb meem yog Qhib Qhov Ntes Ntes. Lub roj teeb yuav nyob ntev dua ib xyoos, yog li cia li tso nws rau lub caij nplooj zeeg thiab tshem tawm thaum lub caij nplooj ntoo hlav.

Kauj Ruam 1: Daim Ntawv Teev Npe

Daim Ntawv Teev Npe
Daim Ntawv Teev Npe
Daim Ntawv Teev Npe
Daim Ntawv Teev Npe
Daim Ntawv Teev Npe
Daim Ntawv Teev Npe
Daim Ntawv Teev Npe
Daim Ntawv Teev Npe
  1. Digispark board los ntawm eBay.
  2. Lub mloog pob ntseg qub.
  3. Me me khawm rau rov pib dua.
  4. Cov txuas rau tus hais lus - txwv tsis pub nws tsis tuaj yeem rov tsim dua lub rooj tsavxwm.
  5. Hlau.
  6. Txhawm rau muab lub zog hluav taws xob koj xav tau:

AAA roj teeb rooj nrog qhib/tua hloov. Koj tseem tuaj yeem siv cov roj teeb uas tau hnav, vim tias cov qauv yuav ua haujlwm qis dua 2.4V

LOS YOG

Lub roj teeb lipo qub (txawm tias 30% lub peev xwm txaus rau lub hom phiaj no) thiab yog tias koj tsis muaj, lub charger rau lipo roj teeb los ntawm eBay.

LOS YOG

Tus tuav rau CR2032 npib cell

THIAB

1A diode 1N4001 lossis sib npaug -lossis txhua yam koj muaj hauv qhov loj me no - rau kev tiv thaiv rov qab polarity

Kauj ruam 2: Programming Digispark Board

Programming Digispark Board
Programming Digispark Board
Programming Digispark Board
Programming Digispark Board

Kev teeb tsa tsav tsheb

Koj yuav tsum teeb tsa tus tsav tsheb Digispark ua ntej koj tuaj yeem teeb tsa Pawg Thawj Coj. Rub tawm nws ntawm no, qhib nws thiab khiav "InstallDrivers.exe".

Kev teeb tsa ntawm Arduino IDE

Txhim kho Digispark board rau Arduino IDE raws li tau piav qhia hauv

Kuv pom zoo kom siv raws li Digispark board URL hauv Arduino File/Preferences qhov tshiab https://raw.githubusercontent.com/ArminJo/DigistumpArduino/master/package_digistump_index.json hloov ntawm https://digistump.com/package_digistump_index.json thiab teeb tsa Digistump AVR Boards version 1.6.8.

Txij li peb xav kom txuag hluav taws xob, lub rooj tsav xwm tau hloov mus rau 1 MHz hauv peb teeb tsa () koj tuaj yeem xaiv Digispark (1mhz - Tsis Muaj USB) ua lub rooj tsavxwm hauv Cov Ntawv Qhia Cuab Yeej.

Sau thiab xa cov program mus rau pawg thawj coj

Hauv Arduino IDE tsim cov duab kos tshiab nrog Cov Ntaub Ntawv/Tshiab thiab npe nws xws li "OpenWindowAlarm". Luam cov cai los ntawm OpenWindowAlarm.ino

LOS YOG

Rub tawm thiab rho tawm lub chaw cia khoom. Qhib daim duab nrog Cov Ntaub Ntawv -> Qhib … thiab xaiv "OpenWindowAlarm" nplaub tshev.

Compile thiab upload nws. Nco ntsoov, qhov upload yuav tsis ua haujlwm yog hais lus txuas nrog. Yog tias txhua yam ua haujlwm tau zoo, teeb tsa LED ntawm Digispark yuav ntsais muag 5 zaug (rau 5 feeb tswb ncua) thiab tom qab ntawd pib ntsais muag tom qab 8 vib nas this nrog rau lub sijhawm 24 vib nas this los teeb liab txhua qhov ntsuas kub.

Kauj Ruam 3: Kev txo hwj chim

Kev txo hwj chim
Kev txo hwj chim
Kev txo hwj chim
Kev txo hwj chim

Peb pawg Digispark siv 5mA ntawm 3, 0 volt. Nrog 2 AAA roj teeb (1000mAh) nws yuav siv tau rau 8 hnub. Tab sis nws muaj peev xwm txo qis kev siv fais fab mus rau 26 µA hauv 3 Cov Kauj Ruam.

  1. Kev xiam lub zog LED los ntawm kev tawg lub tooj liab hlau uas txuas lub zog LED mus rau lub diode nrog rab riam lossis tshem tawm / xiam qhov 102 resistor txuag 1.3 mA.
  2. Tshem tawm VIN qhov ntsuas hluav taws xob txuag 1.2 mA.
  3. Kev sib txuas ntawm USB Pullup resistor (cim 152) los ntawm 5 Volt (VCC) txuag qhov seem 2.5 mA. Txuas nws los ntawm kev tawg cov tooj liab hlau ntawm ib sab ntawm tus tiv thaiv uas taw rau ATTiny. Qhov no ua rau lub USB cuam tshuam thiab tig mus ua txoj haujlwm rau Digispark board ntawm USB. Txhawm rau kom nws rov zoo dua, tab sis tseem txuag lub zog, txuas tus tiv thaiv (cim 152) ncaj qha rau USB 5 volt uas yooj yim muaj nyob rau sab nraud ntawm lub diode.

    Sab raug ntawm diode tuaj yeem pom los ntawm kev siv lub ntsuas ntsuas txuas ntxiv. Ib sab ntawm cov diode no txuas nrog tus pin 8 ntawm ATtiny (VCC). Lwm sab txuas nrog USB 5 volt.

Tam sim no USB rub tawm tus neeg tawm tsam tsuas yog ua haujlwm yog tias Digispark pawg thawj coj saib txuas nrog USB xws li thaum lub sijhawm sau ntawv thiab pawg thawj coj saib siv 26 µA thaum pw tsaug zog.

Yog tias koj rov sau dua cov fuses, koj tuaj yeem tau txais 6 µA kev siv hluav taws xob.

Txhawm rau rov tsim dua cov fuses, koj xav tau ISP (uas tuaj yeem tsim nrog Arduino) thiab txuas txuas txuas.

Kauj ruam 4: Pib dua Khawm

Pib dua khawm
Pib dua khawm
Pib dua khawm
Pib dua khawm
Pib dua khawm
Pib dua khawm
Pib dua khawm
Pib dua khawm

Yog tias koj tsis xav tshem lub zog los teeb tsa lub tswb, txuas lub khawm pib dua ntawm PB5 thiab hauv av. Kuv tau ua qhov no los ntawm kev txuas VIN tooj liab tsis txuas nrog PB5 thiab txuas lub khawm rov pib dua ncaj qha rau VIN tus pin qhov thiab qhov av loj ntawm qhov tshem tawm VIN qhov ntsuas hluav taws xob.

Yog tias koj xav tshem tawm 5 vib nas this tos USB txuas tom qab rov pib dua, koj tuaj yeem hloov pauv micronucleus kernel ntawm ATtiny85. Khiav cov ntawv "0_Burn_upgrade-t85_ pom zoo.cmd" thiab tom qab ntawv rov qhib OpenWindowAlarm daim ntawv thov dua nrog Arduino IDE.

Kauj ruam 5: Hais lus

Hais lus
Hais lus
Hais lus
Hais lus
Hais lus
Hais lus

Kuv disassembled lub mloog pob ntseg qub thiab txuas tus txiv neej txuas rau lub cable.

Kauj ruam 6: Ua haujlwm

Kev khiav hauj lwm
Kev khiav hauj lwm
Kev khiav hauj lwm
Kev khiav hauj lwm
Kev khiav hauj lwm
Kev khiav hauj lwm

Txhawm rau siv lub rooj tsavxwm tso nws rau ntawm windowsill thiab txuas nws rau lub roj teeb Yog tias qhov ntsuas kub ntawm lub sill qis dua qhov ntsuas kub qhov twg lub rooj tsavxwm tau nyob thaum xub thawj nws yuav siv sijhawm 5 feeb ntxiv rau kev txawj ntse rau tus nqi pib tshiab.

Koj yuav ceeb toom yog tias koj tso lub qhov rai qhib ntev dua tsib feeb.

Kev Ua Haujlwm Sab Hauv

  • Ib lub qhov rai qhib tau pom tom qab TEMPERATURE_COMPARE_AMOUNT * TEMPERATURE_SAMPLE_SECONDS (48) vib nas this ntawm kev ntsuas kub nrog tus nqi TEMPERATURE_DELTA_THRESHOLD_DEGREE (2) qis dua qhov kub TEMPERATURE_COMPARE_DISTANCE * TEMPERATURE_SAMPLE_12 vib nas this ua ntej (seconds) thiab 12 (seconds)
  • Qhov kev ncua tau ua tiav los ntawm kev tsaug zog 3 zaug ntawm `SLEEP_MODE_PWR_DOWN` rau lub sijhawm 8 vib nas this los txo qis kev siv zog.
  • Kev kuaj pom ntawm lub qhov rais qhib tau qhia los ntawm ntev dua 20ms ntsais thiab nyem luv txhua 24 vib nas this. Yog li, lub ntsuas ntsuas sab hauv muaj sijhawm 3 feeb los kho qhov kub sab nraud txhawm rau txhawm rau txhawm rau txhawm rau txhawm rau hloov pauv me me hauv qhov kub thiab txias. Qhov kub ntau dua qhov hloov pauv ua ntej tus nqi sensor yuav hloov pauv thiab pom lub qhov rai qhib.
  • `OPEN_WINDOW_ALARM_DELAY_MINUTES` (5) feeb tom qab qhib qhov rai pom lub tswb tau qhib.

    Lub tswb yuav tsis pib lossis lub tswb ceeb toom yuav nres yog qhov ntsuas kub tam sim no siab dua qhov ntsuas kub tsawg kawg (+ 1) piv txwv li lub qhov rais tau raug kaw lawm.

  • Thawj lub tswb kav ntev li 10 feeb. Tom qab qhov no nws tau qhib rau lub sijhawm 10 vib nas this nrog kev so ntau ntxiv los ntawm 24 vib nas this mus txog 5 feeb.
  • Txhua VCC_MONITORING_DELAY_MIN (60) feeb ntsuas lub roj teeb hluav taws xob. Nyob ntawm seb hom roj teeb pom li cas ntawm lub zog nce (saib VCC_VOLTAGE_LIPO_DETECTION (3.6 volt)), lub roj teeb hluav taws xob qis dua VCC_VOLTAGE_LOWER_LIMIT_MILLIVOLT_LIPO (3550) lossis VCC_VOLTAGE_LOWER_LIMIT_MILLIVOLT_STANDARD Millivolt tau qhia los ntawm beeping txhua 24 teev Tsuas yog lub suab nrov (tsis yog nyem) yog qhov ntev dua li lub suab nrov rau qhov qhib qhov rai pom.
  • Tom qab fais fab tuag, lub sijhawm tsis ua haujlwm yog 5 feeb. Yog tias pawg thawj coj tau txias dua thaum lub sijhawm teeb tsa, 4:15 (lossis 8:30) feeb ntxiv rau kom tsis txhob muaj lub tswb cuav tom qab fais fab tuag.

Pom zoo: