User avatar
Hove
Posts: 1205
Joined: Sun Oct 21, 2012 6:55 pm
Location: Cotswolds, UK
Contact: Website

PiGlow + Motion detection

Thu Oct 17, 2013 7:00 pm

I bought a PiGlow a while back from Pimoroni, and over the past few days I've had some time to tinker while waiting for the weather to settle to allow some more quadcopter testing. There are 18 LEDs on a PiGlow, in 3 arms of 6 colours, but if you light them up sequentially, you actually get a randomish pattern - so I put together an arm / colour mapping array to find the LED needed. Then I put PiGlow tinkering to bed in time to do the same for my son.

He (my son) woke in the night with a bad dream, and that got me thinking about using PiGlow plus a motion sensor (this one: http://uk.farnell.com/jsp/search/produc ... hist-all-1 I'd already got some of these kicking around from a home alarm system RPi project that stalled) to use a night light to fill his room with soothing light if he wakes up unsettled. So I did...

But in doing so, I also started tinkering with various patterns of LEDs that could be used, which resulted in a chunk of code that could perhaps be used by parent and kids to experiment and play with to make new LED patterns in Python.

So as of now, NiteLitePi starts on boot with a twinkly pattern, until it detects motion, at which point it randomly chooses one of 4 other available patterns. This new pattern runs until 5 seconds of no movement passes, at which point, twinkles take over again.

If you're interested, everything I have is here: http://blog.pistuffing.co.uk/?cat=186.
www.pistuffing.co.uk - Raspberry Pi and other stuffing!

Return to “Automation, sensing and robotics”