Code Request - Tempbug multiple thermistors posting to Sparkfun

Just curious if anyone has a code sample I could review of a modified Instructables “tempbug” (with thermistors) posting multiple thermistor readings to Sparkfun, vs. just the 1 in the Instructable?

I’m pretty good at wiring and hand-soldering, but the more I thinker with the code, the more I am convinced I need to stick to hardware vs. code. Just too much a newbie on code.

From what I can tell, Sparkfun would be really easy if I could send every temp sample combined in one send, but the Instructables code is not set up that way. Unless I’m wrong, which is 95% possible.

If anyone has a few minutes to help, please do PM me. I could use a little guidance. I have a bunch of 2-3 year old imps which have come back to the workshop because the IOT online sites I was using all let me down. I know my days with 001 and 002 are over, but I’d like to at least get these imps back in the field monitoring solar thermal systems on a few key sites.


Not tried this, but it’s probably as simple as changing this:

device.on("data", function(datapoint) { local resp = stream.push({"temp": datapoint.temp}); server.log(format("PUSH: %i - %s", resp.statuscode, resp.body)); });


device.on("data", function(datapoint) { local resp = stream.push({"temp0": datapoint.temp[0], "temp1": datapoint.temp[1], "temp2": datapoint.temp[2] }); server.log(format("PUSH: %i - %s", resp.statuscode, resp.body)); });

…and then on the device side, send more than one datapoint in the “data” message, like this:

local id = hardware.getdeviceid(); local datapoint = { "id" : id, "temp" : [ format("%.2f",myThermistor0.read_f()), format("%.2f",myThermistor1.read_f()), format("%.2f",myThermistor2.read_f())] } agent.send("data",datapoint);

Obviously you need 3 thermistor classes (but you want those anyway, one for each pin). You can do this more elegantly with an array of classes but this is probably a bit more understandable.