Posts: 20
Joined: Sat Nov 22, 2014 5:42 pm

Turn LEDs on when motion detected

Sun Dec 07, 2014 5:42 pm

I want to turn on my BrightPI leds when motion is detected.
Anyone could help me in this?
Last edited by arpanetnetworks on Sun Dec 07, 2014 8:39 pm, edited 1 time in total.

User avatar
Posts: 35533
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Turn LEDs when motion detected

Sun Dec 07, 2014 6:03 pm

What sensor are you going to use to detect the motion? Camera? PIR? Ultrasonic?
Note: Having anything remotely humorous in your signature is completely banned on this forum. Wear a tinfoil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
Posts: 172
Joined: Sat Aug 04, 2012 6:02 pm

Re: Turn LEDs when motion detected

Sun Dec 07, 2014 7:34 pm

You can configure motion to run external commands on various events in your motion.conf file - see ... l_Commands

For BrightPi, you could create shell scripts that run the various i2c commands in the BrightPi demos to control illumination, and then set motion to run these on various events. Or you could write short Python scripts instead using the smbus package to send i2c data to control the BrightPi.

However be aware that motion will have to be detectable with the BrightPi turned off for this to work. Also, turning the BrightPi on will affect the image data motion uses for subsequent detection, but that may not be an issue (as motion has been detected).

If you turn off the BrightPi when the motion event ends, the change in light level might then be treated as a new motion detection event, switching the LEDs back on again. There are options in motion to try to deal with this - you'll need to experiment (see ... ightswitch).

If you're using a Pi NOIR camera, you could keep the BrightPi IR LEDs on permanently and turn on the while LEDs when motion is detected. That's something I plan to try myself when I get a NOIR camera that actually works.

Posts: 20
Joined: Sat Nov 22, 2014 5:42 pm

Re: Turn LEDs on when motion detected

Mon Dec 08, 2014 5:55 pm

thanks @dozencrows
but even though I set lightswitch to 100, LEDs keep going on & off every 2 seconds :/

Return to “Camera board”