---
title: "OV7725 W5500 serial port/network (UDP) transmits video to the host computer"
url: "https://maker.wiznet.io/gavinchang/projects/ov7725-w5500-serial-port-network-udp-transmits-video-to-the-host-computer/"
markdown_url: "https://maker.wiznet.io/gavinchang/projects/ov7725-w5500-serial-port-network-udp-transmits-video-to-the-host-computer/md"
type: "UCC: User Created Content"
author: "a496272917"
author_url: "https://firebbs.cn/forum.php?mod=viewthread&tid=28499&extra="
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "a496272917"
original_url: "https://firebbs.cn/forum.php?mod=viewthread&tid=28499&extra="
published: "2023-05-02"
language: "en"
hardware: ["WIZnet W5500"]
likes: 2
views: 188
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# OV7725 W5500 serial port/network (UDP) transmits video to the host computer

> OV7725 W5500 serial port/network (UDP) transmits video to the host computer

Original author: a496272917 (source: https://firebbs.cn/forum.php?mod=viewthread&tid=28499&extra=)

## Components

- **WIZnet W5500** x 1 ([docs](https://docs.wiznet.io/Product/Chip/Ethernet/W5500))

WIZnet parts: W5500 ([Datasheet](https://docs.wiznet.io/Product/Chip/Ethernet/W5500/datasheet?utm_source=maker&utm_medium=project&utm_campaign=w5500), [product hub](https://maker.wiznet.io/products/w5500/))

## Article

The content of this post is serial port and network (UDP) transmission video

Hardware: Wildfire Guide, W5500 module, OV7725

Software: UCOS, C# WinForm

1 Reason for sharing: When making something, it is necessary to transmit the video of the lower computer to the upper computer for display. I searched for information on the Internet for a long time, but I couldn’t find a ready-made one, so I wrote one myself and shared it in the wildfire forum. Thanks to the wildfire here, I learned a lot from watching the wildfire information and videos.

2. Let's talk about the program in blocks:

2.1 Lower computer

a Task 1: Receive commands from the host computer to control the start and stop of video transmission

b Task 2: Transmit video data

c Task 3: Receive the host computer control command (the control command is used to control the robot, only focus on the neglect of video transmission)

2.2 PC

a RGB format conversion, pay attention to the conversion of 5 bits to 8 bits, and move to the high bit, which will only bring some precision loss, otherwise, the color value will be lost.

[mw_shl_code=csharp,true]private static void rgb565_2_rgb24(byte[] rgb24, ushort rgb565)

{
//extract RGB
rgb24[2] = (byte)((rgb565 & RGB565_MASK_RED) >> 11);
rgb24[1] = (byte)((rgb565 & RGB565_MASK_GREEN) >> 5);
rgb24[0] = (byte )((rgb565 & RGB565_MASK_BLUE));

//amplify the image
rgb24[2] &lt;&lt;= 3;
rgb24[1] &lt;&lt;= 2;
rgb24[0] &lt;&lt;= 3;

//data = (uint)(rgb24 [2] &lt;&lt; 16 + rgb24[1] &lt;&lt; 8 + rgb24[0]);
//return data;
}[/mw_shl_code]

B Some things about Socket programming, I also learn now, so I won’t talk about it.

3 optimization points

3.1 The main frequency and memory limit of the F1 single-chip microcomputer, if you have money, go to the F4, it must be fast. I use the V series 64KBRAM, add a queue later, and cache a few more lines of data to see if the speed can be improved. The same is true for the host computer, mainly to reduce data copying and reduce time complexity.

3.2 Add UDP confirmation retransmission mechanism

Subsequent optimizations will be uploaded to github.

4 display results

github address: select the latest version

<https://github.com/howu911/video_transmission>

![](https://maker.wiznet.io/upload/ckeditor5/73150753%5F1683037767%2Epng)

Show results

![Show results](https://cloud.firebbs.cn/forum/201912/04/213942nmzgrara7sg9g7wb.png)

: [UDP video transmission.png](https://firebbs.cn/forum.php?mod=attachment&aid=MjQwNjZ8Njk2NjhjYWR8MTY4MzAwNDc3N3wwfDI4NDk5&nothumb=yes)*(74.88 KB, download times: 41)* Show results ![Show results](https://cloud.firebbs.cn/forum/201912/04/213942nmzgrara7sg9g7wb.png)

---

Source: https://maker.wiznet.io/gavinchang/projects/ov7725-w5500-serial-port-network-udp-transmits-video-to-the-host-computer/
