Categories

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

New Home Monitoring – part 2

*********
Notice – the protocol to be used has pretty much completely changed. I am adopting the aProtocol described on the OpenKontrol web site

aProtocol is essentially a hub polling devices, it does allow for devices to announce events but in the main it is polling.
The aProtocol is still work in development, I have joined the team to help make it into a robust home monitoring and automation protocol.
*********

Now that I have decided on the hardware (JeeNode V4 for nodes and Arduino for data logger) I have started to look at the data format and protocols between the nodes/sensors and the data logger. It is clear that there are three basic types of data to be dealt with

a) Current reading (sensor to data logger ). This includes events (e.g. PIR trigger or Battery Low).

b) Totals & counts (sensor to data logger). Note: totals/counts are never cleared down (unless the node is reset), the receiver of the data needs to keep track of the last total and subtract it. This makes it easy to get total for last 15 minutes, total for day etc.

c) Requests and instructions (data logger to sensor)

Low level protocol will ensure message integrity (CRC check or similar). If the sending message requests it then the receiver will ack the message (most messages will not use this – see message descriptions).

Some means to assess transmission quality (number of missing packets) is needed. The low level transmission protocol will send an incrementing sequence number (byte) with every message. Each node will also track the last sequence number received from the data logger. The data logger will keep a table; for every node the last sequence number sent and received will be stored.

The basic mode of operation is that nodes will send out data at predetermined time intervals (say every x seconds – but may differ for some sensor types), if a message goes astray or is corrupted then this is not important and we will get the value next time. Whilst this is not completely accurate (for example for energy readings) in that some values may be lost it is good enough for monitoring purposes. We require to know if some messages have arrived successfully so these will request an ack, (and re-transmission if no ack is received) in these cases the receiver should be able to accept the same message more than once without issues as the ack may be lost.

All sensor to data logger messages will be broadcast (destination node 0) – this facilitates having more than one listener – although only the data logger will ack (if ack is requested).

All messages will be in the following format : 12 bytes, human readable ascii to facilitate debugging (32 bit values will be sent as hex). Numeric information will be zero padded to the left (e.g. 123 will be sent as 00000123).
Message Format

Byte # Name Meaning
0 msg_Type Message type – list below
1 msg_NodeID Sending node ID (A-Z)
2 msg_SnsID Sensor ID within node (A-Z) + special types
3 msg_SnsType Sensor type – list below
4 msg_Data1 Data to be sent
5 msg_Data2
6 msg_Data3
7 msg_Data4
8 msg_Data5
9 msg_Data6
10 msg_Data7
11 msg_Data8

Message Types

Type Meaning
A
B
C
D
E Echo – Request a I’m here message
F I’m here
G
H
I
J
K
L
M
N
O
P
Q
R Sensor reading
S Request reading
T Request total
U
V
X Node (re)started
Y
Z

Some sensor IDs are reserved for special use. These are: (lowercase letters)

ID Meaning
a Total of missing received sequence numbers (16 bit)
b Last sequence number received
c Last sequence number transmitted
d Battery low indicator
z All sensors (e.g. to request totals).

Sensor Types

Type Meaning
A Generic analogue reading (0-124)
B Generic digital reading (0/1)
C Counter state change (e.g.  door, window)
D Counter total (16 bit)
E Energy use (Watts) – Gas or Electricity
F Energy use total Watts (32 bit)
G
H Humidity
I
J
K
L Light Level
M
N
O
P PIR sensor triggered
Q
R
S
T Temperature (tenths of a degree C)
U
V
X Display (output) cursor position (row,col)
Y Display (output) command (blink, colour etc)
Z Display (output) data (8 bytes)

Comments are closed.