|
|
|
|
|
|---|---|---|---|
|
kidsIOT Mainboard×1 |
Ultrasonic Adapter Board×1 |
Ultrasonic Sensor×1 |
Servo×1 |
|
|
|
|
|
|
Wire×1 |
USB Cable×1 |
Automatic Feeding System LEGO Pieces×1 |


Process 1:

Process 2:

Process 3:

Process 4:

Process 5:

Process 6:

Process 7:

Process 8:

Process 9:

Process 10:

Process 11:

Process 12:

Process 13:

Process 14:

Process 15:

Process 16:Initialize the servo angle
Wiring of servo 
First write the following code in KidsBlock software and upload the code to the kidsIOT mainboard, then the servo will rotate 190° . (Note: If the servo can not rotate, you can press the RESET button on the kidsIOT board.)

Process 17:

Process 18:

Process 19:
(Note: Do not twist the servo)

Process 20:

Process 21:

Complete

|
Module |
kidsIOT Mainboard |
|---|---|
|
Ultrasonic Adapter Board |
No.9 port(Trig–io18,Echo–io19) |
|
Servo |
G/V/io33 port(Brown→G,Red→V,Orange→io33) |
|
Ultrasonic Sensor |
Ultrasonic Adapter Board |
|---|---|
|
Vcc |
VCC |
|
Trig |
Trig |
|
Echo |
Echo |
|
Gnd |
GND |
Connect the kidsIOT mainboard to your computer via USB cable.



Set the servo’s channel and output (rotation) angle to the specified PWM pin.
① Set the pin IO33 (control pinio33) connected to the servo to “Output” mode.

② Initialize the control channel of the servo to CH2 (LT1) and the initial angle to 190°, with a delay of 0.5 seconds.

③ The servo rotates from 190° to 120° and then to 60° every 0.5 seconds.

④ Complete Program

Click
to upload the above complete code to the kidsIOT motherboard, then power up via the USB cable, then servo will rotate.

Tap the “Sensor” module in the “Extension” , then select “Ultrasonic Sensor” and click
to return to the programming interface.




This block is used to measure distance to the specified pin, and the distance unit can be cm or inch.
① Set the baud rate to 15200.

② Set the Trig pin of the ultrasonic sensor IO18 to “output” mode, and the Echo pin IO19 to “input” mode.

③ Set Trig to IO18 and Echo to IO19, and the serial port prints the distance value detected by the ultrasonic sensor at 0.1 second intervals.

④ Complete Program

Click
to upload the above complete code to the kidsIOT motherboard. After powering up via the USB cable, click
in the serial monitor and set the baud rate to 15200. Move your hand in front of the ultrasonic sensor. When you are close to it, the displayed distance value becomes smaller. When you move away from it, the value becomes larger.



① Set the baud rate to 15200, the Trig pin of the ultrasonic sensor IO18 to “output” mode, and the Echo pin IO19 to “input” mode.

② Set the pin IO33 connected to the servo to “Output” mode, initialize the control channel of the servo to CH2 (LT1) and the initial angle to 190°, delay 0.5 seconds.

③ Define a “Distance” global variable to store the distance value detected by the ultrasonic sensor.

④ Set the Trig pin and Echo pin of the ultrasonic sensor, and print the read distance value of the ultrasonic sensor on the serial port.

⑤ Determine the distance detected by the ultrasonic sensor. If 2cm < distance value < 7cm, the feed box will be opened; otherwise, it will be closed.

⑥ Complete Program

Click
to upload the above complete code to the kidsIOT motherboard. After powering up via the USB cable, click
in the serial monitor and set the baud rate to 15200. If an animal is detected within 2cm-9cm, the feed box will be opened to feed the animal.

A: It may be stuck. Before assembling the servo, use the code to adjust it to 80°.
A: Measurement should be started from the transmitting head of the ultrasonic sensor. This module is not a high-precision ultrasonic distance detection module and may exist errors.
