STM32F103C8T6 drives ov2640 to take photos via serial port and transmit to the host computer

Publisher:天涯拾遗Latest update time:2019-03-18 Source: eefocusKeywords:STM32F103C8T6 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Usage Environment (Blue bold words are special notes)


1. Software environment: Keil MDK 5.15


2. Hardware environment: STM32F103C8T6 minimum system, OV2640 camera module


I wanted to play around with cameras recently, so I looked for cost-effective cameras online. I used the OV7670 camera before, but this camera has high requirements for the microcontroller. It is very difficult to drive a general microcontroller, unless an ARM-level microprocessor is competent. If you want to use a low-end microcontroller to drive it, you need to add a FIFO module. Once this thing is added, the price will triple. . . . The original 20 yuan thing has risen to 70+, my God. . . . So after searching for a long time, I finally found the OV2640 camera. This camera is the most cost-effective camera I have encountered so far. It actually supports direct output of JPG format images, and supports up to 1600*1200 (200W) pixels! ! ! The price is only half of the OV7670 camera with FIFO! And the STM32F103 series microcontroller can easily drive it (provided that the SRAM is large enough).


So we decided to use the STM32F103C8T6 MCU, which is more cost-effective. The price of this MCU is only 8 yuan, and the performance is good. It has 48 pins, 20KB RAM, 64K FLASH, and 72M main frequency, which is more cost-effective. The system connection diagram is as follows:



After the camera captures the image, it sends it to the host computer through the serial port. The host computer software is as follows:



20k of RAM is still quite difficult to carry



The 640*480 picture effect is as follows: 



The 320*240 effect is as follows



The effect is basically good. The main function is as follows:


int main(void)

{

u8 res;

u8 *pname; //File name with path

 

Stm32_Clock_Init(9); // System clock settings

uart_init(72, 115200); // Initialize the serial port to 115200

delay_init(72); // Delay initialization

usmart_dev.init(72); // Initialize USMART

LED_Init(); // Initialize the hardware interface connected to the LED

RCC->AHBENR |= RCC_AHBENR_CRCEN; //Hardware crc initialization

delay_ms(5500);

delay_ms(5500);

printf("Enter Main \r\n");

while(OV2640_Init()) //Initialize OV2640

{

printf("ov2640 error");

delay_ms(200);

}

printf("ov2640 ok");

delay_ms(1500);

OV2640_JPEG_Mode(); //RGB565 mode

OV2640_OutSize_Set(pic_width, pic_height);

ov2640_speed_ctrl();

 

while(1)

{

while(!OV2640_VSYNC) ;

while(OV2640_VSYNC) //Wait for frame signal

{

res = ov2640_jpg_photo(pname);

delay_ms(10000);

}

 

}

}

Keywords:STM32F103C8T6 Reference address:STM32F103C8T6 drives ov2640 to take photos via serial port and transmit to the host computer

Previous article:STM32F103C8T6 has 128K Flash
Next article:Implementation of STM32 custom HID USB device

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号