TTL Serial Camera - Nothing seems to work

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
suranga
 
Posts: 19
Joined: Mon Oct 24, 2011 2:11 pm

TTL Serial Camera - Nothing seems to work

Post by suranga »

Hi

I have been trying all possible things with my TTL JPEG camera (http://forums.adafruit.com/viewtopic.php?f=25&t=22562); but nothing seems to be working (read almost all the forum postings)...

1. I tried with the example code provided with a UNO board - I always get the version number, resolution etc...but images are corrupted (I can't open them with any image editing tool) . I change buffer length to 32, 16, 64; delay in the .h file to 20, 5 - still no luck!

2. I am using a mac (with os X) so I can't try the CommTool but I was trying to use the Python code (on Python 2.6.6) given in the examples - doesn't work..I receive some bytes and then gets "ERROR READING PHOTO" At the end of this post I have included the complete output (with bytes received printed).

I am not sure if I should power the UNO board separately. At the moment, the UNO board is connected to mac via USB and I use UNO board 5V and GND to power the TTL camera.

I am not sure if the camera is faulty...

Any advice on this matter is greatly appriciated.

===
Snap!
3516 bytes to read
['0x56', '0x0', '0x32', '0xc', '0x0', '0xa', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x20', '0x1', '0x0']
['v', '\x00', '2', '\x00', '\x00', '\xff', '\xd8', '\xff', '\xfe', '\x00', '$', '\x05', '\x00', '\x0e', '\x01', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', 'x', '\x00', '\xa0', '\x00', '\x08', '\x00', '2']
['0x56', '0x0', '0x32', '0xc', '0x0', '0xa', '0x0', '0x0', '0x0', '0x20', '0x0', '0x0', '0x0', '0x20', '0x1', '0x0']
['v', '\x00', '2', '\x00', '\x00', '\x12', '\x0b', 'Q', '\x04', 'Q', '\x04', '\x00', '\x00', '\xff', '\xdb', '\x00', '\x84', '\x00', '\x02', '\x01', '\x02', '\x02', '\x02', '\x01', '\x02', '\x02', '\x02', '\x02', '\x02', '\x02', '\x02', '\x02', '\x03', '\x05', '\x03', '\x03', '\x03']
['0x56', '0x0', '0x32', '0xc', '0x0', '0xa', '0x0', '0x0', '0x0', '0x40', '0x0', '0x0', '0x0', '0x20', '0x1', '0x0']
['v', '\x00', '2', '\x00', '\x00', '\x03', '\x03', '\x06', '\x04', '\x05', '\x04', '\x05', '\x07', '\x06', '\x08', '\x08', '\x07', '\x06', '\x07', '\x07', '\x08', '\t', '\x0c', '\n', '\x08', '\t', '\x0b', '\t', '\x07', '\x07', '\n', '\x0e', '\n', '\x0b', '\x0c', '\x0c', '\r']
['0x56', '0x0', '0x32', '0xc', '0x0', '0xa', '0x0', '0x0', '0x0', '0x60', '0x0', '0x0', '0x0', '0x20', '0x1', '0x0']
['v', '\x00', '2', '\x00', '\x00', '\r', '\r', '\x08', '\n', '\x0e', '\x0f', '\x0e', '\r', '\x0f', '\x0c', '\r', '\r', '\x0c', '\x01', '\x02', '\x02', '\x02', '\x03', '\x03', '\x03', '\x06', '\x03', '\x03', '\x06', '\x0c', '\x08', '\x07', '\x08', '\x0c', '\x0c', '\x0c', '\x0c']
['0x56', '0x0', '0x32', '0xc', '0x0', '0xa', '0x0', '0x0', '0x0', '0x80', '0x0', '0x0', '0x0', '0x20', '0x1', '0x0']
['0x56', '0x0', '0x32', '0xc', '0x0', '0xa', '0x0', '0x0', '0x0', '0x80', '0x0', '0x0', '0x0', '0x20', '0x1', '0x0']
['v', '\x00', '2', '\x00', '\x00', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c']
['0x56', '0x0', '0x32', '0xc', '0x0', '0xa', '0x0', '0x0', '0x0', '0xa0', '0x0', '0x0', '0x0', '0x20', '0x1', '0x0']
['v', '\x00', '2', '\x00', '\x00', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\x0c', '\xff', '\xfe', '\x00', '\x05', '\x00', '\x00', '\x00', '\xff', '\xc0', '\x00', '\x11', '\x08', '\x00', 'x', '\x00', '\xa0', '\x03', '\x01', 'v', '\x00', '2', '\x00']
['0x56', '0x0', '0x32', '0xc', '0x0', '0xa', '0x0', '0x0', '0x0', '0xc0', '0x0', '0x0', '0x0', '0x20', '0x1', '0x0']
['v', '\x00', '2', '\x00', '\x00', '!', '\x00', '\x02', '\x11', '\x01', '\x03', '\x11', '\x01', '\xff', '\xc4', '\x01', '\xa2', '\x00', '\x00', '\x01', '\x05', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x01', '\x02']
['0x56', '0x0', '0x32', '0xc', '0x0', '0xa', '0x0', '0x0', '0x0', '0xe0', '0x0', '0x0', '0x0', '0x20', '0x1', '0x0']
['v', '\x00', '2', '\x00', '\x00', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\t', '\n', '\x0b', '\x01', '\x00', '\x03', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x01', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x01', '\x02', '\x03', '\x04', '\x05']
['0x56', '0x0', '0x32', '0xc', '0x0', '0xa', '0x0', '0x0', '0x1', '0x0', '0x0', '0x0', '0x0', '0x20', '0x1', '0x0']
['v', '\x00', '2', '\x00', '\x00', '\x06', '\x07', '\x08', '\t', '\n', '\x0b', '\x10', '\x00', '\x02', '\x01', '\x03', '\x03', '\x02', '\x04', '\x03', '\x05', '\x05', '\x04', '\x04', '\x00', '\x00', '\x01', '}', '\x01', '\x02', '\x03', '\x00', '\x04', '\x11', '\x05', '\x12', '!']
['0x56', '0x0', '0x32', '0xc', '0x0', '0xa', '0x0', '0x0', '0x1', '0x20', '0x0', '0x0', '0x0', '0x20', '0x1', '0x0']
['v', '\x00', '2', '\x00', '\x00', '1', 'A', '\x06', '\x13', 'Q', 'a', '\x07', '"', 'q', '\x14', '2', '\x81', '\x91', '\xa1', '\x08', '#', 'B', '\xb1', '\xc1', '\x15', 'R', '\xd1', '\xf0', '$', '3', 'b', 'r', '\x82', '\t', '\n', '\x16', '\x17']
['0x56', '0x0', '0x32', '0xc', '0x0', '0xa', '0x0', '0x0', '0x1', '0x40', '0x0', '0x0', '0x0', '0x20', '0x1', '0x0']
['v', '\x00', '2', '\x00', '\x00', 'v', '\x00', '2', '\x00', '\x00', '\x18', '\x19', '\x1a', '%', '&', "'", '(', ')', '*', '4', '5', '6', '7', '8', '9', ':', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'S', 'T', 'U']
['0x56', '0x0', '0x32', '0xc', '0x0', '0xa', '0x0', '0x0', '0x1', '0x60', '0x0', '0x0', '0x0', '0x20', '0x1', '0x0']
['v', '\x00', '2', '\x00', '\x00', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '\x83', '\x84', '\x85', '\x86', '\x87', '\x88', '\x89', '\x8a', '\x92', '\x93', '\x94', '\x95', '\x96', '\x97', '\x98', '\x99']
['0x56', '0x0', '0x32', '0xc', '0x0', '0xa', '0x0', '0x0', '0x1', '0x80', '0x0', '0x0', '0x0', '0x20', '0x1', '0x0']
['v', '\x00', '2', '\x00', '\x00', '\x9a', '\xa2', '\xa3', '\xa4', '\xa5', '\xa6', '\xa7', '\xa8', '\xa9', '\xaa', '\xb2', '\xb3', '\xb4', '\xb5', '\xb6', '\xb7', '\xb8', '\xb9', '\xba', '\xc2', '\xc3', '\xc4', '\xc5', '\xc6', '\xc7', '\xc8', '\xc9', '\xca', '\xd2', '\xd3', '\xd4', '\xd5']
['0x56', '0x0', '0x32', '0xc', '0x0', '0xa', '0x0', '0x0', '0x1', '0xa0', '0x0', '0x0', '0x0', '0x20', '0x1', '0x0']
['v', '\x00', '2', '\x00', '\x00', 'v', '\x00', '2', '\x00', '\x00', '\xd7', '\xd8', '\xd9', '\xda', '\xe1', '\xe2', '\xe3', '\xe4', '\xe5', '\xe6', '\xe7', '\xe8', '\xe9', '\xea', '\xf1', '\xf2', '\xf3', '\xf4', '\xf5', '\xf6', '\xf7', '\xf8', '\xf9', '\xfa', '\x11', '\x00', '\x02']
['0x56', '0x0', '0x32', '0xc', '0x0', '0xa', '0x0', '0x0', '0x1', '0xc0', '0x0', '0x0', '0x0', '0x20', '0x1', '0x0']
['\x01', '\x02', '\x04', '\x04', 'v', '\x00', '2', '\x00', '\x00', 'v', '\x00', '2', '\x00', '\x00', '\x03', '\x04', '\x07', '\x05', '\x04', '\x04', '\x00', '\x01', '\x02', 'w', '\x00', '\x01', '\x02', '\x03', '\x11', '\x04', '\x05', '!', '1', '\x06', '\x12', 'A', 'Q']
ERROR READING PHOTO
None

Traceback (most recent call last):
File "/Users/suranga/Documents/Arduino/libraries/VC0706/getimage0706.py", line 142, in <module>
photodata = ''.join(photo)
TypeError
===

User avatar
adafruit_support_bill
 
Posts: 88091
Joined: Sat Feb 07, 2009 10:11 am

Re: TTL Serial Camera - Nothing seems to work

Post by adafruit_support_bill »

It looks like you have the right connections since it is communicating to some degree. Do make sure that all your connections are secure, since just one dropped byte would cause an error reading the photo.

The camera only needs 75mA @5v, so you should be fine powering it from the UNO 5v pin.

User avatar
suranga
 
Posts: 19
Joined: Mon Oct 24, 2011 2:11 pm

Re: TTL Serial Camera - Nothing seems to work

Post by suranga »

Thanks for the comment...

I checked all the connections...In fact, I tried running CommTool on a windows 7 machine (keeping the same connections and same UNO board) and I could get images without any problems! Once this was verified I remove the USB cable from windows machine, connected to max OS X and executed .py code..still gets the same error...Similarly, the Arduino example code too gives me a corrupted image.

Any idea what else should I try?

Thanks

Suranga

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: TTL Serial Camera - Nothing seems to work

Post by adafruit »

can you try to format your microSD card? or try another card? (worth an attempt!)

User avatar
suranga
 
Posts: 19
Joined: Mon Oct 24, 2011 2:11 pm

Re: TTL Serial Camera - Nothing seems to work

Post by suranga »

yes I can try...I don't need a SD card to run the .Py code right?


PS: .Py code does not compile on python 3.2; compiles on python 2.6...

User avatar
adafruit_support_bill
 
Posts: 88091
Joined: Sat Feb 07, 2009 10:11 am

Re: TTL Serial Camera - Nothing seems to work

Post by adafruit_support_bill »

You need to use the AFMotor library or the AFMotor compatible version of the AccelStepper library. Both are available here: http://www.ladyada.net/make/mshield/download.html

User avatar
suranga
 
Posts: 19
Joined: Mon Oct 24, 2011 2:11 pm

Re: TTL Serial Camera - Nothing seems to work

Post by suranga »

How does this library relate to TTL Camera Python Example code?...Before I ran the python code, I simply uploaded an empty sketch into UNO...

User avatar
adafruit_support_bill
 
Posts: 88091
Joined: Sat Feb 07, 2009 10:11 am

Re: TTL Serial Camera - Nothing seems to work

Post by adafruit_support_bill »

Sorry, right reply to the wrong thread. :oops: I need to pay attention when I multi-task.

Not sure about the python issue. I'm not a python expert, but the error seems to occur after the image read is complete.

User avatar
suranga
 
Posts: 19
Joined: Mon Oct 24, 2011 2:11 pm

Re: TTL Serial Camera - Nothing seems to work

Post by suranga »

What's the best way to test this camera on Arduino? With the Windows PC I have verified that my connections are okey and camera is working.
But whenever I try with Arduino, (say I read 160*120) there are 3000+ bytes in the camera buffer and I the resulting file is corrupted...
When I tried python code, I realized that there is a function to check every response. Some bytes fails to go though this check and python code exit at that moment.
===
def checkreply(r, b):
r = map (ord, r)
if (r[0] == 0x76 and r[1] == SERIALNUM and r[2] == b and r[3] == 0x00):
return True
return False
===
I tried to bypass the response check and I was able to receive almost all the bytes..there were about 4-5 invalid responses, which I think corrupted the image.

I have been trying this over 3 weeks now...could captures a figure with arduino code...

User avatar
adafruit_support_bill
 
Posts: 88091
Joined: Sat Feb 07, 2009 10:11 am

Re: TTL Serial Camera - Nothing seems to work

Post by adafruit_support_bill »

there were about 4-5 invalid responses, which I think corrupted the image
Can you post some photos of your connections between the camera and the Arduino?

User avatar
suranga
 
Posts: 19
Joined: Mon Oct 24, 2011 2:11 pm

Re: TTL Serial Camera - Nothing seems to work

Post by suranga »

I have included 3 images: Overall circuit, zoom to Breadboard connections, zoom to Camera connections

This was used with the Python code. When I tried Arduino code, camera's tx and rx was connected to pin 2 and 3 and monitor the output from serial port.
Attachments
IMG_0371.jpg
IMG_0371.jpg (61.44 KiB) Viewed 3913 times
IMG_0372.jpg
IMG_0372.jpg (72.69 KiB) Viewed 3913 times
IMG_0367.jpg
IMG_0367.jpg (62.26 KiB) Viewed 3913 times

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: TTL Serial Camera - Nothing seems to work

Post by adafruit »

where is the microSD card?

User avatar
suranga
 
Posts: 19
Joined: Mon Oct 24, 2011 2:11 pm

Re: TTL Serial Camera - Nothing seems to work

Post by suranga »

This was used with the Python code...For micro SD card example, instead of writing to SD card I wrote the byte into the serial port and tried save data into a JPEG file...

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: TTL Serial Camera - Nothing seems to work

Post by adafruit »

that wont work, it isnt fast enough. follow the tutorial as it is, adding python is just making it more complicated

User avatar
suranga
 
Posts: 19
Joined: Mon Oct 24, 2011 2:11 pm

Re: TTL Serial Camera - Nothing seems to work

Post by suranga »

Thanks!...I've ordered SD card breakout board from adafruit. I will report how it goes once I re-try the code with SD card

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”