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.

IMG_5985__56057.1366814952.1280.1280

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 :

  1. 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.

  2. To take into account the changes made in different files, you need to restart the Raspberry
    reboot
  3. 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
  4. To test that the serial port is available, You must have python installed.
    1._ssh-2Here is the code to type :

    import serial ser = serial.Serial('/ dev/ttyAMA0',9600)
    ser.inWaiting()
  5. 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
  6. You then compile the program
    apt-get update && apt-get install-y g     cd XRF-Uploader-master g     xrf_uploader.cpp-o xrf_uploader
  7. 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.
    wget https://github.com/downloads/CisecoPlc/XRF-Firmware-downloads/llapThermistor-V0.50-24MHz.bin

    Here is what you must have in the directory where the charger xrf_uploader :
    1._ssh-2

  8. 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 :
    halt

    Then I unplug the Raspberry Pi, I plug the XRF transmitter on the map, then Slice of Pi on Pi Raspberry map :
    WP_20130708_002And finally I plug all.

  9. Send the firmware update :
    ./xrf_uploader-d/dev/ttyAMA0 f llapThermistor - V0.50 - 24 MHz .bin

    1._ssh-2Why I have a timeout at the end of the update, no idea !

  10. 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.
    Python ~/pyserial-2.5/examples/miniterm.py/dev/ttyAMA0

    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 :
    0.50B APTHERM
    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

    then

    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.

You may also like...

  • Georges-Michel Boumoussalem

    Hello,

    First of all congratulations for this tuto clear and detailed.
    I bought the components and they arrived today.

    I stuck at step 9 :
    I run the command from your tutorial and here is the answer.

    PI@GmPi ~/XRF-Uploader-master $ sudo. / xrf_uploader-d/dev/ttyAMA0 f llapThermistor - V0.50 - 24 MHz .bin
    Writing new firmware file llapThermistor - V0.50 - 24 MHz .bin to device/dev/ttyAMA0 with baud rate 9600…
    Reading firmware file…
    Read 1162 lines from firmware file
    Opening device…
    Setting serial parameters…
    Waiting for device to settle…

    Entering command mode
    Timeout, No. data received within 10 seconds

    Yet in the directory there are good files.
    PI@GmPi ~/XRF-Uploader-master $ ls-l
    total 116
    -rw - r–r– 1 PI pi 80178 August 24 2012 llapThermistor - V0.50 - 24 MHz .bin
    -rw - r–r– 1 PI pi 938 may 29 10:12 README
    -rwxr-xr-x 1 PI pi 16020 seven. 4 19:51 xrf_uploader
    -rw - r–r– 1 PI pi 12795 may 29 10:12 xrf_uploader.cpp
    PI@GmPi ~/XRF-Uploader-master $

    I got a 0 in step 4.
    Thanks in advance for any idea about the matter.
    Kind regards,
    GMB

    • Hello,
      Everything is right side connection to map slice of pi ?
      Have you tried several times ? It has not worked the first time for me

      • Georges-Michel

        Hello,
        Yes I tried several times even did a reboot on Pi.
        I'm in python 3.2 but I to the also the 2.7 This may it ask a pb ?
        Is there another way to test that the ttyAMA0 communicates with the card ?

        I am obliged to place the order :
        sudo. / xrf_uploader-d/dev/ttyAMA0 f llapThermistor - V0.50 - 24 MHz .bin
        with sudo so no I have a ban on the opening of ttyAMA0 security.
        Might it have an impact in the course of the shift ?

        Thank you
        A

        • Com with the card test is done with step 4 and priori home password ca. However it is possible that ca Python. My home I had the 2.7 only. After there may be a concern here on but the update program is c so I doubt it will be the reason.
          It is the forum of the seller or you can aoir quickly answered. Nothing forces you to do this step immediately. You can assemble the probe and test communication.
          The original site confirms that we must try several times, debracnher reconnect the module xrf
          For python idem is the 2.7 What to take

        • For sudo I don't ever because I'm still as root (Yes it is bad but it is practical)

  • Georges-Michel

    Thanks for the reply.
    I continue editing, so to follow.
    A

  • Georges-Michel Boumoussalem

    Good evening,
    I have finally found and managed the step shift 9.
    (FYI I had change the “/etc/inittab”.)

    However now I blocked on miniterm.py.
    He started well.
    I type the sequence Ctrl T and Ctrl E then ATVR appears well on the screen then nothing.
    no return.

    Would you an idea ?

    Thanks in advance.
    GMB

    • So much for me ! You must send the +++ before the command ATVR …
      +++ (ne pas taper ENTER) Attendre que OK s'affiche
      ATVR puis ENTER

      The response will be covered with OK. Home :

      ATVRK
      OK74B XRF