Cov txheej txheem:
- Kauj Ruam 1: Cov Ntaub Ntawv thiab Cov Cuab Yeej
- Kauj Ruam 2: Npaj ATTINY85
- Kauj Ruam 3: Sib dhos Circuit
- Kauj ruam 4: Xeem
- Kauj Ruam 5: Cov Kauj Ruam Tom ntej
Video: IOT123 - I2C 2CH RELAY BRICK: 5 Kauj Ruam (nrog Duab)
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:29
IOT123 BRICKS yog chav DIY modular uas tuaj yeem sib xyaw nrog lwm IOT123 BRICKS, txhawm rau ntxiv kev ua haujlwm rau ntawm qhov chaw lossis hnav tau. Lawv tau ua raws li lub xwmfab nti, ob-tog protoboards nrog sib cuam tshuam los ntawm qhov.
Ib tug xov tooj ntawm cov BRICKS no yuav tsum yog nyob ntawm ntau lub node (Master MCUs - ESP8266 lossis ATTINY84) ntawm qhov chaw. MCU tsis xav tau kev paub ua ntej txog lub hom phiaj ntsuas lossis software xav tau. Nws ntsuas rau I2C cov nodes tom qab ntawv thov cov khoom pov tseg (cov ntaub ntawv sensor) los ntawm txhua tus qhev. Cov BRICKs muab 5.0V, 3.3V thiab lwm txoj kab AUX uas tuaj yeem tsim kho tau.
Qhov I2C 2CH RELAY BRICK txuas ntxiv kev ua haujlwm ntawm I2C KY019 BRICK, thiab muaj ob qhov nyeem/sau khoom:
2CH RELAYS [0] (muaj tseeb/tsis tseeb)
2CH RELAYS [1] (muaj tseeb/tsis tseeb)
Qhov dhau los ntawm qhov uas nyob ib sab ntawm ATTINY85 tau tso tseg tsis siv, txhawm rau ua kom tus pogo tus programmer thaum DIP8 tau muab muag rau PCB. Ib qho kev tsis txaus ntseeg ntxiv, ntim BRICKS hauv lub tog raj kheej me uas txuas rau hauv D1M WIFI BLOCK hub, tso tus nqi rau MQTT server, tab tom tsim.
Kauj Ruam 1: Cov Ntaub Ntawv thiab Cov Cuab Yeej
Muaj Daim Ntawv Teev Npe Tag Nrho ntawm Cov Khoom thiab Sourcing.
- 2 Channel Relay (1)
- ATTINY85 20PU (1)
- 1 "Ob tog ob tog protoboard (1)
- Txiv neej Header 90º (3P, 3P)
- Txiv neej Header (2P, 2P)
- Jumper Shunt (1)
- Hookup hlau (~ 7)
- Cov laug thiab hlau (1)
Kauj Ruam 2: Npaj ATTINY85
NCO TSEG: Yog tias xav kom muaj Crouton kev koom ua ke, thov siv lub tsev qiv ntawv los ntawm no, thiab siv tus piv txwv teeb tsa "attiny_2ch_relay".
AttinyCore los ntawm Tus Thawj Saib Xyuas Boards xav tau. Hlawv bootloader "EEPROM khaws cia", "8mHZ Internal" (txhua qhov teeb tsa pom saum toj no).
Qhov chaws khaws cia tuaj yeem pom ntawm no.
ZIP ntawm lub tsev qiv ntawv tuaj yeem pom ntawm no.
Cov lus qhia rau "Ntshuam ZIP Library" ntawm no.
Thaum lub tsev qiv ntawv raug teeb tsa koj tuaj yeem qhib qhov piv txwv "attiny_2ch_relay".
Txhawm rau rub cov firmware rau ATTINY85, koj yuav pom cov ntsiab lus ntxiv hauv cov lus qhia no:
www.instructables.com/id/How-to-Program-A…
www.instructables.com/id/Programming-the-…
www.instructables.com/id/Programming-the-…
www.instructables.com/id/Programming-the-…
Qhov zoo tshaj los sim ntawm lub khob cij ua ntej txuas ntxiv.
Yog tias koj muaj ASSIMILATE SENSORS uas twb muaj lawm, xyuas kom tus qhev qhov chaw nyob sib txawv ntawm SENSOR/MCU Tus tswv tsev ua ke piv txwv li txhua tus ua yeeb yaj kiab Relay tuaj yeem muaj qhov chaw nyob tib yam yog tias koj tsuas muaj ib tus neeg ua yeeb yaj kiab tso rau ntawm MCU/ntawm.
Kauj Ruam 3: Sib dhos Circuit
- Nyob rau sab xub ntiag, ntxig cov khoom ATTINY85 (1), 3P 90deg txiv neej lub taub hau (2) (3), 3P txiv neej lub taub hau (4) (5) thiab muab tshuaj txhuam tso rau tom qab.
- Sab nraub qaum, taug ib txoj kab daj los ntawm YELLOW1 mus rau YELLOW2 thiab cov laug.
- Ntawm sab nraub qaum, taug ib txoj kab txiv kab ntxwv los ntawm ORANGE1 mus rau ORANGE2 thiab cov laug.
- Ntawm sab nraub qaum, xaim xaim xaim los ntawm BLUE1 rau BLUE2 thiab cov laug.
- Ntawm sab nraub qaum, taug ib txoj kab ntsuab los ntawm GREEN1 rau GREEN2 thiab cov laug.
- Ntawm sab nraub qaum, taug ib txoj kab dub los ntawm BLACK1 rau BLACK2 thiab cov laug.
- Ntawm sab nraub qaum, taug ib txoj kab dub los ntawm BLACK3 rau BLACK4 thiab cov laug.
- Nyob tom qab, taug ib txoj kab liab los ntawm RED1 mus rau RED2 thiab cov laug.
- Ntawm sab nraub qaum, taug ib txoj kab liab qab los ntawm RED3 txog RED4 thiab cov laug.
- Ntawm sab nraub qaum, taug ib txoj kab liab qab ntawm SILVER1 rau SILVER2 thiab cov laug.
- Ntxiv jumper ntawm kab 5V lossis 3V3.
Tam sim no kev xa tawm tam sim no tuaj yeem txuas ncaj qha los ntawm nws cov pins rau PCB lossis ntawm cov xov hlau, mus rau cov ntsiab lus pom hauv daim ntawv cog lus tus pin.
Kauj ruam 4: Xeem
Tus lej ntawm cov BRICKS no yuav tsum yog nyob ntawm ntau lub hauv paus (MCUs - ESP8266 lossis ATTINY84) hauv ib puag ncig. Nov yog chav ntsuas: xa I2C cov lus txib los ntawm UNO mus rau ATTINY uas qhib lossis kaw qhov kev xa tawm.
Peb tau tsim yav dhau los I2C SHIELD rau Arduino.
Yog tias koj xav tau breadboard nws xwb:
- Txuas 5.0V ntawm UNO rau VCC ntawm BRICK.
- Txuas GND ntawm UNO rau GND ntawm BRICK.
- Txuas A5 ntawm UNO rau SCL ntawm BRICK.
- Txuas A4 ntawm UNO rau SDA ntawm BRICK.
- Txuas tus 4K7 rub tawm tus tiv thaiv los ntawm SDA rau VCC.
- Txuas tus 4K7 rub tawm tus tiv thaiv los ntawm SCL rau VCC.
Khiav qhov kev xeem
- Txuas koj UNO rau koj Dev PC nrog USB.
- Xa cov cai mus rau UNO.
- Qhib Arduino Console.
- Xaiv 9600 baud (rov pib dua UNO thiab rov qhib lub console yog tias koj yuav tsum tau).
- Qhov chaw nyob ntawm tus qhev yuav luam tawm rau lub console.
-
Thaum twg, nkag mus rau hauv lub thawv xa 2 0: 1 (yog li 15 2 0: 1), thiab CH1 txuas ntxiv mus.
- Thaum twg, nkag mus rau hauv lub thawv xa 2 0: 0 (yog li 15 2 0: 0), thiab CH1 kev xa xov xa tawm.
- Thaum twg, nkag mus rau hauv lub thawv xa 2 1: 1 (yog li 15 2 1: 1), thiab CH2 xa xov xa mus.
- Thaum twg, nkag mus rau hauv lub thawv xa 2 1: 0 (yog li 15 2 0: 0), thiab CH2 kev xa xov xa tawm.
I2C BRICK adhoc cov lus txib rau qhev los ntawm UNO tus tswv
#suav nrog |
const byte _num_chars = 32; |
char _received_chars [_num_chars]; // ib qho array khaws cov ntaub ntawv tau txais |
boolean _has_new_data = tsis tseeb; |
voidsetup () { |
Serial.begin (9600); |
Serial.println (); |
Serial.println ("ASSIMILATE IOT ACTOR/SENSOR EEPROM EDITOR"); |
Serial.println ("xyuas kom meej kab tshiab xaiv hauv lub qhov rai console"); |
Serial.println (); |
Serial.println ("ADDRESS 1 CONFIRM METADATA RECEIPT N/A (FOR M2M)"); |
Serial.println ("ADDRESS 2 ACTOR COMMAND"); |
Serial.println (); |
Serial.println ("ADDRESSES ON BUS:"); |
scan_i2c_addresses (); |
Serial.println (); |
Serial.println (""); |
} |
voidscan_i2c_addresses () { |
int ntaus_count = 0; |
rau (byte chaw nyob = 8; chaw nyob <127; chaw nyob ++) |
{ |
Wire.beginTransmission (chaw nyob); |
const byte yuam kev = Wire.endTransmission (); |
yog (yuam kev == 0) |
{ |
Serial.println (chaw nyob); |
} |
} |
} |
voidloop () { |
recv_with_end_marker (); |
xa_to_i2c (); |
} |
voidrecv_with_end_marker () { |
zoo li qub byte ndx = 0; |
char end_marker = '\ n'; |
caj rc; |
thaum (Serial.available ()> 0 && _has_new_data == tsis tseeb) { |
rc = Serial.read (); |
yog (rc! = end_marker) { |
_received_chars [ndx] = rc; |
ndx ++; |
yog (ndx> = _num_chars) { |
ndx = _num_chars - 1; |
} |
} |
lwm tus { |
_received_chars [ndx] = '\ 0'; // txiav txoj hlua |
nnx = 0; |
_has_new_data = tseeb; |
} |
} |
} |
voidsend_to_i2c () { |
char param_buf [16]; |
const String received_string = Txoj hlua (_received_chars); |
yog (_has_new_data == muaj tseeb) { |
int idx1 = tau txais_string.indexOf (''); |
Txoj hlua chaw nyob = tau txais_string.substring (0, idx1); |
int address_int = chaw nyob.toInt (); |
yog (address_int <8 || address_int> 127) { |
Serial.println ("Qhov chaw nyob tsis raug nkag mus:"); |
Serial.println (chaw nyob); |
rov qab; |
} |
int idx2 = tau txais_string.indexOf ('', idx1+1); |
Txoj hlua; |
yog (idx2 == -1) { |
code = tau txais_string.substring (idx1+1); |
lwm yam { |
code = tau txais_string.substring (idx1+1, idx2+1); |
} |
int code_int = chaws.toInt (); |
yog (code_int <0 || code_int> 5) { |
Serial.println ("INVALID CODE INPUT:"); |
Serial.println (chaws); |
rov qab; |
} |
bool has_parameter = idx2> -1; |
Txoj hlua parameter; |
yog (muaj_parameter) { |
parameter = tau txais_string.substring (idx2 + 1, idx2 + 17); // 16 kab ntawv max |
yog (parameter.length () <1) { |
Serial.println ("PARTAMETER MIN. LENGTH 1"); |
_has_new_data = tsis tseeb; |
rov qab; |
} |
lwm yam { |
yog (code_int> 1) { |
Serial.println ("PARAMETER YUAV TSUM!"); |
_has_new_data = tsis tseeb; |
rov qab; |
} |
} |
Serial.println (); |
Serial.print ("keeb kwm input ="); |
Serial.println (tau txais cov hlua); |
Serial.print ("chaw nyob ="); |
Serial.println (chaw nyob); |
Serial.print ("chaws ="); |
Serial.println (chaws); |
Serial.print ("ntsuas ="); |
Serial.println (qhov ntsuas); |
// Xa VIA I2C |
Wire.beginTransmission (address_int); |
Wire.write (code_int); |
yog (muaj_parameter) { |
parameter.trim (); |
strcpy (param_buf, parameter.c_str ()); |
Hlau.write (param_buf); |
} |
Wire.endTransmission (); |
Serial.println (); |
Serial.println ("Xa VIA I2C!"); |
Serial.println (); |
Serial.println (""); |
_has_new_data = tsis tseeb; |
} |
} |
saib rawuno_i2c_command_input.ino tuav nrog ❤ los ntawm GitHub
Kauj Ruam 5: Cov Kauj Ruam Tom ntej
Kev taug qab tus neeg ua yeeb yam: 2CH RELAY uas siv cov cib no tau teeb tsa tsis siv neeg rau Crouton ntawm cov metadata twb tau teeb tsa hauv ATTINY85 ntawm no. JSON pob ntawv xa mus rau Crouton tau xa los ntawm cov khoom siv tshiab tshaj plaws rau ICOS10. Koj tuaj yeem ua pov thawj-ntawm-tswvyim ntawm qhov ESP8266 zoo tib yam, yog tias kev tsim yog ntau dhau rau tam sim no.
UNO cov duab kos siv hauv Kev Xeem muaj lub luag haujlwm rau txuag chaw qhev tshiab rau EEPROM ntawm ATTINY85, yog tias koj muaj kev sib tsoo ntawm koj lub hom phiaj I2C npav. Ob peb qhov kev xav tau ntxiv, tab sis muaj ntau txoj hauv kev los xaim hluav taws xob nqes hav nyob ntawm qhov koj xav kom ua tiav, yog li kuv yuav tso qhov ntawd rau koj:)
Pom zoo:
Kev Tsim Qauv Duab Duab/Duab Duab Duab: 4 Kauj Ruam
Kev Tsim Qauv Duab Duab/Duab Duab Duab: Nyob zoo txhua tus, Hauv qhov kev qhia no, Kuv yuav qhia koj cov txheej txheem ntawm yuav ua li cas thiaj tsim 3D qauv siv cov duab digital. Cov txheej txheem hu ua Photogrammetry, tseem hu ua Image-Based Modeling (IBM). Tshwj xeeb, hom txheej txheem no tau siv los rov ua dua
Cov Duab Duab Duab thiab Cov Duab 1: 4 Cov Kauj Ruam (nrog Duab)
Cov Duab Duab Cubes thiab Cov Duab 1: Thaum sim nrog qee cov ntoo ntoo thiab cov duab los qhia, kuv pom ob peb txoj hauv kev los ua cov voos thiab lwm yam duab los ntawm cov khoom siv yooj yim. Los ntawm kev muab cov no los ua Cov Ntawv Qhia, Kuv vam tias yuav txhawb nqa kev ua si thiab kev kawm. Kev hloov pauv ntawm qhov kev qhia no
Yuav Ua Li Cas Thiaj Li Tshem Tawm Lub Computer Nrog Cov Kauj Ruam Yooj Yim thiab Duab: 13 Kauj Ruam (nrog Duab)
Yuav Tsum Tshem Tawm Lub Khoos Phis Tawj Li Cas Nrog Cov Kauj Ruam Yooj Yim thiab Duab: Nov yog cov lus qhia txog yuav ua li cas tshem lub PC. Feem ntau ntawm cov khoom siv yooj yim yog hloov pauv thiab tshem tawm tau yooj yim. Txawm li cas los xij nws yog ib qho tseem ceeb uas koj tau koom nrog nws. Qhov no yuav pab tiv thaiv koj kom tsis txhob poob ib feem, thiab tseem ua rau kev rov ua dua tshiab
Cov Duab Duab Duab Duab, WiFi Txuas - Raspberry Pi: 4 Cov Kauj Ruam (nrog Duab)
Cov Duab Duab Duab Duab, WiFi Txuas - Raspberry Pi: Nov yog txoj hauv kev yooj yim heev thiab tus nqi qis mus rau cov duab thav duab digital - nrog qhov zoo ntawm kev ntxiv /tshem cov duab hla WiFi ntawm 'nyem thiab luag' siv (pub dawb) xa cov ntaub ntawv . Nws tuaj yeem siv tau los ntawm qhov me me £ 4.50 Pi Zero. Koj tseem tuaj yeem hloov pauv
Tsis Siv Neeg Chaw Taws Teeb ON / OFF Siv MIC Jack ntawm Koj Lub Koob Yees Duab / Tsawg Voltage Solid State Relay: 4 Kauj Ruam (nrog Duab)
Tsis Siv Neeg Chaw Taws Teeb ON / OFF Siv MIC Jack ntawm Koj Lub Koob Yees Duab / Tsawg Voltage Solid State Relay: Txheej txheem cej luam: Peb tau siv MIC jack ntawm lub koob yees duab kom pom thaum lub koob yees duab nyob. Peb tau tsim cov khoom siv hluav taws xob tsawg hauv lub xeev kom pom lub MIC nkaus thiab qhib thiab kaw lub cuab yeej nyob deb tib lub sijhawm tib yam li lub koob yees duab. Lub xeev-solid