Ultrasonically controlled Christmas tree

A couple of my IoT students are planning on designing and building a flow to control a strip of RGB lights on a Christmas tree (using a distance-value from an ultrasonic distance measuring device HC-SR05).

Here's a very rough sketch of the ideas discussed during their first session.

Project plan and progress diary

They discussed the idea of changing the colour of the RGB strip as you walk nearer to the tree or changing the brightness of a single colour. Maybe if they have enough time I'll encouage them to do both!!

This might be the first Christmas tree that has two IP addresses (ho.ho.ho. merry & ho.ho.ho. christmas ).


This might be the first Christmas tree that has two IP addresses (ho, ho, ho).

shouldn't that be ho.ho.ho.merry and ho.ho.ho.christmas :christmas_tree:


Here's an update on this project.
The students, working on this project, have just made a video of their working Christmas tree.

Video of the ultrasonically controlled Christmas tree in ACTION

Merry Christmas to everyone who stops-by and reads this post.


Very nice. I like the video. Well done.

Being new to Node-RED, I'm having a bit of trouble figuring out how you would do this using NR... I know how it could be done using the ultrasonic sensor, the neopixel LEDs plus an Arduino or ESP8266, but no idea how it would be done using Node-RED.

Could you please post the flow or a picture of the flow?

Inquiring minds want to know... :slight_smile:


Hi Jon,
I'm away from home at the moment, so can't post the flow.
I'll do that when I get home in the New Year.

Basically the students hooked-up a HC-SR05 ultrasonic distance sensor to a Wemos D1 Mini, flashed with ESP Easy. Distance readings were sent via MQTT to Node-RED. To reduce the amount of traffic a reading was only published if it was different to the previous one.

Node-RED took the reading and compared it with various distance-values. The results were sent to the MagicHome node to control the colour of the strip of RGB LEDs.

The students were planning on rigging up a second set of lights that used a single colour but changed the intensity as you got nearer to the tree, but ran out of time.

Hope that helps.