×

Warning

Error loading component: com_tags, Component not found.

The origin of the project

The original idea for this project was to have a cheap driver for my girlfriend’s companion cube lights, and then of course, my mind started thinking of some of the possibilities, what if it could run from a single AAA battery and power it all (the micro and neopixels), make it customisable so it can be programmed via USB, and the list went on. I floated some of the ideas with my girlfriend and we realised that we might be able to sell the boards. We could also use it for some of our costumes and a costume tail she’s being trying to sell. On one of my long commutes to work, I finally started into some of the ideas and thus this project actually started. One of the main elements of this project was also something of an unknown for me; this would be my first board where I had to handle the power supply and not just by using LDOs (low drop out regulators) as that wouldn’t work in this case.

Powering neopixels from a single AAA battery

The first hurdle was actually getting a booster circuit so I could power the LEDS from a AAA battery; it’s also one of those knowledge areas where no one has actually talked to me about it. After looking at linear technology and texas instruments, I decided the best option was a TI TPS61027 IC, with a minimum 0.9V input voltage and output 5V. While looking through the datasheet, I discovered the first limitation of my idea, the IC can only supply 200mA out at that input voltage, almost enough to run 4 neopixels at full brightness. A higher input voltage is needed to get more current, so more batteries have to be added. But it’s not a huge problem in the end, for some things like the costume tail only need 4 neopixels, and the IC specs might be able to be pushed to run all at full brightness while the microcontroller is sleeping. I also picked another IC which looked like it could be used for the same purpose and ordered samples of both ICs.

Driving the neopixels

Since part of the goal of this project is to have a cheap board for costumes and for people to buy once development is finished, I wanted to try to limit the bill of materials including PCB to around $5 or so. Since the cost of the TPS61027 and related components in single quantities almost takes the half of the budget for each board, there isn’t much left for the micro and last couple of components for the actual neopixel driving aspect of the project.

My first thought to try to have all of the features that I wanted was to use something similar as Adafruit’s trinket, but slowly discovered there were both IO restrictions of this project and hardware limitations using the ATTiny85. The first thing I discovered was that the USB aspect of the project takes a lot of resources of the ATTiny85 and while this wasn’t unexpected, it doesn’t provide a great solution in the end with another program required on a computer to make a virtual serial port, this didn’t sit well with me personally. Trying to keep the low cost and USB requirements, I found another microcontroller (STM32F042) which had actual USB hardware built in, but hasn’t been released as of yet and don’t know when it will be at this stage or how much it will cost in single quantities. Eventually I decided to make the decision to drop the USB requirement, but wanted to try to keep it programmable somehow. Once I had determined how people could interact with the device including powering it off and on, and changing modes, I could reintroduce the programmable aspect.

Ensuring it’s useable

For me, one of the hardest things was the limited number of IO that the ATTiny85 has to offer, coupled with the fact I wanted anyone to be able to reprogram it without the need for a high voltage ICSP (In-circuit Serial Programmer) meant that the reset pin could not be used, something that would have made my life easier. This limited me to either changing to a different microcontroller with more IO or working with 5 GPIO (general purpose inputs/outputs). I decided to think about it for a while, something which actually took me 2 weeks to think about. Eventually I decided to continue on with the ATTiny85 as I could use the pins for a few different purposes at the same time without having a lot of trade-offs. I originally wanted to hold the power button low when the battery was running out of juice, but if I wanted to over-ride this feature, it wasn’t going to be possible to tell if the power button or the low battery indicator was triggering the signal, so had to use separate IO for this.

The next challenge was I needed to provide a signal to a MOSFET to provide the enable pin with the battery voltage to enable it, the best way to do this I determined was actually to use the same pin used for the power button, by having it with a pull up resistor, I could pull the gate of the MOSFET high and pull it low easily enough, I could also use the button to pull it low via another MOSFET connected to the power button and another MOSFET also connected to the button to provide the initial push to either turn it on or keep it on. This should enable me to consolidate 2 signals into 1 pin and not affect the design, or at least I hope, as this hasn’t been tested as of yet.

