POST#7 How To Make Key Scanner In 15 Minutes? (Step By Step)

Finally our build for raspberry is ready. We are super excited to share it with you. Take your raspberry and get to work. When you are done take picture of your project and post on instagram with @theiotproject mark. 

stage 1: ON DESKTOP

  • Download balenaEtcher and the latest raspbian OS (without desktop)
  •  Flash OS on SD card using balena. 
  • After installation skip the validation process 
  • Flash completed

stage 2: raspberry configuration

  • Now plug everything up to the raspberry pi: SD card, module & sensor, ethernet, keyboard, QR scanner, hdmi, and power cable. 
  •  If you are not sure about pins for the motion sensor and module (cause you are using a different raspberry) search the internet for the “pinout” of your device model. 
  • When everything is plugged the raspberry will turn on automatically. 

stage 3: raspbian setup

  • Choose your language and keyboard layout
  • Create a user and type a password

stage 4: commands

  • sudo su
  • passwd root (the system will ask you for a password)
  • update repositories using: apt update  
  • Install dependencies using: apt install python3 python3-pip socat git mosquitto (the system may ask you for more updates. Type Y)
  • Install essential python modules: pip3 install rpi.gpio pyserial paho-mqtt
  • Copy our repository: git clone
  • Enter cloned folder using: cd key-scanner
  • Install current release using:  dpkg -i KeyScanner  (press tab to autofill and enter)
  • Enable scanner service to start on boot: systemctl enable scanner
  • Start the service: systemctl start scanner
  • Wait 20 seconds before next step in order to properly start the app
  • Scan this configuration QR code using QR scanner(the code format is CONF:{your magic code},{your teamnumber},{your serial number};
    For now, you can use this example code, but make sure to change it, if you are gonna use the lock. You can also create the config code in our mobile app Virtual-key.

stage 5: scanner config

  • Scan this QR code using QR scanner

In console:

  • Restart the scanner to apply configured data: systemctl restart scanner
  • You can check if the data got applied succesfully using: cat /etc/KeyScannerconf/magic.guid (rewrite on PC, everything to root or user name)

stage 6: qr code generator

  • Every lock is able to be opened using the MAGIC code, so make sure to make it as private as possible. You can chceck if the gate is working propperly by generatig the magic qr code.
  • Open on your PC and type: 
  • MAGIC:your_magic_guid; (rewrited data from previous step)
  • Generate QR 

stage 7: working test

  • Scan this code and wait till the module on raspberry will turn on (red diode). It’s proof that everything is working well. 

additional command

  • cat /var/log/syslog (it will show you the latest usage of lock: OPEN/LOCK)
Notify of
1 Comment
Newest Most Voted
Inline Feedbacks
View all comments
3 months ago

Magic.guid file is not generated. How is the text inside this file?