First off a big thanks to Miria Grunick who originally developed this and Simon Law who modified the code to work on the arduino rather than a teensy.
Miria’s site is at http://blog.grunick.com/blinky-box/
Simon’s site is at http://www.simonlaw.com.au/electronics/blinky-box/
Two of my boys are twins who are now just over one year old and getting into the age of exploring everything and loving lights which go on and off, my lamps can attest to that.
After i saw Miria’s project i searched for an Ardunio version and stumbled on Simon’s version which has been modified for the Arduino. I set about acquiring the parts and planning how i would build my own version.
The arduino code can be downloaded at code. I take no credit for the code as it’s all Miria’s and Simon’s work.
I’d love a laser cutter and think it would give my projects that professional edge and polished look. I’m starting to make more electronic toys for my little boys so a laser cutter would allow me to make even more creative designs.
Task 1: Enclosure and lid.
This part ended up being extremely tricky, well the choice of box was at least.
Miria and others used a hammond box which looked great but is quite difficult to get hold of. I found some online and ordered two but realised as soon as they arrived that i’d made a big mistake with regards to the sizes. I didn’t pay attention and they were tiny when they turned up! Luckily the store on amazon took them back which saved me a fortune.
After some more searching i decided to go the very cheap and low tech solution and opted for a tupperware box!
It’s a good size and transparent as well as still allowing me access to the internals. The four tabs are difficult to open so i think the twins won’t be able to manage it but if they do i’ll look at securing them with some cable ties. The tabs that is not the twins 😉
I began by attaching masking tape to the lid and marking out where i wanted the buttons placed. This helps prevent damage to the lid as well as making it easier to create the holes as the drill won’t slip as much. I used a hole cutter set which i got from my dad a while ago which worked excellently. I applied too much pressure in one small section so ended up with a slight crack but nothing major at all. This was the pitfall of the tupperware box.
I went with five coloured buttons for the main colour changes then a sliver smaller button for the disco/pattern setting. I went with a different style button as i couldn’t get the same style individually but also i thought it looked cool and a different feel to it would be good for the boys.
Task 2: Case sides
I used a similar method to the holes in the lid although the power adaptor was small enough that a regular drill sufficed to created the holes. The power adaptor was a nice snug fit but did come with a nut to fix to the back anyway which was good. The power switch was a pushfit so it was importand that the hole was not too big else it wouldn’t work well, i had to manually modify the hole to ensure the tabs could fit through. It looked ok in the end though.
I ended up removing the power adaptor and replacing it with the rotary encoder which can be seen in the finished pictures as i went through a few different powering options which i’ll highlight later.
Task 3: Button Connections
I originally attempted to solder directly onto the pins of the buttons but i found this didn’t work too well. I then back tracked and removed the solder from the joins and purchased a packet of spade crimp connectors along with a crimping tool. the connectors work great although i have to say i wasn’t impressed with the tool, on reflection i wish i’d went for a better style tool as it was a pain to get a good connection. The wire i used was from an old cat5 cable. While it’s only for signals it worked ok but as it’s so fine there wasn’t much to crimp onto. I bought a pack of 100 connectors so i’m ready to make a second or use them in another project.
I wired a series of wires in a loop connecting two into each connecti except the first which had a single wire. This shall be used for the ground connections. I would have preferred different coloured crimp connectors for ground and then the signal wires but couldn’t justify the cost baring in mind they come in packs of 100. The last two wires were connected together and then a soldered to a dupont connector so hook into a ground connection on the Arduino. A seperate cable was made up with a spade connector at one end and then a dupont connector at the other end to plug straight into a header on the pro mini.
Task 4: Begining the wiring
I started by wiring in a resistor inline with the signal wire from the neopixel. I then took a buck converter and wired in a capacitor directly to stop the first neopixel being damaged by a rush of current.
I wired in the power switch directly into the positive power cable. I have to confess at this point i made a small error and got cocky thinking oh this is how i think the switch should be wired and effectively just wired it in a permanent short circuit which was my first brush with a shorted 18650 battery! Not good but a worse one followed later which i’ll show. This was fully my fault so i took a step back and looked at the data sheet for the switch. It’s something which should be very simple and in reality is but i made it harder than it should have been.
Task 5: Power and battery choices
As a lot of the signal wiring had been wired up now and plugged into the arduino i was onto how i was going to power the box. I had started to follow in the footsteps of previous examples and put a TP4506 based lipo charger hooked directly upped to a lipo battery. This then used a buck converter to lower the voltage from 7.2v down to 5v. This would have worked well had i not managed to short the only dual 18650 battery holder earlier by wiring up the input switch incorrectly and destroying it!
Because of this i was forced to either order a replacement off ebay from a UK seller or wait 3-4 weeks for reasonably placed replacement from China. In the end i decided to look through the kit i already had. This let to a bit of testing with different batteries but in the end i went with a pre-built DIY 18650 enclosure. In the end this worked well however i did have one issue along the way. Again this was down to my stupidity of shorting the batteries but in my defense the enclosure was extremely badly labelled and even a friend of mine who has forgotten more about electronics than i’ll ever know said he would have done exactly the same!
See the picture of said device on fire in my garden and the resulting devastation. Despite this i put two 18650 cell’s into the second of these i’d purchased and all was good this time. I’ve tested it pretty extensively and it’s worked really well. I pop the lid when i need to charge and plug in a micro USB connection then close it back up once done.
Task 6: Arduino connections and code
I wired the power into Raw which left VCC free for the encoder. The Neopixel power was wired directly into the switch connection. I used a small chocbox connector for hooking up the power to the power bank. If people would like these connections in more detail i can supply them. When compiling and uploading you will need version 1.0.6 of the arduino IDE
- DataPin = 12
- RedPin = 4
- GreenPin = 5
- BluePin = 6
- YellowPin = 7
- WhitePin = 8
- BlackPin = 9
- EncoderPinOne = 2
- EncoderPinTwo = 3
- EncoderPinThree = Not Connected (This is used for the switch on it)
- EncoderPinFour = VCC
- EncoderPinFive = Ground
I only used half of my LED strip so needed to change the code to take account of only 15 LED’s. Also i upped the brightness as i wanted it as bright as possible so it could be used in daylight also. The code changes are below.
const unsigned int nLEDs = 15; // number of LED’s in the strip
const unsigned int maxPower = 1023; // maximum brightness of LEDs
Task 7: Final steps and Conclusions
The project worked really well and the twins like it and will get more out of it as they learn cause and effect more as they get older. It’s also got the flexibility so that i can update it as they get older with different patterns and maybe even a game as i can light the buttons also.
The arcade switches i purchased have 12v LED’s so i’ll need a step up converter if i wish to illuminate these which is a big shame so I’ve held off doing that for now. I’m building one for my sister and have went for 5v led based buttons which shall make things much simpler.
My biggest take away however though was how careful you need to be around 18650 cells. I am always respectful of electronics but you have to pay attention to the way it’s wired and not rely on labeling or how you think it should be wired or would be say with AA batteries.
Task 8: Parts list
Bar the tupperware box which was bought at a local supermarket everything was purchased from ebay, I’ve included links to the ones i used below. One thing i’ve learned in getting into hobby electronics is that it’s usually just as cheap to purchase 5 or 10 of something as it is for 1 so i’ve started to do that of late so have lots of spares for other projects.
- Tupperware box
- TP4056 based lipo charge/protection circuit
- 32mm Arcade buttons
- Rotary Encoder
- Rocker on/off switch with LED
- Momentary Metal switch
- 2x 18650 battery DIY battery holder
- Arduino Pro Mini 5v
- 5v RGB LED Strip
arduino – Blinkybox, in category: technology