In a previous article we looked at the Arduino. Now we will look at an (almost) Arduino compatible clone, the JeeNode.
It is a bit smaller and cheaper than the original version and operates at 3.3V instead of 5V. This makes it easy to connect 3.3V peripherals, such as the radio module RX868 by ELV.
Connecting this device to the JeeNode means that we can listen to signals sent out by the temperature and humidity sensor S555TH.
Many thanks go out to JeeLabs for providing the On-Off Keying (OOK) decoding used by the S555TH, and Pieter Meulenhoff for supplying me with the idea of using this sensor and initial versions of the software.
The S555TH transmits the following data within the S300 protocol:
The first byte contains the sign of the temperature value and the address of the sensor. If the first bit is ‘0’, the temperature sign is ‘+’, else it is ‘-‘. The second to fourth bit are used for the address (1-8) of the sensor. This is used for identifying the sensor, but also helps in avoiding packet collisions. Each sensor will wait for (177 minus 0.5 * address) seconds between transmissions.
The second through fourth bytes contain the temperature and humidity values. For example, the humidity value is obtained by multiplying 10 with the first nibble of the fourth byte, adding the second nibble of the fourth byte, and adding 0.1 times the first nibble of the third byte.
In code this looks like:
uint8_t address = 1 + ((buf >> 4) & 0x07); int16_t temperature = (buf >> 7 ? -1 : 1) * (100 * (buf & 0x0F) + 10 * (buf >> 4) + 1 * (buf & 0x0F)); uint16_t humidity = 100 * (buf >> 4) + 10 * (buf & 0x0F) + 1 * (buf >> 4); Serial.print("S555TH: address="); Serial.print(address, DEC); Serial.print(" temperature="); Serial.print(temperature / 10.0, 1); Serial.print(" humidity="); Serial.println(humidity / 10.0, 1);
Note that we multiplied the temperature and humidity values by 10 to be able to print them nicely to the serial monitor, in which we divide by 10 again.
The complete Arduino sketch can be downloaded here.
One thought on “Measuring temperature and humidity with a JeeNode”
I would like to do something similar.
Can you say a bit more about the receiver settings.
On what frequency the sensor is working? Does it send a preamble and/or synchronization?
If not how you now of the receiving of valid data?