Can I hack a Christmas tree?

By Les Pounder. Posted

Christmas is here and with it comes a slew of lights, musical cards and animated figures that dance to holiday songs. So what can we hack and is it worth it? We take a look at a dancing Christmas tree that spins, shakes, and sings... for a very long time! We look at the components and the circuit board that connects them to understand how it works and offer suggestions as to how this cheaply purchased decoration can be hacked using boards such as the Raspberry Pi and Arduino. Let’s start with the most accessible part of the tree, the batteries!

Battery Box

Powering the tree we have three AA batteries (1.5 V per AA) in a common battery compartment, which has a space for an on/off switch but sadly none is present. This can be easily hacked in place using a common sliding switch, and this may just save your family’s Christmas! Powering the unit from an external supply is possible as the 4.5 V battery connection is direct to the main PCB (red and black wires.) So using a USB supply is possible, either through a computer or a power bank. USB is 5 V so a little over 0.5 V difference to the stock voltage, not too different to fresh alkaline batteries which can be up to 1.6 V each. You can either create a voltage dropper or run the risk of running the unit at 5 V, which may shorten the life of the tree, but not by much.

Controller PCB

The controller PCB is quite small, but it contains the chips for motor control and music playback. The input that triggers the motor drivers to power the motors occurs when the user presses one of the tree’s hands (cunningly labelled ‘Press Here’). The button is connected on one side of the PCB to the 4.5 V VCC connection and when the button is pressed, the button connects to a Ground pin, which drops the voltage briefly to 0. This input is processed by an anonymous chip on the circuit board, sadly, and as is common with many cheap mass-produced electronics of this kind, the chip is covered in epoxy which protects the identity of the chip. This is called ‘COB’, ‘Chip On Board’, and is used to protect the investment made in the board. You can dissolve the epoxy, but for this object it isn’t worth the time as we can see how the input and output works from the PCB.
As mentioned before, the board also controls music playback, and we get a ‘lovely’ rendition of ‘Jingle Bell Rock’. The speaker is directly soldered to the PCB, which means that the COB has an amplifier built in, lowering the cost of production.
PCB Annotated

Motors

The Christmas tree has two DC motors and across the terminals of the motors are a 100 nF capacitor (printed 104 on the capacitor) used to smooth the current going to the motors. Each motor is offset using plastic guides. The motor at the top controls the ‘wiggle’ and ‘shake’ of the tree; this includes a 90-degree connection that converts vertical motion to horizontal. The lower motor is also offset and is used to spin the tree around, and connects to a central point using a gear. These plastic guides provide simple movement for simple motors.

The motors are controlled by two NY9M006A single-channel motor drivers in an 8-pin plastic SOP (Small Outline Package) chip, and a quick look at their data sheet shows that they are capable of driving motors up to 6 V at an absolute max output current of 1.2 A; ideally these chips would never be pushed that hard and from the data sheet the typical output current at 4.5 V is 0.11 milliamp. If the chips are pushed too hard then they will generate heat, but luckily the chip has a thermal shutdown circuit that will protect it from harm.

insides

Hacking

So can this board be hacked? Short answer: yes. If using an Arduino or another board with 5 V logic, you can connect straight up to the PCB and independently control all aspects of the Christmas tree. So triggering the tree using an ultrasonic distance sensor, PIR or photo resistor is possible, which would be great for an embedded ambush trap to scare your friends, or for interactive displays that run on demand.
If you are using a board with 3.3 V logic, such as Raspberry Pi, micro:bit or ESP8266, then you cannot directly connect to the PCB, as using 5 V logic with the 3.3 V GPIO will cause damage to the pins, and possibly the board itself. To use a 3.3 V board with this Christmas tree we will need to use a bidirectional logic level converter, which can be found online very cheaply. Place one in the path between the PCB and your 3.3 V board and it will buffer and forward on the signal at the correct voltage. Using the tree with boards such as the Raspberry Pi opens up the possibility of internet-enabled Christmas decorations, using technologies such as Node-RED, MQTT, Python, and even Scratch.

So now that you have the knowledge, and the tools, to hack a Christmas tree, have a great holiday time bringing your tree to life using technologies that you already have in your workshop/home.


http://bigl.es

From HackSpace magazine store

Subscribe

Subscribe to our newsletter