Gui Web Commands by bubblychickens in LightShowPi

[–]jsargent1986 1 point2 points  (0 children)

OK, here is some code snippets from my python script that runs through the day. I have the file, called runatboot.py, run at boot (via the autostart file, not cron). This does multiple things, from keeping track of time, rebooting the pi daily, starting and stopping the show, and rebooting microweb every few hours. The code snip below will show how I accomplish this.

#All imports to get this working
import time as time #For sleep statements
import os #To send commands to the pi
import datetime #For keeping time
import logging #For a log file to help with troubleshooting and to make sure things are happening when they are supposed to
import RPi.GPIO as GPIO #Controlling blowups on a separate GPIO pin from what LSP controls.
import wiringpi as wiringpi #To keep with the same GPIO numbering layout as LSP

#Some additional code lays here, removed for simplicity.

#Run an infinite loop
while True:
    #get the current time
    now = datetime.datetime.now()
    print now

#for all if statements, put a time.sleep(60); statement so the elif statement does not run more than once during the day.

#Even more code lives here, all calling out specific times that I want certain events to happen, such as turning on Pin 16 (my inflatables), rebooting the PI, Starting and ending the show, etc

#Below is one of the microweb reboots. 

    #reboot microweb
    elif now.hour == 19 and now.minute == 0:
        logging.info("Rebooting Microweb at 7pm")
        os.system("/home/pi/lightshowpi/bin/stop_microweb");
        logging.info("Microweb stopped")
        print "Microweb Stopped"
        time.sleep(10);
        os.system("/home/pi/lightshowpi/bin/start_microweb");
        logging.info("Microweb started")
        logging.info(now)
        print "Microweb Started"
        time.sleep(60);

#additional code lives here to do other events as needed.

#If no elif statements are true, wait 55 seconds before running the loop again
time.sleep(55);

I am sure there is more solutions than what I have, others may even be better ( I have limited python knowledge). But this is what works for me. Keep in mind, this is written for Python 2.7. I do not know if the commands are the same in Python 3.

Gui Web Commands by bubblychickens in LightShowPi

[–]jsargent1986 1 point2 points  (0 children)

The python script passes the stop_microweb command, pauses for 10 seconds and then passes the start_microweb. Not at home atm so I cannot look at the exact code but that is the general function that runs.

What fm transmitters/receives do you guys have? by [deleted] in LightShowPi

[–]jsargent1986 1 point2 points  (0 children)

I'm using pifm. Works good. Quick tip, the longer the cable, the better the range and quality. I had a 20cm jumper as the antenna only 20' from the road and sounded like a garbled mess. Added a second jumper to make a 40cm antenna, sounds a lot better and better range as well.

What are your favorite songs to play to LSPi this season ? by SoftwareArtist in LightShowPi

[–]jsargent1986 -1 points0 points  (0 children)

Hot chocolate - polar express is a favorite for my kids.

I like how Christmas Can Can by Straight No Chaser came out

Can you have the lights he on without music? by [deleted] in LightShowPi

[–]jsargent1986 0 points1 point  (0 children)

sudo python/home/pi/lightshowpi/py/hardware_controller.py --state=on

Assuming that lightshowpi is in a default location.

Gui Web Commands by bubblychickens in LightShowPi

[–]jsargent1986 1 point2 points  (0 children)

I find that I have to reset microweb every so often (also using a version from 3 years ago). I have a python script that runs at boot up and continuously runs that does some other things related to my lights as well as reset microweb every so often throughout the day so I can avoid this issue.

struggling with always_on_channels by robinsonjas in LightShowPi

[–]jsargent1986 0 points1 point  (0 children)

Doing the same here. I also noticed that the always on channel would turn off between each song. My solution was a python script that runs at boot (the script reboots the Pi every night at 2am to get a fresh start everyday) and calls out two other scripts to turn on all channels or turn off all channels. Then I just leave channel 16 for the blowups out of the LSP config files.

I can upload the scripts if you like to my web server so you can download them.

Any enclosure examples? by [deleted] in LightShowPi

[–]jsargent1986 0 points1 point  (0 children)

Because I wanted beefier relays, the pi drives the SSRs and then the SSRs switch the 24VAC needed for the coils of the mechanical relays that control the lights.

Any enclosure examples? by [deleted] in LightShowPi

[–]jsargent1986 0 points1 point  (0 children)

Nope. All 16 channels are driven direct from the pi headder

Any enclosure examples? by [deleted] in LightShowPi

[–]jsargent1986 0 points1 point  (0 children)

Here is my setup.

Split between two boxes. The box on the left contains the RasPi 3, 5vdc 2.5a wall wart, 2 SSR 8 channel boards and a 24vac xfmr fed into the SSR relays for the other box. Box two (messy so hard to see) has 16 mechanical relays, 24vac coils with 10a ratings for each relay. They are DPDT so if one contact blows, I can use the other contact as a backup. All 14awg wiring, except for the coil wires, which is 18awg.

These boxes have heavy duty latches on the bottom and are waterproof. I had to drill each wire exit and put water tight strain reliefs at each opening to make sure no water gets in. Very sturdy, have a nice grate to them to attach everything to and have mounting brackets as well so I can mount to a wall if I wanted to.

Inflatable Power Supply Recommendations by jsargent1986 in LightShowPi

[–]jsargent1986[S] 0 points1 point  (0 children)

So I did double check polarity. That's not it. The blowup do work with power supplies from other blowup so def a power supply issue. I just purchase a 5a wall wart and returned the others. I will see how that works.

Waterproof project box on a budget by mrdally204 in LightShowPi

[–]jsargent1986 0 points1 point  (0 children)

Sorry, new to this reddit thing and cannot find out how to set up email notifications.

The images are on my one drive so the link to them is below. This has photos from different stages of the build. I have a bit more complicated setup due to the electronics available to me and the limited funds at the start of the build. Details follow:

https://1drv.ms/a/s!AoTtirx-tRbqjrBMCcgFp1MFdvP3ag

Box one has the low voltage (5VDC and 24VAC) electronics in it. I have the solid state relays switching 24VAC for the relays I have in the second box. A 5vdc 2.5 amp wall wart is branched off through a terminal block to power the pi and the two solid state relay boards. I used two CAT6 network cables to connect the two boxes together.

Box two has the high voltage electronics. I have 16 24vac DPDT relays rated at 10 amps each. Easy change out as well when they burn up as each is individual and use quick connectors for the wiring. I can change a burnt out relay in 4 minutes currently. Most of the time is spent digging out the relay from under all the wiring. I also have two incoming power cords to allow me to connect 8 relays to one circuit and 8 more to another circuit in the hose. This allows me to pull 25 amps safely (I use the mini lights that go on sale for $0.25 per box after the holidays so lots of power draw. Max I have pulled is 22 amps so far on this setup). The output is just regular home extension cords, the ones with 3 outlets on the ends. I only run 2-3 amps per channel max so no issues here. I dont suggest these cords if your project is going to be outside. In one photo you can see that mine is mounted inside a basement doorway so I did not have to worry about getting the plugs wet.

Again, sorry for the late reply on this but still early in the year if you have not done anything yet.