- the real device -
- the real device (copper side) -
The most difficult (and funny) part of the whole work was the development of the firmware for the microcontroller that, as described above, it should have analyzed the data received from the sensors in real time and, at the same time, to handle the data exchange with the PC.
This has led at the creation of an USB HID device, a particular device that doesn't require a driver installation on the PC where it will be connected, like a keyboard or a PS/2 mouse.
A Plug & Play device that make easy the development of software (stand-alone programs or plug-ins for the various Front Ends available on this forum) without the aid of special APIs.
In order to facilitate the communication between the device and PC, I have developed a simple communication protocol.
Basically the device waits for a request from the PC (1 byte) and returns the information required (4 byte).
The following table shows the protocol details:
00H (0) Abort any pairing request (see below) --> Returns: Nothing
01H (1) Sensor 1 pairing request --> Returns: Nothing
02H (2) Sensor 2 pairing request --> Returns: Nothing
03H (3) Sensor 3 pairing request --> Returns: Nothing
04H (4) Sensor 4 pairing request --> Returns: Nothing
05H (5) Sensor 5 pairing request --> Returns: Nothing
10H (16) State of a pairing request --> Returns: X,0H,0H,0H
Where X is the number of the sensor to be paired, or 0 if the pairing has been completed.
21H (33) Sensor 1 data request --> Returns: P,T,B,S
22H (34) Sensor 2 data request --> Returns: P,T,B,S
23H (35) Sensor 3 data request --> Returns: P,T,B,S
24H (36) Sensor 4 data request --> Returns: P,T,B,S
25H (37) Sensor 5 data request --> Returns: P,T,B,S
Where:
P is the pressure in kPa obtained by multiplying the unsigned binary value of this byte by 2.5 and subtracting 100 (the atmospheric pressure) from the result.
T is the temperature in °C obtained by subtracting 40 from this unsigned binary value.
B is the battery condition, the first seven bits of this byte indicate the percentage of charge.
S is the operating state of the sensor, 00H is storage mode, 01H normal mode, 02H pressure allert mode or 03H for temperature allert mode.
As example of how to use this device in your code, you can download a RoadRunner plugin and its source code
here.
It is also in development a plugin for Centrafuse (thanks Wolfgang). For more information, see
here.
- the final result-