Close

Adding the push buttons

A project log for Board for modular LED wearables

Board design which makes it easy to attach LED light strips (APA102). No soldering is required by the maker who is using this board

Sander van de BorSander van de Bor 03/05/2019 at 02:510 Comments

The original board, using the ATSAMD21G18A, had tons of I/O pins to work with (38 actually), and was using only 1 data line for the LED's. Adding inputs was not an issue since most pins were not used anyway.

This ATtiny84a board has less I/O pins (12 only), and most of the pins are assigned already as follows:

Using 11 pins, leaving me with only 1 pin for an input, and I want 5!

I could charlieplex 3 pins to create 6 inputs, but that requires diodes and just makes it more complicated.

So in order to get to my 5 inputs I had to combine inputs with other features. The reset is used when programming the board with a SPI programmer, but with Micronucleus installed I no longer need it, so that will be my second input. The indicator light can be combined with an input, so that is the third, and I decided to use the USB lines for my last two inputs.

The USB is tricky, because it has pull-up resistor in the D- line, some Zener diodes to ground and some resistors to the USB port itself. The pull-up resistor is on pin#10. After making all pins inputs with pull-up resistors the program was acting up. It was reading an input from pin#10 constantly while plugged in on the USB. I tried setting the pin high (might burn out the pin) and that made it a little better. Fortunately it was all working fine after unplugging the USB cable, and since this is a wearable, it is no issue when the inputs are not working while plugged in.

Second problem was the use of delays in the original code. it is impossible to read the input pins while the sketch is using the delay, and this should be replaced by millis() instead. Adafruit has a great tutorial on this here.

This tutorial is using the Neopixels, but just some small changes were required to make it work with the DotStar (APA102) used on this project. The entire code can be found here on Github.

Discussions