09-05-2016, 12:27 AM
(09-04-2016, 03:25 PM)vigor Wrote: Thanks for all the ideas about intermediate board between pine64 and relay. However i still don't follow why would it prevent triggering relay on power on, that intermediate board that controls relay will be powered on at some point as well and it will trigger that relay once it is powered on, right ?
I noticed that on power on, it is really a fraction of second when the relay gets power (blip), so i wonder if there is
an inexpensive electronic component that will only pass signal if powered more than a ( 1 or 1/2) second, because on boot it is just the matter pf fraction of second when the relay gets power blip, if only i can skip/ignore that blip then the rest will just work.
another option comes to mind, using battery powered pine64 all the time, and keep charging battery whenever wire power present (most of the time) that should help to avoid blips.
Micro-controllers, such as the Atmel328 used on the Nano/Pro Minis, start up with their pins in the input state, until programmed otherwise. In doing so, they don't actually trigger a high or low when powered up, so won't alter the relay state. Once you code is running, you can then do things like detect whether the relay is on or off (if it is bistable), or set the relay to the default state on power up.
However, I'm with Mark again on the reliability... if the system isn't battery backed in some way, there is always a chance that the power will brown-out at just the wrong time... and bad things could happen... like a brown-out happen just after the door has opened, and you're backing car out, and the unit reset, and promptly starts shutting the door on you...
This can be fixed by having extra sensors in place, to do things like check for the door position, obstructions and load on the motor to prevent it from burning out, but these are the sorts of factors you need to keep in mind when working on a system like this. Murphy's law will strike at some point... so you always try your best to design a project with that in mind. i.e. All of my designs use MOSFETs to protect against reverse polarity power, even though I use a standard 2.1mm centre positive 12v power connector... but there will always be that one time you plug in something that had to be the reverse polarity (damn you JR... why did you have to go and use centre negative connectors) and will blow something up!
My take on this is that if you have a dedicated micro-controller that has monitors the sensors, and does all the checks, it's less likely to crash or end up in a 'indeterminate' state, making it so the pine64 just needs to send the signal to open or close the door, and the micro will do so, if safe - or send a signal back saying why not, which the pine64 can relay back to the user. Depending on why you want to use the pine64, it not even be necessary in the design...
Having said that... what about a high value resistor (like a 1M one) on the I/O pin controlling the relay to GND (assuming low/false is indeed off for the relay)... if it is just a power up pulse... maybe that will be enough to bleed off the pulse? Do you think what would do the trick Mark? Or is something more complex like a logic gate needed?