Wow, that's a pretty serious noise issue. What's the other side of the thermistor connected to? GND and 3.3v would be best as that is what the microcontroller is also using. When I was doing the stuff for http://www.espruino.com/Thermistors it was pretty stable.
As far as software filters, the simplest is:
var amt =0.1;
var average = first_temperature_we_have;
function step() {
average = average * (1-amt) + new_temperature * amt;
filtered_temperature = average;
}
But you can also do a median filter, which is the kind that's used for noise reduction in digital cameras, TVs and stuff like that:
var history = new Uint16Array(50); // or whatever level of filtering
var sortedHistory = new Uint16Array(history.length);
var historyPtr = 0;
function step() {
history[historyPtr] = new_temperature*256;
historyPtr = (historyPtr+1) % history.length; // choose a new history item
sortedHistory.set(history); // set history values to the new ones
sortedHistory.sort(function(a,b) { return a-b; });
filtered_temperature = sortedHistory[sortedHistory.length/2]/256;
}
Hope that helps! While doing this I found a bug in Float32Array.set, so you won't be able to use that until 1v65 I'm afraid. However if you need floats you can always use the normal Array - it'll just take up a bit more memory.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Wow, that's a pretty serious noise issue. What's the other side of the thermistor connected to? GND and 3.3v would be best as that is what the microcontroller is also using. When I was doing the stuff for http://www.espruino.com/Thermistors it was pretty stable.
As far as software filters, the simplest is:
But you can also do a median filter, which is the kind that's used for noise reduction in digital cameras, TVs and stuff like that:
Hope that helps! While doing this I found a bug in Float32Array.set, so you won't be able to use that until 1v65 I'm afraid. However if you need floats you can always use the normal Array - it'll just take up a bit more memory.