I am working on a project and have little to know programming knowledge. I am trying to interface a 4d systems microcam (TTL) to an arduino duemilanove. I ultimately want the camera to recognize a color and have my robot follow that color. Right now however i need to get the camera working. I was using the Ucam demo software and I was not able to communicate with my pc through the arduino using the tx/rx pins. This is mostly because I have no idea what code I need to write to get the two to talk. If anyone could get me started on what code I need to write that would be awesome.
I am working on a project and have little to know programming knowledge.
Probably “no programming knowledge” would be more accurate.
I am trying to interface a 4d systems microcam (TTL) to an arduino duemilanove.
Interface is one of those idiotic generic words that can be distorted to mean nearly anything. It is to be avoided in any technical discussion.
The module has an on-board serial interface (RS232 levels) that is suitable for a direct connection to any host controller or a PC system with a COM port.
RS232 levels and TTL levels are NOT the same thing.
From the same site:
UART: up to 115.2Kbps for transferring JPEG still pictures or 160x128 preview images with 0.75fps.
Three quarters of a frame per second. How far would that color you are trying to track have moved in the 1,333 seconds between frames?
160 by 128 pixels requires more than 20K of memory. Does your Arduino have that much memory available? The frame then is a compressed JPEG image. Do you know how to decompress that image? Do you have enough memory to hold the decompressed image too? Can you decompress the image in the 1.333 seconds you have?
How will you process the decompressed image to find the color you are tracking? Can you ensure that the color doesn’t change as lighting changes?
I was using the Ucam demo software
That software runs on Windows? Have you managed to port Windows to the Arduino? That’s awesome. Which version of windows did you port? Win 7, I hope. Will you be publishing your work soon?
I was not able to communicate with my pc through the arduino using the tx/rx pins.
What code do you have on the Arduino to communicate with the PC? What application is running on the PC? What does that code look like?
All the code that you need on the Arduino to communicate with the serial port is Serial.begin(), Serial.print(), Serial.available(), and Serial.read(). There are occasions where the Serial.write() function comes in handy, and the Serial.println() functions comes in handy now and then.
But this should be child’s play for someone who has ported Windows to the Arduino platform. Can’t wait to see that write-up, by the way.
If you’ve worked out the incompatibility issues with the camera and the Arduino, expanded the memory and speed of the Arduino, worked around the slow speed of the camera, written JPEG decompression software for the Arduino, and can extract the necessary data from the image to steer the robot, what is it you need the PC to do?
You have slightly unrealistic expectations of the Arduino. Image processing of this kind is way beyond what the Arduino is capable of.
The easiest way (as far as I know) to do what you intend to do is this:
Get yourself a cheap Webcam. I would just go with the cheapest logitech one you can find (I have had driver issues with no-name cams)
Use Processing and a library such as JMyron to get the coordinates of the object you want to track
Send the x coordinates (ideally you have translated them into a values which your servos can use [use the map function of processing]) via serial to the arduino (PaulS has shown you how to do that)
construct a platform with adifferential drive physically strong enough to carry your laptop
write a program for Arduino which reads the serial input and writes it to the continuous servos
-put laptop, Arduino and web-cam on your platform and your ready to go.
Use the reference material available on both the arduino and processing website. You probably don't have to write a single line of your own code as all of these things can be found in various manuals and example-code snippets.