The last 2 features were now easier as I still had 3 IOs left over. A single pin could be used for the mode switch; just pulling the pin low for the feedback. With only 1 IO needed to drive the NeoPixels, I decided to add the ability to drive a 2nd string for different type of effects such as colour wiping different strings at different times. I could have made my life a little simpler if I only stuck to a single string, but I had thought earlier that it would have been good to fit in the ability to drive 2 strings. The next feature was possibly the easiest to fit in once the all the pins had been decided.

Making the Tiny Driver programmable again

While USB was off the cards for the ATTiny85, I still wanted a way to program the board, and there is a serial peripheral built into the ATTiny, but it has a drawback. Mainly it doesn’t actually implement something like SPI, I2C or even UART in the hardware, it’s fairly generic but it does work well enough for what I had in mind which was to implement UART so you can program a new configuration or read back the current one.

Originally I had thought with the pin out, it might not be possible to read back the configuration but worked out that if the UART signal is timed slowly enough, one of the strip pins could be used. The mode pin and the 2nd strip pin are used for Rx and Tx respectively; It’s assumed that the user won’t press the mode button after it goes into this programming mode. Later at some stage, I plan on making a python program for programming the driver, but for now, just concentrating on the main task of getting it working first.

Starting to prototype the driver

I wanted to make sure the schematic was correct before laying out a PCB and wanted to breadboard the design. The first problem started with the boost IC, as it does not come in a breadboard friendly package, so a breakout board is needed for it. I could have possibly got other aspects working, but initially the boost circuit is the main thing that I want working before continuing with the rest of the design. I made a simple board using KiCAD and a member at CCHS etched it for me with a little bit of copper between the pads. After carefully cutting between all the pads, the IC was soldered onto the board and then the board soldered onto a vero board as I put the socket pins 420 mil apart instead of 400 mil apart (DOH!).

After a quick check with a multimeter to see if any pins were connected together, the chip was put into the breadboard, connected up, a battery connected and…. Nothing. After several more attempts at trying to get the boost circuit working, I noticed the chip was hot, never a good sign. Thinking I must have somehow fried it although not knowing exactly how, I decided I needed to replace the chip with a new one.

Another trip to the hackerspace and I finally worked out the cause of the problem. After I soldered another chip and finding that it was heating as well; I discovered that the part marking didn’t match what TI said it should be (the first 3 letters are defined). After some head scratching, I decided to open the other sealed packet and check the other boost chip that I had requested samples of, discovering those chips did have the markings I was expecting, not sure if that IC family had the same markings or not, I looked up that part number’s markings and discovered that somehow the 2 different chips had been swapped in the bags. After laughing to myself and finally using the correct IC, I verified that the chip was working for at least a few seconds, good enough for me!

Later that day, I decided to try to get the enable circuitry working with a mosfet, and when I plugged in the batteries, I immediately started to notice the smoke rising from the IC. Inspecting the circuit later, I couldn’t actually work out what happened until I looked at the data sheet. The MOSFET output was below the high threshold of the boost controller, which I believe placed it in an unknown state causing it to smoke. I can’t verify this without potentially smoking another IC, but it’s my best guess as to what happened. The low voltage is in part to the low value pull down resistors I was using, something I didn’t think would affect the output voltage through the MOSFET, but things aren’t exactly ideal. Bugger, well that requires another trip to the hackerspace to put on a new chip.

After burning the PCB with the hot air station, accidently ripping off a trace trying to get the chip soldered correctly (I tied it to another pin which is luckily valid for this chip) and a quick test, I’m ready to try again! Hopefully not burning a hole in the IC again, now only have this chip and one more left. More updates to come as I prototype this circuit, finalise values and circuitry and after a little bit of programming and layout, send off the PCB design.

Current BoM as it stands

Item Description
Qty
Unit Cost
Sub-Total
Boost IC (TPS61027)
1
$ 2.30
$ 2.30
ATTiny85 Microcontroller
1
$ 1.55
$ 1.55
6.8uH Inductor Coil
1
$ 0.47
$ 0.47
Tactile Switches
2
$ 0.20
$ 0.40
2.2uF Capacitors
1
$ 0.12
$ 0.12
10uF Capacitors
1
$ 0.20
$ 0.20
47uF Capacitors
1
$ 0.57
$ 0.57
Resistors
4
$ 0.05
$ 0.20
MOSFETs (Dual N-Channel)
2
$ 0.13
$ 0.26
PCB
1
$ 0.50
$ 0.50
Total
$ 6.57