1
\$\begingroup\$

I bought this module: OV7670 + AL422B(FIFO) Camera Module and I want to send the live video of the camera by this NRF24L01 but I have several questions.

  • Is the RF module suitable(NRF24L01) for this job?

  • I think the data rate of the NRF24L01 isn't enough for camera. what's your opinion?

  • If you agree with me, in your opinion, how can I solve this problem?(in other word, can I reduce the size of the camera's data(video)?)

I should send the video by NRF24L01 for 1Mbps or more. in addition, I'm using STM32F103RET6 for this job.

\$\endgroup\$
12
  • 1
    \$\begingroup\$ Do you have a specific resolution requirement? I doubt that you could maintain a "live" video, but you could transfer frames at a certain rate (lower than 30fps more than likely). \$\endgroup\$ Oct 7, 2013 at 18:55
  • 2
    \$\begingroup\$ Try stack exchange/Audio-video production and ask them how to compress a video output suitable for streaming. What the hardware requirements are. Let me know too! avp.stackexchange.com/questions \$\endgroup\$
    – Andy aka
    Oct 7, 2013 at 20:30
  • \$\begingroup\$ @GustavoLitovsky No, i think 24fps is suitable. \$\endgroup\$
    – Roh
    Oct 8, 2013 at 5:59
  • \$\begingroup\$ @Roh: 24fps is unlikely. What kind of image resolution do you need? \$\endgroup\$ Oct 8, 2013 at 16:00
  • \$\begingroup\$ @GustavoLitovsky i don't know exactly but i can to say that i want to show the video on a N96 LCD(2.8"). \$\endgroup\$
    – Roh
    Oct 8, 2013 at 16:40

1 Answer 1

3
\$\begingroup\$

Assuming you can sustain the maximum datarate for the nRF24L01 (2 megabits persecond), then that means you can move — in a perfect world — 200 kilobytes per second (assuming no overhead).

So given this, and your desired minimum of 24fps, you can calculate just how many bytes you need each image to be: 200K / 24 = 8.53K per frame

Now you haven't said what resolution you want, but the maximum resolution of the ov7670 is 640x480, and it uses 16bits per pixel (it is a little more complicated than that, I invite the curious to read the Data Sheet).

As our calculators all know 640 * 480 * 2 = 614,400 Bytes — 72 times that 8.53K per frame. In fact it would take in the ballpark of 3 seconds per frame (6 seconds if running at 1mbps).

So to answer your first two questions: The nRF24L01 isn't up to the task of transmitting live 640x480 video.

So this leaves us with your third question: How do reduce the size of the cameras data?

There are (not mutually exclusive) three ways of doing this:

  1. Compress the images
  2. Compress the data
  3. Send smaller images

Let us break each of these down:

Compress the images

You could, for example, send the images as a M-JPEG stream. This would certainly make decoding the images on the phone side much easier, and would reduce the size of the images sent quite a bit.

But there is one problem: You need to be able to hold the whole image in memory in order to do JPEG (and thus M-JPEG) compression. Your ST32F103RET6 has 64K of RAM (IIRC), so there is no way it is going to fit. And I am not sure of a lossy compression scheme you could use that doesn't need the whole image at once.

Compress the data

Now there are a number of options you could do here: Huffman, Run Length Encoding, LWZ, etc. Unfortunately none of these are going to produce a predictable amount of compression. It is going to depend on the images you send.

But I think it is safe to say you aren't going to get the 8.53K you would need for 24fps.

Send smaller images

The OV7670 is rather flexible when it comes to resolutions. So let us take a look at some other resolutions you could use:

  • QVGA (320x240): 320 * 240 * 2 = 150K per frame. At this rate you could send just over 1fps
  • QQVGA (160x120): 160 * 120 * 2 = 37K per frame. This is the first image size you could store entirely in RAM
  • QQQVGA (80x60): 80 * 60 * 2 = 9.38K per frame. With compression you should be able to do 24fps video
  • QQQQVGA (40x30): `40 * 30 * 2 = 2.35K per frame. At this (postage stamp) of a size you could steam at 30fps 1mbps! I believe this is the lowest resolution supported by the camera.

QQVGA may be possible if you do very lossy JPEG compression, and then do some compression on the data stream as well. You are going to have to experiment to be sure.

A Postscript

You are going to be hard pressed to find a faster wireless technology than the nRF24L01 (and its ilk), without going to wifi (for example the Adafruit CC3000 Module). With that, a microcontroller with a LOT of ram, and compression, you should be able to stream 24-30fps.

Alternately there are camera driver chips that do the JPEG compression for you — the vc0706 for example. With that attached to a camera, and using the vc0706's SPI link you should then be able to use even a trivial microcontroller to transmit the data.

I have yet to meet a camera module with vc0706 that exposes the SPI pins, they are all serial. One may exist, but I haven't found it yet. So if you go down this route, you may have to do it yourself...

\$\endgroup\$
5
  • 1
    \$\begingroup\$ I've been working with nRFs a LOT recently. There us no way you're even going to get close to 2 Mbps. A few hundred kbps is probably about the best you could possibly hope for, and that would be with all the automatic retransmit mechanisms turned off. \$\endgroup\$ Nov 25, 2013 at 8:05
  • \$\begingroup\$ Which nRFs have you been using? There are three operating ranges, different antenna types, and then distance. Speed and performance are the factor of multiple variables. But I picked 2Mbps because it was the theoretical maximum, and thus the best you could possibly get to show just how small each frame has to be even then. The math scales so you can simply adjust the numbers for different speeds \$\endgroup\$
    – JockM
    Nov 28, 2013 at 17:59
  • \$\begingroup\$ "But there is one problem: You need to be able to hold the whole image in memory in order to do JPEG (and thus M-JPEG) compression. Your ST32F103RET6 has 64K of RAM (IIRC), so there is no way it is going to fit. And I am not sure of a lossy compression scheme you could use that doesn't need the whole image at once." Perhaps you can compress the image to JPEG using this microcontroller with limited RAM by using jpegant. It's designed for JPEG compression in MCUs: sourceforge.net/projects/jpegant \$\endgroup\$
    – John3348
    Nov 29, 2017 at 19:45
  • \$\begingroup\$ @John3348 The problem is that you would need a pixel addressable image source, because encoding JPEG requires that you can either have the entire frame in memory or can get arbitrary pixels; since it uses a zigzag scan pattern. The camera in question provides a linear bitstream so you would have to hold the frame in memory. PNG can compress a linear bitstream, but being lossless would not be able to get down to that 37K per frame needed for 30FPS in all sitations \$\endgroup\$
    – JockM
    Dec 1, 2017 at 16:59
  • \$\begingroup\$ @John3348 Also a quick examination of jpegant shows that while it is quite memory efficient, it does require access to the full original \$\endgroup\$
    – JockM
    Dec 1, 2017 at 17:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.