It could be you're hitting issues because D28 is the default UART pin: https://www.espruino.com/Puck.js#pinout
There's a bit of a description at https://www.espruino.com/Puck.js#serial-console but basically if the Puck is powered on and it believes that pin D28 is pulled high, it thinks there is a serial port connected and it automatically swaps serial over to that (I think putting D28 in input-pullup mode).
So it could almost be intermittent depending in the temperature when the Puck boots (although since the other side of the thermistor is connected to an IO it's unlikely, and once booted that shouldn't change).
It is possible it's static discharge, but it does seem unlikely. For instance I have a Pixl (basically the same hardware as Puck.js) with 3 huge wires attached to the IOs with a DS18B20 sensor on the end and that's been running for years without issues.
Is the Puck itself running off a CR2032 and 100% disconnected from everything else? So it's literally just a Puck with 3 wires attached?
If for instance you had grounded the Puck then I could imagine RF interference might be an issue since you're basically attaching a big aerial to it. In some environments that could be forcing several volts into the IO pins. But the Puck is disconnected, since the 3 wires are all going to the same place it's hard to imagine there would be a different enough voltage between them if there is no other connection to it.
I notice those temp sensors have a metal washer on them for bolting to stuff - what are they bolted to? Could that have a high voltage on it?
Also, what happens on one of the 'dead' Pucks if you unsolder everything and run Puck.selfTest() on it?
The code you've posted there looks great, but some things that might help:
When you're finished reading from the thermistor, make the analog input pin an output - which would make it far less likely there are voltage spikes on it:
analogRead (D30); // <--- put D30 into analog in mode
var val = 0;
val += analogRead (D30);
val /= 5;
var ohms = 10000*val/(1-val); //or 10.88k measured on resistor before soldering to original puck (not puck lite)
digitalWrite(D30,0); // <--- force D30 to 0
Since D31 is always GND by the look of it, you could actually connect it to the GND pin instead. It might help with the stability of readings.
The other thing you mention is the capacitors. While I wouldn't have thought they would be needed, they wouldn't hurt. And actually the analog inputs are supposed to be more accurate with a lower impedance - so having a capacitor between GND and the input might give you better temperature readings.
Also, totally unrelated, but did you spot the 'Puck.js Minimal' builds? Those strip out some features but give you more flash memory for storage which might help you out :)
© Espruino, powered by microcosm.
Report a problem