Projekt RFID Read-Write
Project owner: | Overdrive |
Interested: | |
Related: | [Project Dvere] |
References: | [Dioda pro lamy - ENG] – [GPIO explanations] – [BananaPi GPIO manual] |
Materials: | BananaPi, RFID-RC522, nepajive pole, kabely samec-samice s jumper konci, 5V napajeni, pajecka, pocitac s SSH |
License: | Uveďte původ-Zachovejte licenci; CC BY-SA |
on RaspberryPi 1b
https://www.raspberrypi.org/documentation/configuration/device-tree.md
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.44.tar.gz tar -xvzf bcm2835-1.44.tar.gz cd bcm2835-1.44 ./configure make sudo make check sudo make install
TO STUDY
- https://github.com/AdamLaurie/RFIDIOt - some tools
RC522 vs BananaPi Pinout
RFID-RC522 Pin | Banana Pi Pin | Banana PI Pin Name | Cable color |
3.3V | 1 | +3.3V | Red |
GND | 6 | GND | Black |
MOSI | 19 | GPIO10/MOSI | brown |
MISO | 21 | GPIO09/MSO | blue |
CLOCK | 23 | GPIO11/SCLK | yellow |
SS | 24 | COE0#/GPIO07 | green |
RC522 vs RaspberryPI B
Reference:
- SCLK : Serial Clock (output from master).
- MOSI : Master Output, Slave Input (output from master).
- MISO : Master Input, Slave Output (output from slave).
- SS : Slave Select (active low, output from master).
SPI Pins kernel module [Specific for BananaPI]
[root@picka ~]# echo "spi-sun7i" >> /etc/modules [root@picka ~]# shutdown -r now "SPI module load, test after restart" [root@picka ~]# lsmod Module Size Used by spidev 6177 0 spi_sun7i 17962 0 8192cu 453603 0 mali_drm 2608 0 drm 209014 1 mali_drm mali 111136 0 ump 51819 1 mali lcd 3778 0
Python to control GPI
- !!!!! http://blog.infraserver.eu/?p=285 –>
- On Raspberry Pi, Device Tree usage is controlled from /boot/config.txt. By
default, the Raspberry Pi kernel boots with device tree enabled. You can completely disable DT usage (for now) by adding:
XXXXXX---- nefunguje device_tree=
- mozna chcem novy git clone https://github.com/RPi-Distro/raspi-config
- a tam poresit tree
[root@picka ~]# aptitude install python-dev No packages will be installed, upgraded, or removed. 0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B of archives. After unpacking 0 B will be used. [root@picka ~]# git clone https://github.com/lthiery/SPI-Py.git Cloning into 'SPI-Py'... remote: Counting objects: 77, done. remote: Total 77 (delta 0), reused 0 (delta 0), pack-reused 77 Unpacking objects: 100% (77/77), done. Checking connectivity... done. [root@picka ~]# cd SPI-Py [root@picka SPI-Py]# python setup.py install running install running build running build_ext building 'spi' extension creating build creating build/temp.linux-armv7l-2.7 arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c spi.c -o build/temp.linux-armv7l-2.7/spi.o creating build/lib.linux-armv7l-2.7 arm-linux-gnueabihf-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-z,relro -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-armv7l-2.7/spi.o -o build/lib.linux-armv7l-2.7/spi.so running install_lib copying build/lib.linux-armv7l-2.7/spi.so -> /usr/local/lib/python2.7/dist-packages running install_egg_info Writing /usr/local/lib/python2.7/dist-packages/SPI_Py-1.0.egg-info [root@picka SPI-Py]# cd .. [root@picka ~]# git clone https://github.com/mxgxw/MFRC522-python.git Cloning into 'MFRC522-python'... remote: Counting objects: 60, done. remote: Total 60 (delta 0), reused 0 (delta 0), pack-reused 60 Unpacking objects: 100% (60/60), done. Checking connectivity... done. [root@picka ~]# cd MFRC522-python [root@picka MFRC522-python]# python Read.py BAPI: Banana Pi!! BAPI: Banana Pi!! BAPI: Banana Pi!! BAPI: Banana Pi!! BAPI: revision(3) Welcome to the MFRC522 data read example Press Ctrl-C to stop. Card read UID: 100,83,136,50 Size: 8 Sector 8 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] Card detected Card read UID: 100,83,136,50 Size: 8 Sector 8 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] Card detected Card read UID: 100,83,136,50 Size: 8 Sector 8 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] Card detected Card read UID: 100,83,136,50 Size: 8 Sector 8 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
READ NFC522 by node-red
[root@picka ~]# node -v v0.10.29 sudo npm cache clean -f sudo npm install -g n sudo n stable # version can be switched by: sudo n 0.8.21 [root@picka ~]# shutdown -r now [root@picka ~]# node -v v6.2.0 [root@picka ~]# node-red-admin install node-red-node-irc #[root@picka ~]# npm install node-pre-gyp #[root@picka ~]# npm install node-red-contrib-gpio #root@picka ~]# npm install raspi-io #[root@picka ~]# npm install node-red-node-irc [root@picka ~]# shutdown -r now