Today I changed some things on my previous setup, after testing & concluding that XBee IO Change detection doesn’t work during sleep, which I already anticipated.
I changed some settings in the XBee and I added a wire to Pin 9, the Pin Sleep Control Line. The XBee is now in Sleep Mode 5 (Cyclic Sleep Pin-Awake), which means the XBee wakes on timer expiration or when Pin 9 changes from high to low state. The latter (Pin 9 change) is what the extra wire is for; it connects the output of the Hall-effect sensor to Pin 9, so that when the sensor output changes, the state of Pin 9 changes also.
Now the Xbee sends an IO Data Sample frame each 28 seconds based on the sleep settings, but also when the magnet is being moved towards the sensor – because the XBee Pin 9 becomes low, the XBee wakes up and starts to send an IO Data Sample Frame. Great! So now I know instantly when the magnet comes close to the sensor; exactly what I need.
But that’s only half of what I need of course, because when the magnet is being moved away from the sensor, the sensor output (and XBee pin 9) changes back to high, but that’s not triggering a wake up of the XBee… hmm.
So I started searching the net and read about all kinds of latches, NOT gates, flipflops, and saw more circuits than I’ve never seen before in my life. I haven’t found what I’m looking for yet – I don’t even know if it can be done – but I’ll continue my search for a way to shortly ground the XBee pin 9 whenever the sensor output changes from high to low or vice versa.
Yeah I know, an ATMega, duh.