Cov txheej txheem:

IOT123 - I2C HEARTBEAT BRICK: 6 Kauj Ruam
IOT123 - I2C HEARTBEAT BRICK: 6 Kauj Ruam

Video: IOT123 - I2C HEARTBEAT BRICK: 6 Kauj Ruam

Video: IOT123 - I2C HEARTBEAT BRICK: 6 Kauj Ruam
Video: Zaful Bikini HAUL 2018 | TRY ON | Valerie pac 2024, Hlis ntuj nqeg
Anonim
IOT123 - I2C HEARTBEAT BRICK
IOT123 - I2C HEARTBEAT BRICK
IOT123 - I2C HEARTBEAT BRICK
IOT123 - I2C HEARTBEAT BRICK
IOT123 - I2C HEARTBEAT BRICK
IOT123 - I2C HEARTBEAT BRICK

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 HEARTBEAT BRICK no qhia tias tus qhev ATTINY tseem muaj txoj sia nyob, tseem yog I2C kev mus los, thiab muaj ib lub cuab yeej:

STATUS ("NYOB")

PB1 (dawb) qhia txog ATTINY kev noj qab haus huv.

PB3 (daj) toggles nrog I2C thov los ntawm tus tswv.

PB4 (txiv kab ntxwv) toggles nrog I2C tau txais los ntawm tus tswv.

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

Cov Khoom thiab Cov Cuab Yeej
Cov Khoom thiab Cov Cuab Yeej
Cov Khoom thiab Cov Cuab Yeej
Cov Khoom thiab Cov Cuab Yeej
Cov Khoom thiab Cov Cuab Yeej
Cov Khoom thiab Cov Cuab Yeej
Cov Khoom thiab Cov Cuab Yeej
Cov Khoom thiab Cov Cuab Yeej

Muaj Daim Ntawv Teev Npe Tag Nrho ntawm Cov Khoom thiab Sourcing.

  1. Ntawv PCB (7 x 7 qhov)
  2. LEDS (Liab, Ntsuab, Xiav)
  3. Resistors (3 tawm 1K)
  4. ATTINY85 20PU (1)
  5. 1 "Ob tog ob tog protoboard (1)
  6. Txiv neej Header 90º (3P, 3P)
  7. Txiv neej Header (2P, 2P)
  8. Jumper Shunt (1)
  9. Hookup hlau (~ 7)
  10. Cov laug thiab hlau (1)

Kauj Ruam 2: Npaj ATTINY85

Npaj ATTINY85
Npaj ATTINY85
Npaj ATTINY85
Npaj ATTINY85
Npaj ATTINY85
Npaj ATTINY85
Npaj ATTINY85
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_heartbeat"

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_heartbeat".

Txhawm rau rub cov firmware rau ATTINY85, koj yuav pom cov ntsiab lus ntxiv hauv cov lus qhia no:

www.instructables.com/id/Programming-the-….

www.instructables.com/id/How-to-Program-A…

www.instructables.com/id/Programming-the-…

www.instructables.com/id/How-to-Program-A…

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 chaw nyob txawv ntawm SENSOR/MCU Host ua ke. txhua tus ua yeeb yaj kiab Relay tuaj yeem muaj qhov chaw nyob ib yam tsuav koj tsuas muaj ib tus ua yeeb yam Relay ntawm MCU/ntawm qhov.

Kauj Ruam 3: Sib Sau Cov Ntsiab Lus

Sib Sau Cov Ntsiab Lus
Sib Sau Cov Ntsiab Lus
Sib Sau Cov Ntsiab Lus
Sib Sau Cov Ntsiab Lus
Sib Sau Cov Ntsiab Lus
Sib Sau Cov Ntsiab Lus

Cov ntsuas ntsuas tau txhais tau tias tuaj yeem hloov kho tau. Nws yog qhov xwm txheej tshwm sim los ntawm cov kab hluav taws xob tseem ceeb uas tau pom ua Heartbeats. Rau qhov kev tsim no peb yuav siv cov ntsuas LED; koj tsim tau tuaj yeem siv txuas (yog VCC tau tawg tawm) lossis lwm qhov pom/teeb liab raws qhov ntsuas. Qhov tseem ceeb ntawm tus tiv thaiv yuav nyob ntawm tus kheej nyiam ntawm qhov kaj uas koj xav tau.

  1. Nyob rau sab saum toj, ntxig ib lub xiav LED rau hauv RED1 (+) thiab BLACK1 (G), thiab tso rau hauv qab.
  2. Hauv qab, khoov cov hlau lead los ntawm RED1 kom nws kov cov tooj liab ntawm SILVER8 thiab txiav.
  3. Hauv qab, txiav cov hlau lead los ntawm BLACK1 saum cov laug.
  4. Nyob rau sab saum toj, ntxig ib lub LED ntsuab rau hauv RED2 (+) thiab BLACK2 (G), thiab muab tshuaj txhuam rau hauv qab.
  5. Hauv qab, khoov cov hlau lead los ntawm RED2 kom nws kov cov tooj liab ntawm SILVER9 thiab txiav.
  6. Hauv qab, txiav cov hlau lead los ntawm BLACK2 saum cov laug.
  7. Nyob rau sab saum toj, ntxig lub teeb liab liab rau hauv RED3 (+) thiab BLACK3 (G), thiab muab tshuaj txhuam rau hauv qab.
  8. Hauv qab, khoov cov hlau lead los ntawm RED3 kom nws kov cov tooj liab ntawm SILVER10 thiab txiav.
  9. Hauv qab, txiav cov hlau lead los ntawm BLACK3 saum cov laug.
  10. Nyob rau sab saum toj, ntxig rau 1K tus tiv thaiv rau hauv qhov hla SILVER1 thiab SILVER4.
  11. Hauv qab, taug qab, txiav thiab ua cov hlau lead los ntawm SILVER1 mus rau BLACK1.
  12. Nyob rau sab saum toj, ntxig rau 1K tus tiv thaiv rau hauv qhov hla SILVER2 thiab SILVER4.
  13. Hauv qab, taug qab, txiav thiab ua cov hlau lead los ntawm SILVER2 mus rau BLACK2.
  14. Nyob rau sab saum toj, ntxig rau 1K tus tiv thaiv rau hauv qhov hla SILVER3 thiab SILVER4.
  15. Hauv qab, taug qab, txiav thiab ua cov hlau lead los ntawm SILVER3 mus rau BLACK3.
  16. Hauv qab, cov xov hlau txuas ntawm SILVER4 thiab txiav ntawm kwv yees li 5 hli txuas ntxiv.
  17. Hauv qab, muab xaim dub txuas rau SILVER4.
  18. Hauv qab, muab xaim xaim dawb tso rau hauv SILVER5, kom ntseeg tau txuas ntxiv los ntawm RED1.
  19. Hauv qab, muab xaim daj tso rau hauv SILVER6, ua kom muaj kev txuas mus txuas ntxiv los ntawm RED2.
  20. Nyob rau hauv qab, muab cov kab xev liab tso rau hauv SILVER7, ua kom muaj kev txuas mus txuas ntxiv los ntawm RED3.

