sonysandy
Posts: 7
Joined: Fri Sep 01, 2017 12:57 pm

Halloween project help

Sun Sep 03, 2017 11:09 pm

I'll paint the picture. I wanted to make a nice simple halloween project to make a flickering candle light in a pumpkin using a Pi Zero.

This is has now grown, through my sons imagination, to include a pir to sense if anyone comes near and to then flash some other lights and play a sound bite.

I can happily cobble togeather apps to do each of these things individually and stand alone from one another using some of the handy guides posted all over the internet. So lets say these apps are called;

Candle_flicker.py
Pir.py
Scream.py
strobe.py

What I'd like to set in motion is fire Candle_flicker.py all the time
Fire Pir.py to monitor all the time
on detection in Pir.py I want to call
Strobe.py and finally play a random sound bite from Scream.py

The problem I have is Candle_flicker.py and Pir.py run in a happy little loops on all the internet guides and I'd like to run them so they don't trip over one another and well cancel each other out by running solely in charge. This is where I'm stuck. I thought perhaps I could run them with a bash shell and the & after each .py call but no good they just wont run at the same time first to load and it stops the other.

help... I've not written a program for over 20 years and my brain aches lol

sonysandy
Posts: 7
Joined: Fri Sep 01, 2017 12:57 pm

Re: Halloween project help

Mon Sep 04, 2017 9:18 am

Also as an aside has anyone got a simple easy to follow Strobe python script and an info graphic pic so I can plug in whatever I need on a breadboard easily..... or has anyone tried using an Explorer pHAT (i'm guessing that this is maybe an option?)..

darkdrgn2k
Posts: 6
Joined: Tue Sep 05, 2017 12:46 pm

Re: Halloween project help

Tue Sep 05, 2017 5:26 pm

If you just want 2 of them to run at the same time run them in the background

just append & to the end of the line
OR
press CTRL+Z then run the command bg


Alternatively run them in separate screens

Code: Select all

apt-get install screen
Then

Code: Select all

screen -dkS MYAPP1  python myapp1.py 
screen -dkS MYAPP2  python myapp2.py 
screen -dkS MYAPP3  python myapp3py 
then to connect to one of these screens

Code: Select all

screen -x MYAPP2
to leave the screen
use this sequence

Code: Select all

CTRL+A 
CTRL+D

sonysandy
Posts: 7
Joined: Fri Sep 01, 2017 12:57 pm

Re: Halloween project help

Wed Sep 06, 2017 11:20 am

Thanks for the suggestion.

In the meantime I gave up on being clever and making multiple .py files and calling them and wrote a single .py file that loops through flickering an orange LED, it also checks for pir input and if detected it will flash a large white light array and play a sound file (more on that shortly). However the light array really needs 5v for full brightness and obviously i'm having to run it from a GPIO pin so stuck at 3.3v

So now I have 2 questions.

1. Is there an easy way to get my script to flash the white array and play a sound file at same time? Without hundreds of lines of code and without having to use lightshowpi.

2. Would using an explorer phat (which I have laying around) work to drive the 5v array but also still allow me to drive the flickering orange led? I've googled for explorer phat candles but drawn a blank so far.

sonysandy
Posts: 7
Joined: Fri Sep 01, 2017 12:57 pm

Re: Halloween project help

Tue Sep 12, 2017 8:59 pm

So to partially answer my own question.

I succeeded in getting threading working so on pir triggering my pumpkin (breadboard cobble) now plays scary screams and turns on a bank of bright white LEDs.

But now... I want to strobe those white LEDs. I got a little 555 board which basically saved me time soldering and meant it definitely works. I have strobing working off a little 5v battery pack.

However the Pi only outputs 3.3v on its gpio, not enough to make the 555 work.

Can anyone suggest options that allow me to trigger an action and then somehow boost that 3.3v up to a 5v? I'm thinking some sort of switch? Ie in the presence of 3v turn on the 5v circuit. But as I'm not electrically minded I'm at a loss how to do this.

sonysandy
Posts: 7
Joined: Fri Sep 01, 2017 12:57 pm

Re: Halloween project help

Tue Sep 19, 2017 10:43 am

I purchased a little 5v relay board from ebay, but again I'm stuck. Its got 3 pin inputs on one side, ground, input and vcc. I assume "input" and "Ground" are from the 5v source and Vcc is my 3v gpio input? Sound about right? And the other outputs are screw connector so they go to 555 board?

pcmanbob
Posts: 1594
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Halloween project help

Tue Sep 19, 2017 8:29 pm

sonysandy wrote:
Tue Sep 19, 2017 10:43 am
I purchased a little 5v relay board from ebay, but again I'm stuck. Its got 3 pin inputs on one side, ground, input and vcc. I assume "input" and "Ground" are from the 5v source and Vcc is my 3v gpio input? Sound about right? And the other outputs are screw connector so they go to 555 board?
if you relay board works with the 3.3v from the gpio which many don't, you would connect it
vcc - 5v
input - gpio
gnd - ground



you would be better off just using an opto-isolator between your gpio and the 555 timer board.
Please only ask questions in the forum I will not answer questions sent to me directly via PM
Remember we want information.......................no information no help

Return to “Raspbian”

Who is online

Users browsing this forum: ejolson and 34 guests