I noticed one thing, however, which is that the values (measuring time, dutycycle en therefor the temperature) being displayed (printed) in the serial monitor were not stable. [...] So, the question is, what happens? I have not found the answer yet and my first question to you is, how stable are your readings?
This looks fantastic, have you made any more progress on this Edwin? I should have some of the sensors arriving tomorrow so can have a play with this
Didn't work too well on my mega, i presume that is down to the timers used? Would it be possible to include the updated code?
If I recall correctly the ICP1 on the Mega is not connected. There are two other 16 bit timers that expose their ICP pin, there is ICP4 on Arduino pin 49 and ICP5 on pin 48 according to this pinout.I will try tomorrow if this works on the Mega as well.
SYNTAX: uint8_t setError(float error) measures 8 consecutive cycles from the sensor to calculate and set the minimum amount of clock cycles for the required standard deviation of the sampling noise return 0 when busy, 1 when success, 2 when not connected within 2.5 ms after loss of signal startTemperature(); initialize Timer1 to measure the duty cycle at the Input Capture Pin 1 uint8_t getStatus(); return 0 when busy, 1 when success, 2 when not connected within 2.5 ms after loss of signal float getTemperature(); return the temperature from the previous startTemperature command in degrees Celsius float getError(); return the standard deviation of the sampling noise float getFrequency(); return the frequency of the sensor float getDutyCycle(); return the duty cycle of the sensor float getTime(); return the measuring time in seconds