Salida para computadora inteligente hágalo usted mismo en Arduino

imagen


PrĂłlogo


Toma inteligente en Arduino, que podría ser más simple. El objetivo principal de este proyecto era desarrollar enchufes con control inalámbrico, así como "automatizar" la entrada a Windows. El componente motivador es descubrir qué son las etiquetas RFID y cómo trabajar con ellas. Como resultado, se desarrollaron dos dispositivos: un desbloqueador que lee tarjetas y, de hecho, un zócalo inteligente que recibe una señal de "encendido" del desbloqueador. Si estoy interesado en ti, por favor lee.


, RFID-, . . . ( ). , , , .





:


imagen


:


imagen


:


  • Arduino Leonardo
  • -D 12
  • Bluetooth-
  • 220, 2
  • 220

. 15 15 .


imagen


. Arduino Leonardo, Uno, , USB-HID . Uno, , Windows . Leonardo , . Leonardo Arduino Due, Micro, Zero Esplora.



, :


imagen


10 AC250V DC30V. . , , :


digitalWrite(relay_pin, HIGH);

. , .


. DuPont. 2 . !


. , 12, 0,4 — Arduino. ? , , . Vin Arduino, — Gnd. : USB- Vin.


Bluetooth-


— Bluetooth-. HC-05, , .


imagen


, , — . , . , . . bluetooth- AT-. , AT- AT-. , (FC-114) (. ). AT-. , . - . , - AT-. , FC-114. 34 , , bluetooth- , 34 , Arduino.


imagen


bluettoth- HC-05. HC-05 " ". MAC-, . AT-, . RX bluetooth- 0 Arduino ( RX), TX 1 Arduino. , , UART Arduino. Arduino , UART Arduino.


void setup()
{
}
void loop()
{
}

, , , bluetooth-, AT-. , IDE (Tools -> Serial Monitor). , Serial Monitor, (baud rate) 38400 \r\n (Both NL & CR). , , "AT". "OK". "AT+NAME?". bluetooth-. -, , , MAC- , "Slave", "Master". :


AT+ROLE?

0 — , "Slave", 1 — "Master". , :


AT+ROLE=0 -     "Slave":

MAC- Slave', Master , . :


AT+ADDR?

, : "ADDR:20:2:110001". , MAC- Slave' 20:2:110001.


imagen


Slave' . Master'. Arduino , Serial Monitor, 38400, /r/n. .


AT+ORGL
AT+RMAAD
AT+ROLE=1
AT+CMODE=1
AT+INIT
AT+INQ
AT+LINK=MAC- (: 20,2,110001)

, . ORGL , RMAAD "" Slave-. ROLE, , 1 , , Master. CMODE 1 ( 0) , Master- Slave- ( ). INIT SPP (Serial Port Profile), / . : " Bluetooth , , ". 17 . , , . INQ , Master- Slave-. — MAC- . :


+INQ:address,type,signal   20:2:110001,0,7FFF

. MAC- Slave' LINK Master- Slave'. , MAC- . bluetooth- ~2 . , . ( ) — , "".


AT-:


imagen



:


imagen


:


imagen


:


  • Arduino Uno
  • Bluetooth-
  • RFID —
  • LCD —

.


LCD —


LCD- 1620. 2 16 . Arduino I2C. I2C – , (SDA SCL). — . (master) (slave), master, . 127 . I2C , – (SDA, . Serial Dta) (SCL, . Serial Clock). LiquidCrystal_I2. . .


void lcd_display_two_lines(const char* first_line, const char* second_line)
{
  g_lcd.clear();
  g_lcd.setCursor(0, 0); //      
  g_lcd.print(first_line);
  g_lcd.setCursor(0, 1); //      
  g_lcd.print(second_line);
}

RFID —


imagen


RFID . RFID- RC-522, HF, MIFARE 13,56 . Arduino SPI. SPI – , . SPI :


  • MOSI – ;
  • MISO – ;
  • SCK – ;
  • NSS – ,

RFID- , – .


RFID- MIFARE Classic


MIFARE Classic ( MIFARE DESFIre, , ). MIFARE 1K MIFARE 4K , 16 MIFARE 1K 40 MIfare 4K. MIFARE 1K 32 MIFARE 4K (Sector Trailer). 8 MIFARE 4K 15 (16-) . / .


"" . Sector Trailer ( ) , ( ). Sector Trailer () . MIFARE Classic / .


. 16 , / ( 0 0, -). / . /, ( ). (, ..). , increment/decrement. , , .


. MIFARE Classic . ( ). Access Condition ( Sector Trailer) ( ) . , MIFARE ( ) , MIFARE, . (Sector Trailer) (access bits) C1, C2 3. MIFARE. C1 (LSB).


, RFID-. : – RFID – , – RFID – . RFID – 128 . 128 = 8 16 . 3 1, 3 2 , , 2 3. , – B, trailer . 128 - , . — , , . - , . .



imagen


, Arduino. . RFID- , , bluetooth " Windows" . , RFID- . : , . , , RFID-. — .


, , " " — , . , (.. «»), . , «» , .


imagen


"" 20 , Arduino. . — ON, — , . :


pinMode(pin_number, INPUT); //    
pinMode(pin_number, INPUT_PULLUP); //    


, , bluetooth , Windows , — RFID-. , , , , - . , ID RFID- , , . , RFID-, , Read Only .. . , , , . . , , , . .


. , , RFID- MIFARE 1K. , 6 , 6 .


"" — 5 , , // . Master- bluetooth Slave-, , bluetooth-. - . , , Arduino, USB-.


. , RFID-. RFID-, RFID-. , , , "" . , Ethernet- WiFi-, management-. , ? , , "" -. RFID- ( -, ). , ( ) "" .


CĂłdigo de firmware


https://bitbucket.org/sashadereh/arduino-smart-socket/src

Source: https://habr.com/ru/post/es395461/


All Articles