Raspberry Pi – Configure a XRF transmitter via the RS232 port
Now that the Slice Of Pi expansion card is ready (see this article), It will be possible to use it to configure the transmitters XRF who will communicate with each other to send the measured temperature.
The three transmitters that I bought will be integrated to two of them in boxes with a probe. The third will stay on Raspberry Pi to receive their data and make them available to be used by any tool that will display graphics (We'll see it later).
To put everything in place, need to update issuers with the latest firmware provided by ciseko. This is the stage of today :
- You need to disable the serial port of the Raspberry that points to the console to make it available. In the file /boot/cmdLine.txt, delete the text
Console = ttyAMA0, 115200 kgdboc = ttyAMA0, 115200
In the/etc/inittab file, remove the console connected to the serial port using comment the following line :
T0:23:respawn:/sbin/getty-L ttyAMA0 115200 VT100
At home she was already commented.
- To take into account the changes made in different files, you need to restart the Raspberry
- To manipulate the serial port, in python, there is a package to help us : pySerial.
cd/root wget http://sourceforge.net/projects/pyserial/files/pyserial/2.5/pyserial-2.5.tar.gz/download-O pyserial-2.5.tar.gz tar zxvf pyserial-2.5.tar.gz cd pyserial-2.5/python setup.py install
- To test that the serial port is available, You must have python installed.
Here is the code to type :
import serial ser = serial.Serial('/ dev/ttyAMA0',9600) ser.inWaiting()
- We start by updating the two transmitters. The 3rd XRF which will be the receiver, connected to the Raspberry therefore, may be optionally update.
All these actions can be found on this page.
Download and compile the program update :
wget https://github.com/cisecoplc/xrf-uploader/archive/master.zip unzip master.zip
- You then compile the program
apt-get update && apt-get install-y g cd XRF-Uploader-master g xrf_uploader.cpp-o xrf_uploader
- Here you have what it takes to send the firmware. Except that need us firmware ! The latest version is on this page. We take the file called llapThermistor - VX.YY - 24 MHz .bin with X.YY in version number.
- It is time to update the transmitter module ! I'm not a fan of hot plugging (Maybe it is a wrong) so I start by turning off Raspberry Pi :
- Send the firmware update :
./xrf_uploader-d/dev/ttyAMA0 f llapThermistor - V0.50 - 24 MHz .bin
- Now it comes to test that the firmware has been loaded and that it is operational. For this, need to connect to the module with the tool miniterminal in python.
You will then send the sequence Ctrl T and Ctrl E to activate the return of seizure.
Now you can send a series of command and wait for the response of the component. All commands you can send are available on this page.
The number of the firmware with the ATVR command must return :
All issuers receive a id PANID allowing them to interact with each other (a kind of SSID). By default, This value is 5AA5, and it is the same for all. So if your neighbor also uses these components you will be able to listen to it. If you want to change this value then you must send the following sequence (don't type what is between <…>) :
+++<do return, wait 1 2 s to have OK>
ATIDXXXX<Typing return. XXXX is your new ID, from 0000 to EFFF in hex>
ATAC<Typing return. Will commit your change but not the save>
ATWR<Typing return. Will save your configuration>
Return OK may overwrite the display. And you have beer “quickly” (wait 30 seconds between commands) otherwise, it must restart from the sequence +++.
To exit the terminal mini sequence Ctrl T and Ctrl ] does not work with me (Mac OS ?) and I have to kill the process.
ps - ef | grep python
kill <No. process>
The operation has been redone on the second transmitter to the Raspberry POI. Concerning the 3rd module, one who will be on the Raspberry update is not necessary because it's not going to transmit information, the default firmware just.
Attention : the 3 must have the same PANID if you want them to be on the same “network”.
Here it is, everything is ready, or almost. It remains to assemble the box which will contain our transmitter. Ca sera la prochaine étape 😉
I prepared at the same time, an article that will resume the steps, links, prices, etc. for those who wish to embark on the adventure.