The Raspberry Pi can be setup to do many different tasks. When using the CognIoT 125KHz RFID Reader we need to configure your SPI, I2C and Serial ports for the software to run. We have created some automated scripts in Github that ensure everything is just right.
To download the Github repository please type
git clone https://github.com/CognIot/utilities.git
then in the utilities directory that is created
sudo ./cogniot-setup.sh
If after running this you are still experiencing a problem, please could you run the other script called cogniot-debug. This will create a .tar.gz file called COGNIOT_DEBUG, could you please send us the file.
sudo ./cogniot-debug.sh
If, in the rare instances you are having problems using any of our products and need to contact support, please can you provide the output from the following commands:-
uname -a
cat /etc/rpi-issue
ls /dev/tty*
cat /boot/config.txt
gpio -v
cat /boot/cmdline.txt
dpkg –l
We have 2 versions of the RFID module, one with jumpers and one with fixed links, if you look at yours does it look like this you may need to change the GPIO port being used by the program
If it looks like the above, then we also need to modify the software slightly to read the right port. In the C program, you’ll need to edit them to comment out the line near the top of the files that determine which GPIO port to use.
In the C program (located in the RFIDReader/c/ directory), use ‘nano RFIDReader.c’ to edit the file and locate this bit of code
// set for GPIO Pin to use based on the jumper connection
// #define GPIO_PIN 1 // Jumper 1, also known as GPIO18
#define GPIO_PIN 0 // Jumper 2, also known as GPIO17
// #define GPIO_PIN 2 // Jumper 3, also known as GPIO21 (Rv 1) or GPIO27 (Rv 2)
// #define GPIO_PIN 3 // Jumper 4, also known as GPIO22
Change this to read as follows, I have made the 2 lines that changed bigger so you can see the difference with the ‘//’
// set for GPIO Pin to use based on the jumper connection
#define GPIO_PIN 1 // Jumper 1, also known as GPIO18
//#define GPIO_PIN 0 // Jumper 2, also known as GPIO17
// #define GPIO_PIN 2 // Jumper 3, also known as GPIO21 (Rv 1) or GPIO27 (Rv 2)
// #define GPIO_PIN 3 // Jumper 4, also known as GPIO22
Save the file by CTRL-X and Yes to save the changes
run
./Build
again to recompile the program and try it again by typing
sudo ./RFIDReader
The RPi 3 comes with some additional hardware and this results in some minor changes being required to our software for it to work.
Enable the serial port. type:
sudo nano /boot/config.txt
And add the following line at the end of the file
dtoverlay=pi3-miniuart-bt
change
enable_uart=0 to enable_uart=1
Save the file using CTRL-X, answering Yes to save and reboot.
Modify our software. Both the python and C versions of our software use /dev/ttyAMA0, to use them on a RPi 3, this needs to be changed to /dev/serial0.
Edit both the C and python versions and find the row that includes
/dev/ttyAMA0
replace it with
/dev/serial0
The C version will need to be recompiled before use, so you will also need to type
./Build
WiringPi: An implementation of most of the Arduino Wiring functions for the Raspberry Pi. WiringPi implements new functions for managing IO expanders.
Testing
Build with gcc version 4.6.3 (Debian 4.6.3-14+rpi1) Built against Python 2.7.2, Python 3.2.3
Get/setup repo
git clone –recursive https://github.com/WiringPi/WiringPi-Python.git
cd WiringPi-Python
Prerequisites
To rebuild the bindings you must first have python-dev, python-setuptools and swig installed.
sudo apt-get install python-dev python-setuptools swig
Build WiringPi
cd WiringPi
sudo ./build
Generate Bindings
cd ..
swig2.0 -python wiringpi.i
Build & install with
sudo python3 setup.py install