Magic Crayons With Scratch and Micro:bit

by Elenavercher in Teachers > 3

2867 Views, 28 Favorites, 0 Comments

Magic Crayons With Scratch and Micro:bit

Magic Crayon in Action!
magic crayons profile picture.png

How magical it is when we use a pencil with a tablet and it works! It's ASTOUNDING as the Gruffalo would say, yes or not?

How are they made? How do they connect? Would it be possible to create one?

Those are the questions we asked in class, and we agreed that we would be able to do one using Scratch and micro:bit. As we all love Harry Potter, using an apparent normal device and giving it the magical aspect of appearing in a screen, was something we felt that was amazing, just as creating a magic wand that interacts with the digital world or a bonfire that starts its fire when we tell them through our wand. Today it has been the moment when we have coded a physical crayon with Scratch so that it could draw on the screen. If you want to know how we did it, keep reading! ✨✨✨

Supplies

Magic crayons - materials.png
IMG_5291.JPG

We will use the following materials:

Creating Our Interactive Crayon

IMG_5300.JPG
IMG_5301.JPG
IMG_5302.JPG
IMG_5295.JPG

We need to attach the micro:bit to the crayon using two rubber bands. Once we have it, we should fix the battery so that it won't move, and it won't affect our digital drawing.

Design the Scratch Sprite in Canva

Design a crayon and a rubber in canva for Scratch

We will start our digital and magical adventure by designing our own sprites for the Scratch programming using Canva.

We will choose an A4 project, and add a crayon and a rubber and edit them until they meet our needs.

Finally, we will export them as a .png file without the background. If we forget this step, we can always remove it using the Scratch app.

Getting Started With Scratch and Download the Pen and Microbit Extensions

1 Download the pen and microbit extensions

We create a Scratch project and insert the extensions called: PEN and MICRO:BIT. We should also connect at the same time the micro:bit with the USB cable. You can follow this instructions if you need them: https://scratch.mit.edu/microbit.

We need to upload our objects (sprites), previously created in Canva.

Code the Pen With the Pen and Micro:bit Extensions

2 Code the pen with the pen and micro:bit extensions

Now it's the moment to start coding the crayon. We will use the micro:bit's accelerometer so that it will detect our crayon's movement and, when we tilt it to the left, the digital crayon will start drawing to the left. Once we've coded left/right and front and back, we will see that it mimes really nicely our physical crayon movement.

Code the Rubber

3 Code The rubber

We will need a rubber so that it will erase everything we have done, if we need to.

We will code it so that when we shake the crayon, it will erase the screen.

Modify the Crayon Programming So That It Disappears When the Rubber Appears

4 Modify the crayon programming so that it disappears when the rubber appears

Now we will see that the crayon is still writing while the rubber is there, we should modify our code so that it will hide when we shake the micro:bit.

Center the Crayon

5 Center the crayon so that the part that will colour will be the bottom part

In this step, we will center the crayon at the costumes tab. We need to mime our crayon, so we will need to place the crayon's bottom in the center part of the sprite, so that the part that will colour our screen will be the bottom part.

Edit the Sprite by Changing Its Colour

6 Edit the sprite by changing its colour

Now we can colour our sprite so that it looks alike to our crayon... or completely different, it's up to you!🥰✨

Make Sure That the Position of the Rubber and the Crayon Are Set

7 Make sure that the position of the rubber and the pencil are set

We should check that our sprites are facing upwards the whole time, miming as much as possible our crayon.

Add a Different Colour

8 Add a different colour

Now we can add a different colour by duplicating our crayon and changing the event that triggers the crayon to start drawing. We can use one of the micro:bit's buttons.

Code the Purple Crayon and Modify the Code of the Blue Crayon and the Rubber

9 Code the purple crayon and modify the code of the blue crayon and the rubber

Now we need to slightly modify our coding so that they will all hide when the purple crayon is writing and the other way around.

And Now Make Sure That Everything Works As You Like!

10 And now make sure that everything works as you like!

Et voilà! Now you can finish checking that everything works great. Here is an example of the project we created: https://scratch.mit.edu/projects/749828134.

Personalize It As Much As You Like ✨

11 Further possibilities
IMG_5292.JPG

Now that you have your magic crayon, it's the moment to expand it's possibilities! You can add a random image and text generator to give you ideas of what to draw, you can also add a welcome message when we start using it... the floor is yours!

Can't wait to see what you create with it! Please, keep sharing your creations, thanks a million!🥰✨✨✨