Raspberry Pi-Welt

fahrnet|de

HSN = Homesensor Network

Knowing ones environmental climate data like temperature etc. helps to, well, probably to react on waste of heating energy, identify unexpected use of such or even reveal unknown losses - or just for the fun of it. Other people might prefer to collect ash trays.

This one is my first and I'd say successful attempt to set up a wireless network of combined temperature and illumination sensors (battery powered) reporting their measurement results to a data concentrator.
The data concentrator itself provides a website to view the recordings.

Inhalt


System and Components Overview

The system - on a simplified level - looks as follows:



A raspberry pi mini computer serves as data concentrator and webserver where a
wireless short range device (SRD) functions as receiver for the wireless link to
the sensor nodes.

Measurement results and graphs can be viewed through either PC, tablet or smartphone
via a web application.

The sensor nodes are designed as a core platform which natively provides temperature
and ambient illumination values. The sensors are battery operated. The design also
allows for adding further signal treatment through a piggyback board installation.
Hence, many sensing tasks can be realised.

The following image shows one of the indoor sensors for temperature and illumination
sensing.

The Data Concentrator


The data concentrator serves the following needs:

1. receive the radio (raw) telegrams from the sensor nodes
2. put the records to a database
3. while receiving the telegrams interpret the content
4. run a webserver to provide neat access to the recordings

In order to receive the radio telegrams with a PI a receiver circuitry module
connects throught the PI's consol UART and power supply is derived from the
PI's 3.3V supply pin.
A small state machine ensures the reception of the simple radio telegram.
The radio telegram looks like this:

byte | 0 | 1-2 | 3-4 | 5:n | n+1 |
reps | L | ID | UID | payload | CRC |

where:
- L is 1byte payload length starting byte 0 up to incl. byte n+1
- ID is 2byte common identifier for the TX-node
- UID is 2byte unique identifiers for the TX-node
- CRC is the modular sum of bytes 0 to incl. n

The payload will be described in the sensor node's description.
The radio telegram is preprended with a start-of-frame character and forwarded to
the PI.

The software to receive the unidirectional communication from the receiver
circuitry is based on a multi-thredding python script.
That script detects the start-of-frame character and waits for the number of bytes
declared in the length field.
After checking if the node is belonging to the configuration the further payload is
being decoded.

That decoding as well as the identification if the node belongs to the setup is
achieved through a database. A design during development phase is shown hereafter:



To make it short: the python script converts the sensor raw data into meaningful
values, i.e. an odd ADC value is converted to a temperature and can be represented
as degree celcius. (details to follow)

At last when accessed through a PC, tablet or other computing device via browser
the data concentrator provides a web application which accesses the database and
creates some "nice" output


The Wireless Nodes


The sensor nodes/ radio transmitters circuitry is built around HOPE RF's RFM02
and the previously used ATtiny261A.
I had to realise a low power design, hence both hardware and software had to
be done for that. For software that means "sleep as much as you can" - for
hardware "use low power components, provide as much possibility to switch off
unused parts".

Download the the electronic circuit diagram article_hsn_sensor_4ch_p00.pdf.

(Further detail description to be added)

A simple wireless protocol is created based on the MQTT-S protocol definition.
The protocol setup is declared and commented within the source code.

Download the source code article_hsn_RFM_wireless_nCH_sensor.zip.

(Further detail description of the firmware to be added)

The following image shows the prototype of the indoor-standard sensor node.



Converted into a properly printed circuit board.





And a multi-stage waterlevel detection shield added piggyback.

The Wireless Receiver for the PI


The wireless receiver module which connect to the PI is built around
HOPE RF's RFM01 and an ATtiny261A.

Download the electronic circuit diagram article_hsn_base_p00.pdf.

(Further detail description to be added)

Download the source code article_hsn_RFM_wireless_small_base.zip.

The Python Application on the PI


Download the python script code threaded_UART_receiver_RFM_base_station_gen1.py.

(Further detail description to be added)

The GUI - Webbrowser based Presentation Layer


(documentation yet to come)