Newbie help with temp/humidity sensor + arduino

Hi all,
This is my first imp project and could use some help. I’m using my imp to view temperature and humidity data via an arduino. I’m using this sensor (wired version)

I’ve got the hardware working and arduino code running with no problems (talking via pins 5 and 7 on the imp). My sketch outputs the RH and T values in the arduino serial monitor.

I’m not seeing the same values at the imp node in the planner. I know my code here is not correct.

On page 3 of the sensor data sheet I see there is info about the bits that are transmitted from this sensor (16RH + 16T + 8 checksum). I can’t seem to figure out how to use this info to get them to display correctly, including two decimal points. Any help would be appreciated!

Here’s my imp code:

// UART Read Example

// configure a pin pair for UART TX/RX
hardware.uart57.configure(19200, 32, 8, 1, NO_CTSRTS);

function readSerial() {
local result =;
if (result == -1) {“No data returned.”);
} else {;

imp.wakeup(1, readSerial);


imp.configure(“Serial RX”, [], []);

Couple of things:

  • your uart configure isn’t right. I suspect it should be hardware.uart57.configure(19200, 8, PARITY_NONE, 1, NO_CTSRTS);

  • You’re only reading a single byte (8 bits). I suspect your sketch is outputting a whole line.

Try this for your readserial:

`function readSerial() {
// Empty serial RX buffer first
while( != -1);

// Send prompt character to arduino

// We assume all the data comes in within this second; if it doesn’t, or if more than 80 bytes are received at this point, then data will be lost.

// Fetch all waiting bytes, put them into a string "s"
local result =;
local s = “”;
while (result != -1) {
s += result.tochar();
result =;

// use server.log because, well, it’s logged and much clearer
if (s == “”) {
server.log(“No data returned.”);
} else {