Get periodical sensor readings from children 1 & 2 while sensor on child 3 is interrupt driven.
jimmy loyens last edited by
I have a bunch of sensornodes that measure battery level, humidity, temperature and lightlevel. The lightlevel measurement is interrupt driven. If the lightlevel differs more than a given amount from the last reading (for x integration times) the interrupt triggers and the lightlevel value is transmitted. Now here comes the problem, there are times the lightmeasurement triggers so often that the other sensor readings dont get transmitted (or even measured). Say sleep value is 10 min (every 10 min report battery voltage, humidity and temperature) and the light measurement triggers every 5min (this is not a constant) by interrupt. This meanes the code arrives at sleep for 10 min everytime the light interrupt is triggered and so never doing the measurement for battery level, humidity and temperature. Does anyone have an idea how to solve this? I know the millis counter doesn't run while in sleep so this is not an option. What i did for now is send all sensorvalues when light interrupt is triggered but this is a waste of battery since battery level, humidity and temperature dont change that fast. I guess it is allso possible to trigger these three measurements from the controller every 10 min or use a RTC on the node but i would really like to find a sollution in firmware only, since i have about 50 pcb's left for this node (so i cant go adding RTC).
Any ideas are welcome
@jimmy-loyens I would test if sending all values every time really has a large impact on battery life. I don't think it has.
An alternative is to keep a counter of how many times only lightlevel has been sent and transmit every n times. This solution doesn't adapt to varying interrupt times though.
tekka is working on possibility to get the approximate amount of time left when woken up by interrupt. Your use case could be perfect for this new feature.