Lego Wedo Christmas Tree

In The Christmas Spirit – Lego WeDo 2.0 Christmas Tree

Share this!

We’re getting into the Christmas spirit already, and Liam has designed and built a Christmas tree with Lego WeDo 2.0. He’s used the motor and motion sensor for this WeDo project, and got them working together really well. Have a look at the video below, and then get into making your own.

What is Lego WeDo?

Lego WeDo 2.0 is Lego’s entry-level robotics & coding kit, designed for the education space. The core kit comes with a smarthub, motor, tilt sensor and motion sensor, plus a range of gears, wheels, axles and bricks to create a wide range of projects. As you would expect, it’s compatible with all the standard Lego and Technic components.

Alongside the kit comes the Lego WeDo 2.0 app. The app contains instructions for heaps of WeDo projects, and an image-based coding platform that communicates with the smarthub via bluetooth. For us, a big benefit of having the project instructions within the app is that they’re all in one place, and they can’t get lost or damaged. The app is a very big download, just under 500MB, but once you’ve got it installed, it’s very easy to set up and get started.

Build the Lego WeDo Christmas Tree

Ok, so into the building. The gears are a little bit complex, but once you’ve got them sorted, the rest goes really smoothly. To make it super easy to build,

Lego Wedo Christmas Tree Model
FREE LEGO WEDO 2.0 INSTRUCTIONS

Build Liam’s Lego WeDo 2.0 Christmas Tree

We’ve put together a full set of free Lego WeDo 2.0 instructions for you. You can build Liam’s Christmas Tree today!

Using the Ledo WeDo 2.0 app vs Scratch for coding

The Lego WeDo 2.0 kit comes with an app for pictorial coding, which lets you get your projects up and running quickly. The platform is very simple to use, with blocks aligned side-by-side in the sequence you want your project to execute the instructions. A range of inputs can be used, including from the tilt sensor, motion sensor, noise sensor (from your devices microphone), or from the ‘go’ button. In terms of outputs, the motor can activate, a display can show on your devices screen, or the colour of the light on the smarthub can change.

There is limited complexity that can be achieved within the WeDo app, as it’s designed for simple instructions and getting started. If you want to start coding more complex actions, consider using Scratch instead.

Scratch is a block-based coding platform, which has the ability to integrate with a wide range of hardware options including Lego WeDo, Mindstorms and Boost, BBC microbit, and Makey Makey. Importing the custom blocks for Lego WeDo lets you combine them with standard Scratch blocks to extend what you can do.

Coding the Lego Wedo Christmas Tree

For the Lego Wedo Christmas tree, Liam used the Wedo app. He is absolutely powering through his coding in the app right now. In fact, he’s putting the adults in the house to shame! To get this working, you’ll need to create two pieces of code. The first sequence will make the Christmas tree turn, and the second will control the light on the smarthub.

To start both sequences, swap the green arrow block for the keypress block. This is a really efficient way of building your code when you want the smarthub to execute more than one instruction. When you press the green arrow block, it only runs the code sequence that it’s directly attached to. If you have multiple lines of code, you have to activate each block separately. It makes far more sense to click once, and run everything. That’s what the keypress block can do. When you place it in front of multiple sequences, it will activate all of them.

Make the Christmas tree spin

To start, we want to make the tree spin, but slow down when you move your hand towards the motion sensor. Making a project that’s interactive is so much fun, and you’ll find that both kids and adults want to have a go.

Code the spinning motion of the Christmas tree

Now that you’ve got a good starting block, add your motor direction block. At this stage, it doesn’t matter which direction you set the motor to. The motor is driving the worm gear, which in turn drives the 24-tooth gear. Under the tree, the 12-tooth double bevel gear pairs with the 20-tooth double bevel to create the turning motion. When you come to test the code, you can change the direction of the motor if you want to.

Having added the block to set the motor direction, let’s also set the speed. This is where you’ll use the input from the motion sensor. Grab the motor speed block, and remove the number input from the bottom. Drag in the orange motion sensor block, and place it under the motor speed block. What you’ve achieved here is that the speed will increase when an object moves further away from the motion sensor. And conversely, it will slow when something comes close. Add a loop around the sequence so that it keeps going continuously.

Make the smarthub light up

This is a fun extra piece of code that brightens your project. It’s very quick to add, and you can customise the colours if you want.

To make the colours display randomly, start by dragging the smarthub colour block into your code. As before, attach it to a keypress block so that it starts at the same time as the motor. Remove the block underneath that displays number 1, and replace it with the dice picture. This is like deciding the colour every time by rolling the dice. Put it into a loop to keep the colour changing regularly.

Light up the smarthub with random colours

If you would like to pick the colours, there’s an easy way to do this too. Simply add another smarthub colour block next to the first one. You need one block for each colour, so if you want 3 colours, line up 3 blocks. Below each block, click on the number. This will open up the list of colours at the bottom of your screen. Choose the colour you like for each block separately. Then, add a loop around the blocks to keep the sequence rolling. In this example below, we’ve set the smarthub to flash red-green-red-green.

More Lego WeDo 2.0 projects

If you liked this Christmas tree project, why not try some of our other Lego WeDo projects?

Share this!

Similar Posts

2 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *