Hi there,
I recently worked on a bird watcher project using Fin. To take the project further, I like to put a PIR sensor to Fin and wake up the module when any motion is detected, to reduce power consumption. I have Fin 1.1.1 and I looked at Finabler and supervisor APIs. At present my project has 3 services ( camera, face & tweet) … I am planning to add another service ( motion ) which will be connected to PIR sensor. When no motion is detected for certain time, it will shutdown other 3 services using supervisor api. When any motion is detected, it will start up those 3 services. But one issue with this approach is “motion” service is always running. Is there any better way to achieve the same outcome? My ultimate goal is to power the bird watcher using solar panel and need to run it on lowest possible power.
Thanks Phil ! I will keep an eye on this. Can I achieve the same without using Finabler block for time being? I mean using supervisor APIs … I guess I need to learn more about coprocessor and GPIO signal. Is there any good online resource to learn?
This is doable, but we don’t have an example for this at the moment.
I have pinged the maintainer for this about an ETA
In the meantime, if you are feeling brave enough you could give this a shot yourself - we always contributions to our projects from the community
We have the balena-fin-firmata project, which has a nifty application on the coprocessor to do things like read an analog pin, or write some other pin, etc. More about it here
The right way to do this would be to add this functionality to the coprocessor application that’s part of this repo, so that you can use flashing, and communication interfaces that are already built for you.
I deployed finabler block and I was able to sleep the compute module using REST API sleep. This was an east get. I can call same API from the container running PIR sensor to sleep the module. Also in the pin map , it says
16 - PF5 - PW_ON_3V3 - balenaFin Power Rail (used for sleep mode)
Does it mean that, if I send high to pin 16, module will wake up? If so, then I can connect PIR sensor to this pin and module should wake up when motion is detected … on the flip side, it may sleep when no motion … am I going in entirely opposite direction?
Hi Mithun, I am the maintainer for the coprocessor firmata repo; pin 16 is not exposed externally on the coprocessor GPIO header of the balenaFin and is internal to the PCB so you can’t easily connect your PIR sensor to it. Regardless, setting this pin high/low is not a recommended method as it is software controlled by the coprocessor and could result in accidentally driving too much current into the input pin. The best solution here is to add a handler for the sleep function from firmata to accept a pin value that can break the sleep event on an external HIGH/LOW pin digital read and wake the fin back up again. We have had a number of requests to add this feature and its very much on our todo list. You’re more than welcome to attempt to add this feature or write your own coprocessor firmware to handle it, until this feature gets merged into the coprocessor firmata repo (I’m hoping to get around to it within a week).
Hey - I don’t know timescales, but I would say that Alex is a busy chappy and it’s likely to be more than the week he suggested. If you feel you could attempt the PR, we would all appreciate your efforts!
I for one would love to do something similar in the future for a fin-based burglar alarm!