Showing posts with label cheerlights. Show all posts
Showing posts with label cheerlights. Show all posts

Friday, 27 July 2018

Amazon Dash Button Cheerlight Controller

I needed a way to control the cheerlights that could be useful for friends who didnt have or understand twitter.  Whilst to most of us sending the colour or a sentence with a colour included along with the hashtag cheerlights was the norm, I needed to simplify the process.

Firstly obtain an Amazon Dash Button, they are a fiver in uk money, but order the product that the button is for e.g. duracell order batteries, then you get your fiver back making it free.

next was to follow the instructions that come with the dash button, order those batteries (or whatever you chose the dash button to be) then delete the button before re installing it.  when you get to the point of choosing your product again just exit and turn off dash button notification as you dont want to be ordering more product everytime the button is pressed.

next was to write the code, I needed (and failed quite a few times to begin with) code that could look for the mac address of the amazon dash button on my network, after several tries and googling each bit of code that gave me errors I found and edited some lines and bingo the hello world message I had been looking for telling me the button had been pressed and the ip address of the router.

I then tried to incorporate a way that this could be tweeted and colour and went for a random message option where I had a dozen ready made sentences with a different colour mentioned in each followed by the hashtag.  I ended up using tweepy which is easily installed with a apt-get install python-tweepy and went to an old blog I had about a twitter camera I built for my wedding and hacked away at the code taking all the bits i needed and writing it to just tweet once when code was run and it worked.

Next was to merge both scripts into one and run it, bingo it worked and didnt send tons of messages either which was a main worry. 

Future work on this code will be to introduce a way to detect you are not tweeting the colour already in use and also not to tweet a previous colour as twitter doesnt like this.

My code can be found on git hub at github.com/smstext/dashbuttoncheerlights


Wednesday, 9 December 2015

MyPiFi Cheerlight Christmas Decor



I decided a while back that after doing my Christmas tree last year in NeoPixel lights http://www.youtube.com/watch?v=uoGk0M8YdMA and using Penguin Tutors excellent DJ lights program https://github.com/penguintutor/neopixel-gui that this year I wanted a Cheerlight item (cheerlights.com) like I had run on the Unicorn Hat by ForToffee https://github.com/ForToffee/UnicornHAT Cheerlights is an internet of things where people use twitter and the hashtag #cheerlights and a colour and all items running cheerlights around the world will change colour to the current tweeted colour.

So the hunt was on for something I could use and low and behold I came across this laser cut house that had a battery pack running some plain leds inside.  Once it arrived it was time to strip out the lights and add 13 neopixels inside on a long strip, but to be able to get inside i needed to use a craft knife to carefully remove the roofs and one building.



I originally tried neopixel buttons but everytime i had these in place a wire would snap so from 5 buttons the amount of pixels would go up.

Once in place I soldered the pixels to a MyPiFi neopixel controller board and attached to one of my pi's http://smstextblog.blogspot.com/2015/03/afirstly-thank-you-for-purchasing-this.html .  I then glued everything back together and then followed Tonys great NeoPixel how to guide off of adafruit https://learn.adafruit.com/neopixels-on-raspberry-pi/overview Once all the software was in place I ran the first test and all seemed fine it worked.  However when I tried to run the Cheerlight code from David Bradway https://github.com/davidbradway/cheerlights I just couldnt get it to work.  I asked about and was told two different things to try so tried both at the same time, the first was to use an old pi with 26 pin header and second was to use Raspbian Wheezy and not Jessie which I tried and bingo, it worked I couldnt believe it.



I have since glued the Pi and the display to some thin mdf word to keep it all together and stop the wires being pulled and this is the finished result.




There is still some coding bits to fiddle around with but apart from that this is now ready for the christmas festivities and perhaps after christmas i could remove the christmasy figures off the front and just have this as an everyday cheerlight display for my desk.

Thank you for reading and please share.