Go Down

Topic: uCam + Arduino + XBee (Read 3015 times) previous topic - next topic


Hey all, so I've got a project involving a ucam-TTL module from 4d systems, an arduino, and 2 XBees. Basically, I'm trying to take pictures on a moving object, and then from there wirelessly transmit them to a computer (where the 2nd XBee is) where I can do image processing.

Now the max auto-detectable baud rate on the camera module is 115,200 so that's what I was planning on using in the beginning. It can theoretically go up to 1.2Mbps but we'll worry about that later. So using the nano (I'll eventually move to a teensy++ for reasons discussed later) I plan to send commands to the camera, and then receive the image data. Then send that out to the XBee. However, I've noticed that just sending 'Hello, World!" over the XBee at 115200 baud does not always have perfect data reconstruction. Every 5th or 6th transmission will have an unprintable character or miss an LFCR or something. I tried to pair the XBees PANID and set their destination nodes to each other so that they could use the automatic resend capability but that seemed to make them hang... However, when the baud rate is set to 57,600 on the XBee, the first 50 or so "Hello, World!"s all came out perfect on the other end. Is that a limitation of XBee or is there something else I can try?

Second main issue, is receiving the data from the camera. I'm worried about the serial buffer on the arduino overflowing or speed constraints, etc. Here are my relevant calculations:

Since the minimum I need is the 80x60 resolution for my RAW (4 bit greyscale) images, shouldn't it be possible to simply copy the contents of the serial buffer into internal RAM for each image? The way I see it...

80x60 = 4800 pixels
4 bits/pixel * 4800 pixels = 19200 bits per RAW image = 2400 Bytes per RAW image
Here I should note I'm not actually using an arduino, but a teensy++1.0 dev board. This has 8192 bytes of RAM, so plenty to store one of those images (probably 3 if I need to).

Next, I need to consider if I can get it out of the buffer fast enough. Worst case scenario for this is that I want to run at 115200 baud, so 115200 bits per second are transferred into the serial buffer. Ignoring the idea that I actually can let some data backup into the serial buffer (up to 128 bytes),

8 bits / 115200 bps = ~7 x 10^-5 seconds to receive each byte and get it out of the serial buffer into RAM
That seems like it could be an issue. Running @ 16MHz, means each clock cycle takes 6.25 x 10^-8 s.

7 x 10^-5 / 6.25 x 10^-8 = 1120 cycles with which I would have to perform that operation.
That seems doable, which means I would be fast enough to take it out of the serial buffer and put it into RAM without any backup of data. So then the serial buffer would not overflow... But I do not know the arduino language (or even normal C/C++) to know if that is correct. Could you verify that?

Finally, in JPEG mode, I'm planning on simply receiving each JPEG packet and copying it into internal RAM, then sending that out on the XBee so it's like super-serial mode. As long as I can reconstruct the JPEG on the desktop host I don't think that will be an issue correct?

Let me know if you see anything wrong with my calculations or the plan in general. Thanks!


Just wondering if you've made any progress with this project? I'm working on something similar to this but i'm new to the arduino platform so any help would be appreciated.


Yes, I got a rather complicated setup working with 2 ATmega328s, a pair of XBees, the uCam, and a desktop computer. There were also a few other sensors involved and then everything together was used to control 6 motors on a flying blimp.

Email me at jgordo32@jhu.edu with the subject line something along the lines of 'arduino xbee help' or whatever and we can discuss  project.


Got it working with Grove Serial JPG camera.  Can send 2FPS 320x240.


just wondering whether you have made any progress with your project. If so do share as i am into some kinda similar thing.


A third example of crossposting/necromancy - don't do it.


Go Up