"It’s Here! The BFCM Sale of the Year – Grab Your Favorites!"

Micro:bit Simple Remote Gripper of Manipulator

Materials

micro:bit x 2

Nezha expansion board x 1

Joystick:bit V2 x 1

360° servos x 3

Bricks x N

AAA battery x 2

Hardware Connection

Connect the micro:bit to the Nezha expansion board and connect the three servos to S1, S2 and S3 accordingly.

Bricks build-up

Build them as the picture shows:

Software Programming

Go to MakeCode editor:(https://makecode.microbit.org/#editor

Add the Planet X package by clicking the settings on the right upper side.

Search with “Joystick:bit”to add the package.

Add Nezha package in the same way.

After completing the packages, go the the coding page:

Remote control end:

Initialize the Joystick:bit and set the radio group in 99 in the on start brick.

Judge the detected value of the joystick:bit, if the returned value of X is less than 200, set the radio send number as 1; If the returned value of X is over 800, set the radio send number as 2; If the returned value of Y is less than 200, set the radio send number as 4; if the returned value of Y is over 800, set the radio send number as 3.

Judge the status of the button C and D, while button C being pressed, set the radio send number as 5; while button D being pressed, set the radio send number as 6.

Completed Code:

Link:https://makecode.microbit.org/_HMM76eAYCLRa

Gripper of Manipulator

Create variables X,Y,K and set the value all in 180, then set the radio group as 99.

Save the received number as the variable i.

In the forever brick, judge the value of the variable “i”, if it’s 1, set the value of the variable “x”as “x-1”, then judge if the value “X”is less than 0. If yes, set “x”as 0. After that, set the 360° servos connecting to S3 to rotate with the equivalent angles given by the value of “x”. Make sure if “x”is less than 0, the servos get back to 360° from 0°.

Program in the same way to control the movement of the gripper.

Judge the value of the variable “I”, if it’s 5, set the 360° servo connecting to S1 to rotate to 270°; if it’s 6, set the 360° servo connecting to S1 to rotate to 180°.  After that, set the variable‘i’as 0, make sure if there is no new signals being updated, it repeatedly executes the former code.

Completed code:

Link:https://makecode.microbit.org/_1Ug0UrWmHE8y

Result:

It is able to control the movement of the gripper such as rotation, lift up/down, gripping or loosen by the Joystick:bit or the button C&D.

Leave a Reply

images
In March, ELECFREAKS supported 5 schools to carry out school science and technology festival activities
images
Children’s Programming Education is the Future Trend
images
Technical verification! Nezha series products can complete WRO competition tasks
images
Let's take part in the Ceremony of the New Factory of ELECFREAKS together!
images
Bluetooth Bee(HC-05 and HC-06) User Guide
images
In March, ELECFREAKS supported 5 schools to carry out school science and technology festival activities
Monthly Archive