Welcome to micro:bit camera platform repository


micro:bit 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/SuperBit 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/SuperBit, you can program.

3.Looking for blocks

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

image.png image.pngimage.png image.png image.png image.png image.pngimage.png


4.Combine building block

The summary program is shown below:

image.png 

image.png 

image.png 

Download code: microbit-microbit_camera_platform.rar

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.Building block assembly steps

Please refer to micro:bit_camera_platform_assembly instructions file.

Download: microbit_camera_platform_assembly_instructions.rar

8. Download APK

Android Please use the browser to scan the QR code to download and install APK; Apple please use camera to scan the QR code to enter the APP Store to download and install or search for "YahboomRobot" in the APP Store. As shown in figure below.

!!Note:Because the software is relatively large, the download takes a certain amount of time, please be patient.

image.png 

Note: During installation, If you find any prompts on your phone (for example: location permissions of your phone). You must select "Yes".


9. Experimental phenomena

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

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

3) After the wifi connection is successful, open the APP . if you will see the screen shown below. You can click left upper corner to select service -- [6WD Robot].

image.png 

image.png 

4) Click to enter the screen shown below, after seeing the video screen, you can start to control the camera platform.

image.png 

Press the RUN, BACK, LEFT and RIGHT buttons to control the rotation of micro:bit camera platform.


Loading...