In my previous column, I explained how -- as part of a hallway redecoration project -- I decided to embed NeoPixel strips from Adafruit in the skirting boards.
The next step was to create a control system and power supply unit (PSU). For this project, I decided to use an Arduino microcontroller development platform as the controller, because this was the microcontroller I'd already been using with my earlier NeoPixel experiments.
Mounting the controller and power supply
The Arduino and associated shield sit inside a double-gang dry liner box. The controls and LCD display are mounted on a double-gang blanking plate.
The power supply sits inside a plastic box surface mounted inside the hallway cupboard, out of sight. It's just behind the controller with interconnecting wires running through the drywall.
The DC power and signal wires run down the wall inside the cupboard, behind the door architrave, and into the drywall to meet with the wires running around the room.
The controller is made up of the following main parts:
The rotary encoder has a built-in push button, which is used to put the system into and out of standby. Standby shuts of the power to the NeoPixels by way of a Beefcake Relay Control Kit from SparkFun. The relay is capable of switching 10 amps, but I wasn't happy with the contact bounce because I felt it would ultimately harm the NeoPixels, so I sourced a solid state version from Farnell Electronics (a.k.a. Element14) and swapped out the relay. Now, when powering-up, I see far less noise and the pixels don't seem to flash like they did with the original relay.
The contact bounce on the rotary encoder was quite bad, and using capacitors and pull-up resistors across the two outputs wasn't enough to clean up the signals. I had read an article a few months back in Everyday Practical Electronics magazine regarding rotary encoders and the use of de-bounce chips, so I decided to employ one. The article recommended the MC14490P. These were in short supply, with long lead times in the UK, so I ended up ordering them from Futurlec in the USA. As it turned out, they were actually shipped from China and I got slammed for import tax at about three times the original cost of the chips. I challenged UPS about this and they subsequently dropped the charge. I also used the chip to de-bounce the push button. In hindsight, I would look to use a better filter on the encoder outputs and do away with the chip.
I used both of the Arduino interrupts -- one for the standby button and the other to detect rotary encoder movement. (I ANDed the two rotary encoder outputs and fed the output from the AND gate to the second interrupt.)
The LCD display uses six digital I/O (input.putput) pins, plus an additional pit to control the backlight. Another digital I/O pin is used for the encoder LED. The encoder LED is common anode, and the anode pin is also common to the push-button. This means I have to use a pull-down resistor for the push button's open contact. The four potentiometers are wired to four of the analog inputs, with 0V and 5V connected to either side of the potentiometers' wipers. The power is supplied to the Arduino through stripped-back USB cable. I was tempted to power it through the 5V pin, but I read somewhere that it's possible to damage the Arduino that way. I have yet to draw a schematic of the circuitry, but hopefully my description above paints a reasonable picture.
To Page 2 >