Merry Boxes & LEDs

Enter Your Project for a chance to win a Maker Tool Kit, an Oscilloscope Grand Prize for the project that brings the Most Joy to the Heart, and Gift to Gives!

Back to The Project14 homepage

Project14 Home
Monthly Themes
Monthly Theme Poll


I spent a fair bit of time today trying to figure out what was going on with the motion sensor on Tree 1.


I tried a few things, starting with switching the Wemos itself, and it turns out that when I use the Wemos from the working tree, Tree 1 does work properly.

So it's not the tree itself or the wiring around it, or the PIR sensor. That's a good thing.


Here is a video of me testing the PIR sensor directly, powered by the breadboard power supply. It works nicely.


Then I thought maybe I had shorted something out and broken the Wemos board, but further testing showed that switching input pins made no difference, and I could set the inputs directly to GND or to 3.3 volts, and it would read correctly.


The motion sensor does require 5v input power, with minimum of 4.5v, so I thought I'd compare the two Wemos boards. They have pretty much identical voltage showing at the 5v pin. Actually a little low - 4.69v, when powered from my Mac. Yet one works, and the other doesn't!

So I decided to directly power the board with a USB charger instead, but alas, it still did not work.


A video showing my pain:


The sketch running on the Wemos is just one that does serial coms for debug, and checks for PIR input. However, if you look carefully the PIR sensor wire is only going to the multimeter, and thus the GPIO input is always just 10k to gnd. In short - the Wemos is only used to power the PIR sensor at this point.


As you can hear me say in the video, I was thinking of just giving up on the motion sensors altogether and just using a pushbutton instead. That might actually make more sense in real life use anyway.


The other thought I had is that PIR sensors can be sensitive to interference (so they say on the internets, it may or may not be true) - maybe this difficult Wemos board was causing more interference than the other?


Then I had a thought... The official Raspberry Pi power supply provides a slightly higher 5.1v, maybe that gives the PIR sensor that little extra edge to work?

And lo and behold! it works! Kinda surprised me at this point, actually.


So it appears that, annoyingly enough, the PIR sensor should probably not be powered by the Wemos 5v pin. I thought it was a direct connection to the USB input, but I wonder if there's something else in the way.

In general, the whole setup should probably provide power to the tree and the sensor separately from the power supplied to the Wemos. But that's beyond the scope of this project.


So I will reassemble Tree 1, upload the Connected Trees sketch back on it, add some nail polish to the connections, and then make it all look pretty... and I'll make sure to use the RPi power adapter for the difficult Wemos.


I'm not entirely happy with the finicky results, but for now this will have to do. If we do end up using this "in real life" next Christmas, I'll probably just switch it to use pushbuttons instead.


Here's a picture of the solder joints with dollar-store nail polish protecting the joins. I ended up buying a pack just for the red and green in it, and it turns out the rainbow of colours works well here!


nailpolish on solder joins



Here is a quick sketch of the schematic that I used to keep things straight in my mind while soldering. The input pins have since changed a little (pls see the source code for the updated numbers).

Connected XMas Trees Schematic rough sketch

Note that in this sketch "Tree 1" and "Tree 2" refers to the two wires going to the trees, not to separate trees. I probably should have written it more clearly, like "Main Tree" and "Tree top LED". The transistors are basic NPN 2N2222a.






Previous posts:

Connected Christmas Trees

Assembling the Trees

Finally! Two Trees Assembled

Two Trees by a Tree

Connecting the Tree to the Internet

Motion Sensor on Wemos

Trees! one with motion sickness...


Next posts:

The Connected Trees are Working!

Merry Boxes - A Project Within a Project

Connected Christmas Trees - Finished!