Project 02: Mixer

2-1

1. Overview

Mixer is a kind of construction engineering machinery, which is mainly used for mixing some building materials such as cement, sand and gravel. In this project, we will seek to design a mixer.

2. Components

Img

Img

Img

Kidsuno Mainboard×1

Digital Capacitive Touch Sensor×1

360°Servo×1

Img

Img

Img

Connection Wire×1

USB Cable×1

Lego Series×1

Img

3. Installation

Preparation:

Img

Step1:

Img

Step2:

Img

Step3:

Img

Step4:

Img

Step5:

Img

Step6:

Img

Step7:

Img

Step8:

Img

Step9:

Img

Step10:

Img

Step11:

Img

Step12:

Img

Step13:

Img

Step14:

Img

Step15:

Img

Complete:

Img

4. Read the Value of Digital Capacitive Touch Sensor

Img

5. Programming Steps

Step 1:Wiring Diagram

Connect the kidsuno mainboard and computer via a USB cable, and connect the digital capacitive touch sensor to the No.2 interface, the 360° servo to the G, V and D13 interface of the mainboard. The brown wire is connected to G, the red wire is connected to V and the orange wire is connected to D13.

Img

Step 2: Description of Building Blocks

Img

The block is used to set serial baud rate(generally, the baud rate 9600 is taken as an example)

Img

This block is used to set print mode for the serial port. warp means line feed printing, no-warp means no line feed printing, HEX means hexadecimal printing.

Img

It is used to read the digital signal(0 or 1) of the specified pin

Img

This is a command block used to set “input” or “output” to the specified pin. “input” means input mode; “output” represents output mode; “input-pullup” means setting input mode for the pin and making the pin become high level (1).

Img

This is a command block used to set “high” or “low” to the specified pin. “high” means high level(1),LED will light up, “low” means low level(0),LED will light off.

Img

It is a delay module and 1 can be altered.

Img

It is a forever module, it will execute one code forever.

Step 3:Write the Program

① Drag the instruction block Imgin the Events module to the script area.

Img

② Drag the instruction block Imgin the Serial module to the script area and take the baud rate 9600 as an example.

Img

③ Drag the instruction blockImg in the Pins module to the script area. Since the digital capacitive touch sensor is connected to D6 of No.2 interface on the mainboard, then change the number 0 to 6.

Img

④ Drag the instruction block Imgin the Control module to the script area.

Img

⑤ Drag the instruction blockImg in the Serial module to the script area.

Img

⑥ Drag the instruction block Imgin the Pins module to the script area and put it into the block Img, then change the number 0 to 6.

Img

⑦ Drag the instruction block Imgin the Control module to the script area and change the number 1 to 0.2.

Img

⑧ Complete Program

Img

Step 4:Test Result

ClickImgto upload the complete program to the kidsuno mainboard and power up, then click Img in the serial monitor area to set the baud rate to 9600. Then the serial monitor will print the value read by the digital capacitive touch sensor.

When your finger touches the plum-shaped metal sensing area on the sensor, it will output a high level (1); when released, it will output a low level (0).

Img

6. Digital Capacitive Touch Sensor Controls Mixer to Rotate

Img

7. Programming Steps

Step1: Description of Building Blocks

Img

It is a conditional statement code executing if-then-else function: If the logical judgment statement in Img is satisfied, the code statement below then is executed, otherwise, the code below else is executed.

Step2:Flow Chart

Set the 360° servo angle to 90°. When you press (or touch) the metal sensing area on the sensor with your finger, the servo and the mixer will rotate, otherwise they won’t rotate.

Img

Step3:Add Servo Instruction Block

Img

Step4:Write the Program

① Find building blocks

(1)Img

(2)Img

(3)Img

(4)Img

(5)Img

(6)Img

② Complete Program

Img

Step5:Test Result

ClickImgto upload the complete program to the kidsuno mainboard and power up. When you press (or touch) the metal sensing area on the sensor with your finger, the servo and the mixer will rotate, otherwise they won’t rotate.

2-9

10. Expansion Project

Img

The sample code is below:

Img