-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set initial state of pin #38
Conversation
Set initial state of relay to off. Accounts for pin inverted state.
Set initial state of relay to off.
Makes sense to me. Will merge it into devel when I get a chance to test it out. Thanks PS: Next time make a branch and submit the PR to devel. 😄 |
Gotcha, will do. :) |
This reverts commit e91e5f2.
Hey there! I've finally had a chance to take a look at this. So far I've set up an inverted circuit without adding the changes from this PR and I've ticked the invert option on. The PSU does indeed default to being on when [re]booting the Pi due to the default state of the GPIO pins being set to low. Is this PR supposed to simply turn the PSU off when OctoPrint starts after the Pi [re]boots or are you expecting it to work during [re]boots as well? PS: |
The pins are high impedance on powerup. They should be set as neither high nor low (with a caveat listed here https://www.raspberrypi.org/forums/viewtopic.php?t=7443&p=93865) - On my raspberry pi B v1 this is how they function, however I don't see the transient spike mentioned in that post... When I boot, or reboot my system, nothing happens to the PSU. As soon as octoprint (and this plugin) starts, due to setting the GPIO default state, the PSU turns on. My attempt is to have the default state continue to be whatever the "off state" of the PSU is, as in either case, the PSU SHOULD be off until the GPIO is configured. In your test circuit, did you add a pullup/pulldown resistor to the pin? That could influence your results. I'm using a relay like this one http://www.ebay.com/itm/Blue-5V-2-Channel-Relay-Module-With-optocoupler-For-Arduino-PIC-AVR-DSP-ARM-HYSG-/311560796461?epid=1376439117&hash=item488a78792d:g:p8EAAOSwAuNW22hK This uses an optocoupler to tie it to the relay, which is also why the output is inverted. If you combine this with the Auto PSU on/off options, you wind up with the PSU ONLY coming on when it actually needs to. |
Ah ha! I was using two NPN transistors and due to this the state would be HIGH when powered off. Luckily I had a similar relay PCB and I now see where this PR comes into play. I've tested it and it looks good. I noticed a commit made after the PR was submitted changed the version and then later the fork/branch was deleted entirely. Would you be able to branch from the latest devel, recommit the change, and update the PR with the appropriate fork/branch against devel? If you have an issue changing the fork/branch in this PR you can just open a new one and reference this one. I only ask because I think you wouldn't get credit in the commit log if i merged a PR from deleted fork/branch. Thanks 👍 |
Sure. I'll manage that. :) Also, I'm working on a sister update for the issue #36 I opened. I fixed that too. Should have a PR for it coming your way for that also. (seperate PR's). |
I would like to propose a change. In my setup, the PSU of the printer powers a raspi via a buck converter. The raspi then controls a relay that powers the rest of the printer. So the way it is setup right now, I need to operate the physical power switch, wait for the octopi web interface, and then switch the rest of the printer on. Cumbersome. I do not always want to control the printer via Octopi. I also want to be able to have local control over the printer when I switch it on. So I would like to either use it as a locally operated printer, or when I don't use it for 15 minutes then PSUControl takes over and saves power until I either reboot the pi by means of the power switch or start operating the printer via octopi. That way, I can either have it on standby for longer periods, or quickly fire it up for a local print job or maintenance. The proposed change is to add a preferred initial state configuration. For now I have hardcoded it as follows, but that is just a hack:
proper implementation would like something like this
Plus a checkbox in the config dialog Note that I had to destroy the idle timer, because in my case it was switching off the PSU right away after boot again. forgive me for not coding a complete pull, I do not feel confident that I'm not screwing up more than I'm fixing... |
Yeah based on what I understand I don't think you can adequately tell if
the printer is being used or not you could tell when the temperature starts
to rise and maybe call that a starting point but that's not a true idle
timer.
what I wound up doing on my printer because I wanted the same basic use
case you described is I added a switch in parallel to switch the same line
that the relay was switching so the hotline makes a y one side goes to the
relay the other side goes to the switch and then both of them rejoin back
up to power the PSU.this allows me the ability to flip the switch and the
printer is just powered on until I flip the switch off if the relay kicks
on or kicks off it doesn't really matter because the printer already has
power with the switch in the off position then the relay functions as
normally.
|
Set Initial state of pin to off. Previously, when you would invert the PSU pin, the PSU would be on at startup.