Microduino nRF24 set up network and NFC unlock computer

From Microduino Wiki
Jump to: navigation, search
Language: English  • 中文


  • Project:Microduino NFC unlock computer
  • Objective:Enter the password is very complicated in some time, so this tutorial will resolve this problem. Microduino use the NFC module and nRF24 wireless module to unlock the computer immediately via an electronic tags. If you want to control multiple computers, only need one Micreduino NRF to control multiple electronic tags.
  • Difficulty:High
  • Time-consuming:6 hours
  • Maker:Microduino Studio-YLB


This system uses Microduino nRF24 module to set up network. The master system use the Miccroduino core module (Miccroduino-Core or Microduino Core+ or Microduino 32U4), Microduino nRF24, Microduino NFC, Microduino FT232R which build a gateway. Using the Miccroduino-Core, Microduino nRF24 and AVR-USB-HID made by yourself to build a network point. Every electrionic tag has different ID, the gateway identifies different ID, then sends the command to it, otherwise waiting for electronic tag. After the network point received the command, trigger the AVR-USE-HID device to input the passward (actually simuate the keyboard to input the keyboard value), then unlock the computer immediately.

Microduino nfc—nrf.jpg

Bill of Materials

Microduino gateway

Module Number Function
Microduino-Core 1 Core
Microduino-FT232R 1 Download program
Microduino-nRF24 1 Set up network,Wireless network
Microduino-NFC 1 Read the electronic tag

Microduino network point

Module Number Function
Microduino-Core 1 Core
Microduino-FT232R 1 Downlaod program
Microduino-nRF24 1 Wireless
AVR-USB-HID device 1 Simulate keyboard

Other equipment

Electronic tag 1 Similar to the computer ID
USB cable 3 Power supply


Download UsbKeyboard library:https://github.com/suapapa/arduino_library_UsbKeyboard

Download RF24 library:https://github.com/maniacbug/RF24/

Download NFC library:https://github.com/adafruit/Adafruit_NFCShield_I2C

Download test program:https://github.com/Microduino/Microduino_Tutorials/tree/master/Microduino_Advanced_Tutorial/Microduino_nrf_NFC


  • Step 1:Make AVR-USB-HID device

The voltage of AVR-USB-HID device must be in 2.8v to 3.6V. We will introduce one method which changed the Microduino power supply to 3.3v. You can change the power selction registor 0 to 3.3v pin, then the voltage will match the requirement. If you don't want to change the Microduino, there is another method which uses an external Voltage regulator tube, detailed information, please refer to following link: http://www.microduino.cc/wiki/index.php?title=Lesson_5--Microduino_Simulates_Computer_Keyboard

    • Equipment
3.3V Voltage chip 1 Optional or use the 3.3v power
68Ω registor 2 50~100Ω registor works well
2.2kΩ registor 1 1.5k~2.2k resigtor works well
Wire 2 Jumper


Microduino nfc nrf1.jpg
Microduino nfc nrf2.jpg

Principle introduction: 1.Two 68Ω registor play a current-limiting resistance and protection function, to prevent accidental damage the computer USB port or microcontroller port. 2.The 2.2kΩ pull-up registor use to identify the bus state. If it connects to D+ and +5v, that means it is a high speed USB device, otherwise connecets to D- and +5v, will be used as slow speed USB device. In this experiment, the keyboard's speed is slow, so it will connect to D-. 3.The 3.3V voltage chip use to power the systoem which leads to the Microduino core's I/O port voltage will be 3.3v, easy to identify the USB device.

  • Step two:Set up gateway
    • Used module
Microduino nfc nrf3.jpg
    • Stack all module
Microduino nfc nrf4.jpg
    • Download the used library, and copy to the libraries folder of Arduino IDE;
    • Download the test program, and open the "Microduino_nfc_nrf_send" program, compile it and then download.
  • Step 3: Set up network point
    • Used module
Microduino nfc nrf5.jpg
    • Stack all module (If the system use the exteranl 3.3v power, then no need FT232 module again)
Microduino nfc nrf6.jpg

We set up two points, so will define two points in gateway program, uses the "x" to select the point. If the player want to add more points, only need add more cases and the value of "x" in program.

    • Change the test program
      • Open the program "microduino_nrf_nfc_receive",point 1 will use "const uint16_t this_node = 1;" then x equal to 1, point 1 will use "const uint16_t this_node = 2;", x equal to 2. This will avoid the data conflict.
      • Change the passward. Need to change the key value in key function. You can find the key value in file UsbKeyboard.h of library UsbKeyboard. It only contains a part value of keyboard, but it is enough to use. You can change to your passward, then compile the program.
    • After donwload, insert the AVR-USB-HID device to computer, if successed, you can find the HID Keyboard Device service keyboards of Device Manager. If can't find it, you need to check if there is welding error on AVR-USB-HID.
Microduino nfc nrf7.jpg
  • Step 4:Use the notepad to test firstly

Power on the gateway, and point connects to computer by the AVR-USB-HID device, and then use the NRF to identify electronic tag, check the notepad's valude if match with the passward. If yes, then you start to control.


Set up the system, the gateway read the electronic tag 1, then the point 1 will input the passward automatically to unlock the computer. The same as point 2.


  • Make AVR-USB-HID device, need to make sure the voltage of USB in 2.8-3.6V;
  • Microduino NRF24 set up network, wireless communication;
  • Microduino NFC electronic tag identify。

Pay attention issue

  • Don't confuse the D+, D- when making AVR-USB-HID device;
  • Currently Microduino NFC can identify iso14443a type electronic tag;
  • Make sure the point and computer are matche, otherwise the passward is inverse.