Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Arduino boards and image processing.

  1. Jul 21, 2011 #1
    Okay, so my first essay was swallowed by some impromptu logging out, so I'll be shorter and sweeter this time.

    I want to make a robot that accepts commands from a computer via USB. It will tell the robot basic commands like "next" and "back" with the bot figuring out what motors to move for each. Then the computer will tell the robot to take a snapshot from a serial camera (I'm thinking of this one: http://www.sparkfun.com/products/10061" [Broken]) and finally it will send the picture back to the PC for processing.

    Now, I've picked the Freetronics Eleven, which is apparently similar to the Arduino Uno but I've learned since that the chip won't be able to handle the size of the output. I was wondering if it'd be possible to pipe the input of a particular pin straight out to the USB wire instead of forcing the poor ATmega chip to try work out what exactly I'm sending it, and additionally I was wondering if the camera I've picked is even good for the job.

    I'm not too good at electronics, I'm more of a programmer so if I can help it most of my problems will be overcome with code than tricky wiring, but I'm not above doing that either. Thanks for any input guys.
     
    Last edited by a moderator: May 5, 2017
  2. jcsd
  3. Jul 21, 2011 #2

    MATLABdude

    User Avatar
    Science Advisor

    The manual for the camera seems to indicate that you can choose the chunk size in multiples of 8 bytes. It's rather cryptic as to how to do this, but I assume that, based on the comments at their forum and store, it's possible.

    What you *could* do, since your desired camera uses a UART (Universal Asynchronous Receiver-Transmitter, a.k.a. 'serial') interface, is to (re)write the interrupt that services the UART so that it sends a received byte onto the computer via the USB connection. If you're polling for input (say, with kbhit) you just send the received byte whenever you've received a byte.

    A quick glance at the camera manual indicates that its baud rate is variable from 9600 baud up to 115200. Assuming you go with the default 38400 baud that's 4800 bytes per second, or having to send a packet to the PC once every 208 us. That sounds fast, but the ATmega328 is operating at 16 MHz and every clock cycle is 62.5 ns.

    The other way to do it would be to disable the 328's serial module (once the send picture signal has been sent to the camera) and then go with an interrupt-on-change routine that mirrors the camera's output (frame buffers / stop bits and all) to the serial-to-USB chip input. You'd have to figure out when the camera was done transmitting (so as to restore the 328 serial mode), but you can probably figure that out.

    Another possibility is to just get a USB camera, a small USB hub, and plug both the Eleven and the camera into the hub, thereby completely bypassing the Eleven.

    EDIT: If you go with the byte capture-retransmit method, you'll clearly have to transmit to the serial-to-USB at a higher baud rate than the camera transmit to the '328.
     
  4. Jul 22, 2011 #3
    Wow, reading that reply made my head spin haha.

    I like the idea of connecting them both to a hub, it doesn't exactly fit with what I envisioned but most of this is me learning as I go I reckon it's best not to make it too difficult for myself.

    Thanks for the input, it's nice to know what I was thinking of is at least physically possible, even if it's beyond my capabilities right at this second. I'll go ahead then and grab the camera and hack at it till it works!

    Cheers!
     
  5. Jul 22, 2011 #4

    MATLABdude

    User Avatar
    Science Advisor

    Hey, you did ask for a software solution. :biggrin: (FWIW, I'm a hardware guy...)

    If you do, you should probably grab an actual USB camera. To wire this one up, you'd still need a USB-serial converter and to supply power. You can probably find something (maybe a little larger) that has a USB port and drivers or even better, software libraries.
     
    Last edited: Jul 22, 2011
  6. Jul 23, 2011 #5
    Hrrm, well I've got a fair bit of thinking to do then! I'll have to check out who sells what and plan accordingly. I really do appreciate the input so far, it's saved me from just leaving yet another project to gather dust with all the other things I've tried to do :tongue:
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Arduino boards and image processing.
  1. C# for arduino? (Replies: 5)

Loading...