Advanced Users can post their questions and comments here for the not so Newbie crowd.

Moderator: eriksl

User avatar
By davidtaille
#85424 Hi all,
I'm trying to use a temperature sensor (SMT172 from Smartec) that uses the duty ratio of a PWM signal to give the temperature.
Hence my need to precisely measure rising/falling times of a pin.

If i was using another "normal" MCU, I'd go for using a timer's input capture to get the timing but I could not find anything on this for ESP8266...
Would anyone be able to confirm that there is no such feature on this chip ??

Note : I tried using an interrupt handler to capture the cycle count for every change, but it works only 95% of the time ; 5% I have abnormal readouts (due to other interrupts I guess).
Is there any way to raise the GPIO priority above all other interrupts ?

Thanks for your time.
David
User avatar
By AcmeUK
#85512 Hi

How often are you sampling the SMT172?

How necessary is it that you have an uninterrupted series of measurements; e.g. for graphing?

Here are 3 approaches to your problem:-

1, If uninterrupted data is needed you could compare the current measurement with the previous, if it varies by more than say +/- 5 degrees bin it and send the previous measurement.

2, Wifi uses periodic interrupts. Turn off wifi when not sending data.

3, Use a slave processor such as a TinyAT85 to do the measurements, then use i2c to transfer the data to the ESP.

Good Luck in solving your problem.