【DIY Project】--- Color Sorter - Yahboom

This is a very environmentally friendly DIY work based on BBC Microbit and MakeCode graphical programming, which is very suitable for children to play and learn programming together at home. If you have a kid at home, take him or her to complete this funny project.

Preparation

BBC Micro:bit *1

Expanding board *1

Steering gear *1

Color recognition module *1

Colorful blocks  *1

Waste cardboard *1

Working principle

When the color recognition module recognizes different colors, it controls the steering gear to rotate to different angles, and drives the color blocks to different areas through the rotation of the steering gear.

Hardware connection

The color recognition module uses IIC communication, but the items cannot directly connect the module to the Micro:bit board through alligator clips or other methods, so we need to use an expansion board.

Of course, if you don't have the exact same expansion board as mine, that's OK. As long as your expansion board has led out the IIC interface, you can connect the color recognition module.

Code

As shown below.

 

Initially set the servo to rotate to 90 degrees (middle position)

Determine whether the currently identified is blue.

If the sensor module detects the RGB value and the B value is the largest, it means that the blue building block is recognized.

Turn the servo to 40 degrees (just enough to bring the blocks into the blue box area)

In the case of the largest B value, if the G value is greater than 100, it means that yellow is detected.

Turn the servo to 150 degrees (just enough to bring the blocks into the blue box area)

We chose yellow and blue building blocks for this project. If you want other colors as props, you need to modify the code.

Project link:

https://makecode.microbit.org/_YsAVqD8AxLfe

Addition of Block for MakeCode

Since it is a robot car that extended Micro:bit, it can block coding with MakeCode.

How to add Yahboom block

Please access below and click "New Project"https://makecode.microbit.org/

Click the setting icon -> Extension

Enter the following library link and click Search

https://github.com/lzty634158/Croco-Kit

Extension block is added.

Phenomenon 

 

 

Diy works

Leave a comment