bacardi55 / pimaton

A customizable photo booth application for Raspberry Pi
GNU General Public License v3.0
2 stars 4 forks source link

GPIO - Flash/OnOff/Button Light #7

Open james-lasersoft opened 6 years ago

james-lasersoft commented 6 years ago

What is your time frame for the GPIO? I am planning on building this out with a 12V DC power supply for the screen and the flash with 5V DC converter to run the PI. I am installing with a quad relay to control the Flash and the Big Red Button light with two relays left over for other things as needed. Also planning on installing an Off button that will shut down the Pi when finished.

If you are planning on implementing this weekend I will wait; if not I will go through this over the weekend and share on Monday results.

Do you already have any of the coding plans ready??

bacardi55 commented 6 years ago

being off next week, I plan to work on it starting Tuesday or Wesnesday and finish this part before end of next week

bacardi55 commented 6 years ago

Implementation of GPIO start button has been done in the master branch. For the GUI and for the TUI

I would love some tests from anyone here as I had to do a very ugly workaround due to an issue in the GPIO python library (see here for the particular bug).

The workaround is really weird but works great here but I think it needs to be tested with other buttons/setup.

So if the user that asked for this can do some testing, would be great :) ^^ @james-lasersoft @ukoofred @bderenzo

Nota: In TUI mode, you can use either GPIO or keyboard, not both (in this case, GPIO will prevail). I've created a dedicated issue here to work on it later.

james-lasersoft commented 6 years ago

I will wire that up tonight and test. Thanks

bacardi55 commented 6 years ago

I've added led flash capabilities in the master branch. I've tested it with this led. I'm a bit disappointed by the light strength, so I added the ability to add as many leds as needed. I'll try later with 3 to see if that's good enough … Or I'll have to find another way to bring lights ^^

It also brings new option in the config file, please see diff

james-lasersoft commented 6 years ago

I am planning to use 1 GPIO to control a 12V relay that will kick the flash.

bacardi55 commented 6 years ago

That's might be the best. Did you already decide on the flash and the 12v relay?

bacardi55 commented 6 years ago

It also means that the method I used won't be working correctly (as it's just enabled a pin for the whole duration of the taken pictures)

james-lasersoft commented 6 years ago

I have them purchased. I can send you amazon links when I get back to the office. Going on with that if you would like to implement some simple function for me ot would be great.

I am using a quad relay board. One relay for the flash with spares if not enough light and one relay for the "Big red button" mine has a 12v LED. The function I would like is to have the button light come on when ready and turn off when pressed while processing. Then when the process is finished turn back on. This would go well in the part of the routine that stops looking for the button press while processing.

james-lasersoft commented 6 years ago

I would like to see some timing on the flash. Using a differentiator from the between pictures. Something like .25 or .5 seconds before taking the picture to let the lights come on and a duration for it to remain on. So 2 variables being duration and start.

bacardi55 commented 6 years ago

I intend to implement the light thing on the "big red button" the way you describe.

I need to read more about how to set it up first, i'm always afraid to burn my rpi or touchscreen or the button (or now he flash^^). So if you can talk about how you wire everything it might help too :)

For the flash thing, if I switch to the same setup as you (which I might do as the led flash is really not helping a lot), i'll try to implement it this way

PS: yes i'd like to see what you purchased :)

james-lasersoft commented 6 years ago

Ok. I will send you the full purchase list of my build. I will also i clude the schematic connection diagram. This also includes an on/off button to shut down the pi. I will include the code snippet for that since I already have implemented and it is i dependent of your software.

bacardi55 commented 6 years ago

If you have a chance this week end, i'd love to look at your purchase list as I'm thinking i'll do something similar to you for the flash (and thus implement that in Pimaton :))

james-lasersoft commented 6 years ago

Big Red Button https://www.amazon.com/gp/product/B00ENFK8CI/ref=oh_aui_detailpage_o03_s00?ie=UTF8&psc=1

4 Channel Relay https://www.amazon.com/gp/product/B00KTEN3TM/ref=oh_aui_detailpage_o03_s01?ie=UTF8&psc=1

10 inch Touch Screen https://www.amazon.com/gp/product/B0776VNW9C/ref=oh_aui_detailpage_o09_s00?ie=UTF8&psc=1

MicroSD Extender https://www.amazon.com/gp/product/B072X27V58/ref=oh_aui_detailpage_o01_s00?ie=UTF8&psc=1

Power Supply 12V/5A https://www.amazon.com/gp/product/B077T78YLB/ref=od_aui_detailpages01?ie=UTF8&psc=1

Flash https://www.amazon.com/gp/product/B07BT2JYH4/ref=od_aui_detailpages01?ie=UTF8&psc=1

Power Shutdown Button https://www.amazon.com/gp/product/B076VT34K1/ref=od_aui_detailpages01?ie=UTF8&psc=1

Both the Big Red Button and the LED of the Power button are 12V and need to be dynamically controlled by the relay board. This allows us to indicate when ready to take a picture or when the Pi has shutdown and is ready to unplug.

I have included the 12V 5A P/S and am testing to see if it provides enough to trigger the light while still running the Pi. I will let you know probably by tomorrow.

I also included the TouchScreen display because this product actually has a USB output for powering the Pi so no intervention is needed to turn the Pi on.

This light seems to take about .5 seconds to turn on after applying power so that is one of the timers I was requesting. Timer1 = How long before the picture to turn the Flash on; Timer 2 = How long to keep the flash on.

After I test and connect this weekend I will have a full connection diagram and pictures to send you.

thanks for all your work.

James

James Arnold Co-Owner - Lasersoft [image: View my profile on LinkedIn] http://www.linkedin.com/in/jameslasersoft

"Blessed is he who expects nothing, for he shall never be disappointed." Alexander Pope

On Thu, May 17, 2018 at 9:58 AM, bacardi55 notifications@github.com wrote:

If you have a chance this week end, i'd love to look at your purchase list as I'm thinking i'll do something similar to you for the flash (and thus implement that in Pimaton :))

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bacardi55/pimaton/issues/7#issuecomment-389896979, or mute the thread https://github.com/notifications/unsubscribe-auth/AjZJD4H_pMWez8fwspcqmmGTuRUYTQEkks5tzZAIgaJpZM4Tzswj .

james-lasersoft commented 6 years ago

@bacardi55 Can you please invert the signal on the Flash. There arises a problem in that the way you configured initially everything works normally until you put the Pi into Halt. For you initial config to work I have to connect to the NC contacts of the Relay. The problem comes for the fact that the pins float until initialized. Then you initialize with a signal that triggers the relay to flip and the light remains off. During the pictures you toggle and all is well. But when you put the Pi into Halt so you can unplug power safely the relay goes to its natural NC position and turns the flash back on.

I would like to come off of the NO contacts and invert the signalling so this does not occur.

It would be interesting as a standard practice to have an init routine where all of the GPIO's could be initialized before actually using them in the software. Perhaps shortly after reading the initial config file. I would like to configure ALL of the GPIO pins to low except 3 & 5 that should be naturally high.

Just for the sake of simplified wiring I would suggest using pins 34,36,38,40 -- GND, GPIO's 16, 20, 21 for actual wiring as then you can use a 4 pin header block.