- BW21-CBV-Kit x 1
- Android / Apple phone x 1
- L9110S Motor Controller x 1
- TT Motor x 2
In this example, we will use the BW21-CBV-Kit as a BLE peripheral device and communicate with the V7RC mobile application using a servo motor controller. Additionally, video will be streamed from the onboard camera sensor (JXF37P) to the V7RC mobile application via RTSP (Real-Time Streaming Protocol).
V7RC is a remote control app that offers two control UIs: one with 2 channels for remote-controlled cars and another with 4 channels for tanks and bulldozers.
2. Process(1) Setting up the RTSP StreamOpen the example by navigating to “Files” -> “Examples” -> “AmebaBLE” -> “BLEV7RC_CAR_VIDEO”.
Since the video receiving end is a mobile device, in the highlighted code snippet, we will not use the default video settings but set the video resolution to VIDEO_D1 (720x480) to limit video reception latency.
In the highlighted code snippet, fill in your WiFi name in “ssid” and your WiFi password in “pass”.
As the video stream receiving end is a mobile phone, it is recommended to use a 5G network because it has lower latency, higher capacity, and greater bandwidth, which can provide better video stream quality.
Compile the code and upload it to the BW21-CBV-Kit. After pressing the Reset button, wait for the development board to connect to the Wi-Fi network.
The development board’s IP address and the RTSP network port number will be displayed in the Serial Monitor.
You can download the V7RC APP from the links provided below:
- For Android users:
https://play.google.com/store/apps/details?id=com.v7idea.v7rcliteandroidsdkversion& hl=en_US
- For iPhone users
https ://apps.apple.com/nz/app/v7rc/id1390983964
After the APP is installed, ensure that your phone and the BW21-CBV-Kit mainboard are connected to the same network for streaming. Open the V7RC APP and select “Control Center”.
Under the NETWORK section, select “WIFI”.
Under the CAMERA section, select “RTSP”.
Since RTSP is used as the streaming protocol, enter “rtsp:// {IPaddress}:{port}” in the text box under the CAMERA section as the network URL in V7RC, replacing {IPaddress} with the IP address of your BW21-CBV-Kit development board.
Replace {port} with the RTSP port displayed in the Serial Monitor. The default RTSP port number is 554. If there are two RTSP streams simultaneously, the second port number defaults to 555.
Finally, click the “Save” button and return to the home page.
Back on the V7RC home page, you can check the Wi-Fi connection status at the top of the APP. Click the video button (orange) to monitor the video stream in real time.
The camera’s video stream will be displayed in the V7RC APP. At the same time, in your Serial Monitor, the message “rtp started (UDP)” will be displayed.
Open the V7RC APP and select “Control Center”.
Under the NETWORK section, select “BLE”.
Click DEVICE, select AMEBA_BLE_DEV, and click the “LINK” button to connect to your BW21-CBV-Kit board.
Open the Arduino Serial Monitor, and you should see the log that the BW21-CBV-Kit board has successfully connected to the phone.
Back on the V7RC home page, you can monitor the log data printed when moving the two controller buttons as shown in the figure below. Successful data reception indicates that the BLE connection has been established.
(3) Setting up the ServosAfter establishing the BLE connection, we will use two sets of servo motors to control the movement of the car. The two servo motors will first be connected to the L9110S servo controller using the predefined MotoA_1A, MotoA_1B, MotoA_1B, and MotoA_1B pins.
- The 1A pin is connected to a GPIO pin for controlling the motor direction.
- The 1B pin is connected to a PWM pin for controlling the motor speed.
- In this example, we will use the AMB82 MINI for demonstration. The detailed connection pin diagram is shown below. After establishing the connections, users can remotely control the servo motors via the V7RC APP BLE.
III. Reference Code
The ParseCMDString(String cmd) is a custom function that takes a string “cmd” as input and processes it. Currently, the V7RC APP has 6 available commands, which are: “SS2”, “SS4”, “SRT”, “SR2”, and “SRV”.
The following settings have been tested and can achieve better V7RC RTSP streaming quality:
Comments
Please log in or sign up to comment.