5% OFF Over $19, Code: Elephant5; 10% OFF Over $59, Code: Elephant10



Croco:kit sensor starter kit for micro:bit Tutorial 5.1 WIFI camera platform

Posted by Fiona Su on

Croco:kit sensor starter kit for micro:bit Tutorial 5.1 WIFI camera platform

1.learning goals

In this lesson, we mainly study how uses the serial port of micro:bit to receive the information transmitted by the wifi camera, and analyzes the commands received by the serial port.

Then, micro:bit drives the corresponding motor and servo, that is, control the rotation of micro:bit camera platform.

2.Programming method:

Mode 1 online programming: First, we need to connect the micro:bit to the computer by USB cable. The computer will pop up a USB flash drive and click on the URL in the USB flash drive: http://microbit.org/ to enter the programming interface. Add the Yahboom package https://github.com/lzty634158/Croco-Kit to program.

Mode 2 offline programming: We need to open the offline programming software. After the installation is complete, enter the programming interface, click【New Project】, add Yahboom package:

https://github.com/lzty634158/Croco-Kit, you can program.

3.Looking for blocks

The following is the location of the building blocks required for this programming.

image.png 

image.png 

image.png 

image.png 

image.png

image.png 

image.png 

image.png

4.Combine building block

The summary program is shown below:

image.png 

5.Code analysis

1. Serial port initialization definition at boot time, set TX to P12, RX to P13, baud rate is 9600; set initial serial port receive data to "0"; set two servos initial angle to 90°; set micro: bit dot matrix display Smiley face. 

The serial port information is obtained cyclically, and the information before the "#" is saved in data. 

2.Create the SerialReceive2 function, compare the data with the manipulation command, if it meets a certain control command, the drive motor servo, otherwise it will not execute.Make the left and right rotation of the servo every time the rotation is 5 °.

3. Create a LimitValue function to limit the values of servoleft and servooes from 10 to 170.

4.The SerialReceive2 and LimitValue functions are called cyclically, and control the servo to rotate to the specified degree.

6.Hardware wiring

We need to connect the Wifi camera interface to the serial port of the mbit expansion board:

image.png 

 

image.png

 The servo camera that controls the up and down rotation in the wifi camera is inserted into the S1 interface of the expansion board.

The servo camera that controls the up and down rotation in the wifi camera is inserted into the S2 interface of the expansion board.

The orange interface of the servo is connected to the yellow pin, the red interface is connected to the red pin, and the brown interface is connected to the black pin.

7. Assembly instructions

Please refer to the Camera platform assembly instructions folder for installation steps of Camera platform.

8. Building block assembly instructions

The CrocoKit expansion board is connected to the WiFi camera by building blocks.

The following are the building block accessories that need to be used.

image.png 

image.png

image.png 

 image.png

image.png

image.png

image.png

image.png

image.png 

9. Experimental phenomena

After the program is successfully downloaded, the micro:bit dot matrix will display a smile; the wifi camera's indicator light will illuminate.

We need to use the Android mobile phone to search for wifi signal(Yahboom_WIFI, no need password) and connect.

After the wifi connection is successful, open the APP and enter the control interface.

Press the up, down, left and right buttons to control control the rotation of micro:bit camera platform.

The code of the experiment: 38.WIFI camera.rar 

Tutorial 

0 comments

Leave a comment

Please note, comments must be approved before they are published