!! Note: This project is no longer being maintained !!
If you use any of the information available on these pages to build a sensor of your own, you do so AT YOUR OWN RISK.
The DarthVäder project consists of four parts:
In addition to this, there's also sections describing the communication format between the sensor board and the PC software and between the Collector board and the PC.
There are two hardware boards available for DarthVäder: One sensor board and one collector board.
The sensor board is responsible for performing all actual measurements. It then transmits the result over a wireless interface on the 2,4 GHz band to the collector.
The collector receives the measurement data from the sensor and forwards it to the PC over USB. Each collector can communicate with up to 5 sensors at the time so you can for example have one sensor placed indoors and two outdoors and the single collector can communicate with them all.
The collector is based on Arduino Nano 3.0 HW and so uses an Atmel ATMega328P microcontroller. The firmware is written in pure C though...I still haven't understood the point of writing those Arduino scetch things when it can all be done in plain C which has been in use for 30+ years. But the Arduino HW is nice!
The sensor is based around a custom HW, but in the center of it all is an ATMega88/168/328. You can use an ATMega8/8L/16/32/... with some minor code modifications as well, but the ATMega4/48 is too small so can't be used!
BOM for a sensor board (total cost around 50 USD or less):
BOM for a collector board (total cost around 15 USD or less):
There is (obviously) one firmware for the collector and one for the sensor, but I've baked it all together into a single zip file. This code is all written in pure C.
Firmware source code:
The PC software is written in C# and .NET and is hence only suitable for Windows. The PC software acts as a HW driver and communicates with the collector over USB (using a virtual COM port).
It receives all data from the collector, does some calculations on it and then transmits the results to a PHP page that enters the data into a MySQL data base.
This code will not be made available (but the binaries will) since I don't want a bunch of other people to be able to thrash my sql servers.
PC driver binaries:
The PHP homesite is what you're looking at right now. It uses the data from the MySQL database and presents it on these web pages. There's also an interface for managing the sensor stations and users.
The code for this homesite will not be made available.
The communication takes place in two steps:
The collector is a "dumb" relay that receives data from up to 6 sensors on separate RF channels. The collector logically handles this data as 6 separate data streams which it then multiplexes into a single data stream to the PC. The single data stream to the PC then contains 6 logical data streams and the PC must be able to demultiplex the data again.
In order to keep the collector dumb and without any knowledge about what type of data it is handling, it receives the data from the sensors and handles it as pure data streams. It then takes this data and inserts it into messages that are sent to the PC. These messages contains enough information about the data so that the PC can demultiplex the data into the 6 data streams again.
After all this, this is a pseudo-example of a message the the PC might see:
[collectormsg] [channel = 1] [msgdata_sensor1_part1] [/collectormsg] [collectormsg] [channel = 2] [msgdata_sensor2_part1] [/collectormsg] [collectormsg] [channel = 1] [msgdata_sensor1_part2] [/collectormsg] ...
The PC the demultiplexes this into 2 separate data streams now containing the following information:
Stream1: [msgdata_sensor1_part1] [msgdata_sensor1_part2] ... Stream2: [msgdata_sensor2_part1] ... ...
After this, the PC can now read sensor data messages from the demultiplexed streams as if the collector had not been involved at all.
Sensor --> (collector) --> PCThis is the communication format used to transfer data from the sensor board to the PC software (the collector board is just a "dumb" relay in between those two):
uint8 STX (0x02) uint8 Protocol version uint8 HW version uint8 Message sequential nr uint8 Measurement interval (in minutes) uint16 Nr of messages in queue uint16 FOST02 temperature raw value uint16 FOST02 humidity raw value uint16 HP03D C1 coefficient uint16 HP03D C2 coefficient uint16 HP03D C3 coefficient uint16 HP03D C4 coefficient uint16 HP03D C5 coefficient uint16 HP03D C6 coefficient uint16 HP03D C7 coefficient uint8 HP03D a coefficient uint8 HP03D b coefficient uint8 HP03D c coefficient uint8 HP03D d coefficient uint16 HP03D d2 (temperature) raw value uint16 HP03D d1 (air pressure) raw value uint16 TEPT5700 raw value (from ADC) uint16 Battery level raw value (from ADC) uint8 Checksum (0xFF - [value of all previous data, byte by byte]) uint8 ETX (0x03) uint8 ETX2 (0x04) uint8 ETX3 (0x05)
Collector --> PC
This is the communication format used to transfer data from the collector to the PC software:
uint8 STX (0xa0) uint8 nr_of_data_bytes uint8 channel_nr uint8[nr_of_data_bytes] data (Actual message data as received from a sensor) uint8 ETX (0xa0) uint8 ETX2 (0xa1) uint8 ETX3 (0xa2)