Welcome to WiFi Camera Module repository
2. microbit
microbit configure camera
microbit configure camera1. Experiment preparation2. Experimental wiring3. Microbit building block import and simple instructions3.1 Open the programming website3.2 New project3.3 Add camera building blocks3.4 Introduction to the main building blocks4. Experimental operation and experimental results
1. Experiment preparation
- Module World Expansion Board
- microbit
- wifi camera
2. Experimental wiring
| Extended version | wifi camera |
|---|---|
| P16 | RX |
| P15 | TX |
| 5V | 5V |
| GND | GND |

3. Microbit building block import and simple instructions
3.1 Open the programming website
https://makecode.microbit.org/#
3.2 New project


3.3 Add camera building blocks
URL of the building blocks: (Just choose one of them, they are the same)
- https://github.com/yahboomtechnology/ESP32-wifi-Microbit
- https://github.com/LLY16888/ESP32-wifi-Microbit

3.4 Introduction to the main building blocks
After the above building blocks are successfully introduced, the results as shown below will be displayed.

- Serial port initialization building block This is used to define the pins for serial port communication and communication with wifi cameras. The default baud rate is 115200 and cannot be changed.

- Set the size of the serial port receiving buffer This building block is used to define the size of a packet of data that can be transmitted transparently, such as
This defines the maximum size of a packet to be 30 characters. Exceeding it will result in incomplete data reception. This value cannot be less than 25, otherwise the IP information will also be incomplete - Building block for obtaining transparent transmission data This building block is mainly used to obtain the information sent by the host computer to the microbit, and transmit it as an intermediate information through the wifi camera

- You can know the function of other building blocks by looking at their names. How to use them can be found in the source code provided in this tutorial, which will not be explained in this tutorial. Open the source code method provided by the tutorial
- Open the URL https://makecode.microbit.org/# in the browser
- Then drag the hex file provided in this experiment into the browser that opens the URL, and it will open automatically.
- Program diagram of the source code of this project

4. Experimental operation and experimental results
- From the source code, we can see that microbit will first initialize the serial port and then configure the working mode of the wifi camera.
- Then configure the wifi to connect according to the settings
The wifi here needs to be changed to a wifi that can be connected - If the connection is successful, the microbit will display the sta_ip:192.168.x.x address. If the connection is unsuccessful, the microbit will display sta_ip:null. If it is only configured in spontaneous hotspot mode, it cannot be checked. If you go to the IP address of sta_ip, the result of sta_ip:null will also be displayed.
- This is the configuration of spontaneous hotspots
If the configuration is successful, the mobile phone can receive the wifi hotspot microbit_wifi. You can connect to this wifi by configuring a password or without a password, and the microbit will display the ip of "ap_ip:192.168.4.1"
If you cannot find this name, check if it is configured to connect to wifi only mode (that is, the mode in the picture below), and the microbit will display the information "ap_ip:null"

- Transparent data transmission based on IP connection
First open the NetAssist.exe software on your computer and make sure the computer and camera are on the same network segment.
Then connect according to the obtained IP address. For example, the obtained sta_ip is: "192.168.2.199"/ap_ip is: "192.168.4.1"
Then there are 2 ways
- Connect the computer to the camera's spontaneous wifi, and then connect through the ip 192.168.4.1. The port number is 8888 and cannot be changed.

- The computer is connected directly through the IP address 192.168.2.199. The port number is 8888 and cannot be changed. The following figure is a diagram of a successful connection.

- Connect the computer to the camera's spontaneous wifi, and then connect through the ip 192.168.4.1. The port number is 8888 and cannot be changed.
Then by sending information, the microbit will display the corresponding information, for example, if you send "study", the microbit will display "study"

- View camera footage
Open the browser on your computer or mobile phone
Then watch the video through the obtained IP address. For example, the obtained sta_ip is: "192.168.2.199"/ap_ip is: "192.168.4.1"
Then you can watch the live camera footage in 2 ways
- Connect the computer to the camera's spontaneous wifi, and then enter http://192.168.4.1:81/stream through the browser to access the camera screen
- Directly enter http://192.168.2.199:81/stream on your computer to access the camera screen.
