In the newsletter from Blues Wireless I have read that with new firmware its now possible to use AUX GPIO for event counting (possible without using an additional microcontroller). I have an application where I would like to count PIR occupancy sensor pulses with AUX GPIO. For example using a PaPIR sensor from Panasonic which only consumes 2uAmps.
Would that be possible? I still want to have my own microcontroller to manage other sensors anyway.
So, my question is: Is my application possible? How should I update Notecard´s firmware?
Correction: An earlier version of this post said that we already support this feature. My apologies.
This is a feature we’re working on but it isn’t possible in the released firmware yet. Today (up through v3.3.1) the card.aux request arguments file (automatic creation of a note) and sync (automatic trigger of a sync) aren’t supported for any pin used as a counter, only pins used as input.
Speculatively, you will set "file":"pircount.qo" if each time the count changes you want a note created containing the total count. At first this may be rate limited to one note per second so as not to exhaust the notecard memory. Note the count itself will not be rate-limited, just the note creation rate. Would that be an appropriate rate limit or do you need notes to happen much more often or less often?
Speculatively, you will also set "sync":true if you want the note to sync as soon as a pir motion pulse is detected or set to false if you just want the notefile to be synchronized to notehub on the regular schedule (which you probably already set with a "req":" hub.set request.) These triggered syncs may be rate limited to once-per-minute at frist. Is that a good rate for you or would you need it much faster or slower?
Any other details about how you would want the autonomous counter to function?
In the mean time, as a workaround on the current firmware if you could wire up your PIR sensor to go high for 1 second each time it sees motion, you could plug it into an aux pin configures as input-pulldown and that will allow "file":"pir.qo","sync":true to tell the Notecard to automatically create a note and sync it immediately whenever your PIR sensor detects motion.
Oh, and since it sounds like you’re working on making your device energy efficient, you might be happy to know the notecard goes into a low-power state using only 8 microamps and in count mode it’s interrupted when your aux pin changes so the notecard doesn’t waste energy polling the pin. Here are more details on Low Power Design with the Notecard
What I would like is to count PIR sensor pulses and get count value reports at a fixed interval (i.e every minute or every 5 minutes). Then count value could be reset to 0 and start the counting again for the next interval. Is this currently possible?
That’s not possible yet. But it’s similar to a feature I’ve been pushing for. I’ll update our feature-request database and see what we can do. Would you also want a report if the count is 0 over the time period?