Kauj Ruam 4: Sib dhos Lub Hauv Paus Loj

Sib dhos Main Circuit
Sib dhos Main Circuit
Sib dhos Main Circuit
Sib dhos Main Circuit
Sib dhos Main Circuit
Sib dhos Main Circuit

Sib dhos:

  1. 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.
  2. Sab nraub qaum, taug ib txoj kab daj los ntawm YELLOW1 mus rau YELLOW2 thiab cov laug.
  3. Ntawm sab nraub qaum, taug ib txoj kab txiv kab ntxwv los ntawm ORANGE1 mus rau ORANGE2 thiab cov laug.
  4. Ntawm sab nraub qaum, xaim xaim xaim los ntawm BLUE1 rau BLUE2 thiab cov laug.
  5. Ntawm sab nraub qaum, taug ib txoj kab ntsuab los ntawm GREEN1 rau GREEN2 thiab cov laug.
  6. Ntawm sab nraub qaum, hla kab xaim dawb los ntawm WHITE1 txog WHITE2 thiab cov laug.
  7. Ntawm sab nraub qaum, taug ib txoj kab dub los ntawm BLACK1 rau BLACK2 thiab cov laug.
  8. Ntawm sab nraub qaum, taug ib txoj kab dub los ntawm BLACK3 rau BLACK4 thiab cov laug.
  9. Nyob tom qab, taug ib txoj kab liab los ntawm RED1 mus rau RED2 thiab cov laug.
  10. Ntawm sab nraub qaum, taug ib txoj kab liab qab los ntawm RED3 txog RED4 thiab cov laug.
  11. Ntawm sab nraub qaum, taug ib txoj kab liab qab ntawm SILVER1 rau SILVER2 thiab cov laug.
  12. Ntxiv jumper ntawm kab 5V lossis 3V3.

Yog tias siv Cov Ntsiab Lus saum toj no (xa mus rau daim duab pinout):

  1. Ntawm sab nraub qaum, xaim xaim dawb rau hauv PB1.
  2. Ntawm sab nraub qaum, xaim xaim daj rau hauv PB3.
  3. Ntawm sab nraub qaum, xaim kab xev txiv kab ntxwv rau hauv PB4.
  4. Ntawm sab nraub qaum, xaim dub xaim rau hauv GND.

Kauj ruam 5: Xeem

Kev Xeem
Kev Xeem
Kev Xeem
Kev Xeem
Kev Xeem
Kev Xeem
Kev Xeem
Kev 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 hloov pauv Txais Txais LED. ATTINY ALIVE LED tseem nyob.

Peb tau tsim yav dhau los I2C SHIELD rau Arduino.

Yog tias koj xav tau breadboard nws xwb:

  1. Txuas 5.0V ntawm UNO rau VCC ntawm BRICK.
  2. Txuas GND ntawm UNO rau GND ntawm BRICK.
  3. Txuas A5 ntawm UNO rau SCL ntawm BRICK.
  4. Txuas A4 ntawm UNO rau SDA ntawm BRICK.
  5. Txuas tus 4K7 rub tawm tus tiv thaiv los ntawm SDA rau VCC.
  6. Txuas tus 4K7 rub tawm tus tiv thaiv los ntawm SCL rau VCC.

Khiav qhov kev xeem

  1. Txuas koj UNO rau koj Dev PC nrog USB.
  2. Xa cov cai mus rau UNO.
  3. Qhib Arduino Console.
  4. Xaiv 9600 baud (rov pib dua UNO thiab rov qhib lub console yog tias koj yuav tsum tau).
  5. Qhov chaw nyob ntawm tus qhev yuav luam tawm rau lub console.
  6. Thaum twg, nkag rau hauv lub thawv xa 2 1 (yog li 16 2 1), thiab Txais Txais LED qhib.
  7. Thaum twg, nkag rau hauv lub thawv xa 2 0 (yog li 16 2 0), thiab Txais Txais LED tua.

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 6: Cov Kauj Ruam Tom ntej

Cov kauj ruam tom ntej
Cov kauj ruam tom ntej
Cov kauj ruam tom ntej
Cov kauj ruam tom ntej

Kev taug qab tus neeg ua yeeb yam: HEARTBEAT 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.

Pom zoo: