Hello, I have an Adafruit weatherproof TTL camera, with Arduino Uno and an Ethernet shield for SD storage.
The camera works perfectly with VC0706 Comm Tool, and the Snapshot example seems to save a proper-sized (47 kb) JPG file. However the JPG file is unreadable when I pop it into my computer.
I suspect the problem is with the serial communication between the Arduino and the camera:
- When I used the Adafruit VC0706 snapshot example, cam.readPicture(bytesToRead) always returns a buffer full of zeros
- I then tried the UART VC0706 snapshot example. At first it also returned only zeros, but then I de-activated SPI communication (set TRANSFER_BY_SPI to 0 in VC0706_UART.h), and cam.readPicture(bytesToRead) started returning real looking numbers. But they still don't create a readable JPG file.
Here's an example of the verbage (I added a line to print out the contents of the buffer on each cam.readPicture in HEX):
VC0706 Camera Snapshot Test ...
SD begin ok
version:
-----------------
VC0703 1.00
-----------------
Camera Init ok
Snap in 3 secs...
Picture taken!
Getting frame length
47876
create IMAGE30.JPG
wait to fetch 47876 byte image ...
FF D8 FF FE 0 24 3D B3 93 7A 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 E0 1 80 2 12 0 32 Read 32 bytes
80 0 BE 20 78 10 0 0 0 0 A 0 C 0 20 0 E4 BA 0 0 1 0 20 1 20 0 B0 5 C2 8 1F 0 Read 32 bytes
80 0 BE 20 78 10 0 0 0 0 A 0 C 0 20 0 C4 BA 0 0 1 0 20 1 20 0 B0 5 C2 8 1F 0 Read 32 bytes
12 B 51 4 51 4 0 0 FF DB 0 84 0 5 3 3 4 3 3 5 4 4 4 5 5 5 5 7 B 7 7 6 Read 32 bytes
80 0 BE 20 78 10 0 0 0 0 A 0 C 0 20 0 84 BA 0 0 1 0 20 1 20 0 B0 5 C2 8 1F 0 Read 32 bytes
etc.
Any suggestions much appreciated. I've spent days on this before waving the white flag.
Best regards,
- Ben
Unreadable JPG file from TTL camera
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- BF72
- Posts: 6
- Joined: Sun Jun 21, 2015 9:34 am
Unreadable JPG file from TTL camera
Last edited by BF72 on Tue Jun 30, 2015 10:54 am, edited 1 time in total.
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Unreadable JPG file from TTL camera
Try opening the file in a text editor and see if the items are being written as binary data or character sequences that represent numbers.
- BF72
- Posts: 6
- Joined: Sun Jun 21, 2015 9:34 am
Re: Unreadable JPG file from TTL camera
Hi, here is a copy-paste from Notepad, I guess this is a character sequence.
ÿØÿþ $=³“z à€ 2ÿ I ...etc
Thanks for your attention.
ÿØÿþ $=³“z à€ 2ÿ I ...etc
Thanks for your attention.
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Unreadable JPG file from TTL camera
No, that's what binary data looks like to a word processor. I just wanted to make sure you didn't see "FF D8 FF FE ..."
Looking at the data itself, the first few bytes don't match the JFIF spec. The mandatory byte sequence for the beginning of a file is "FF D8 FF E0 00 10 4A 46 49 46 00", which supports your idea of problems in the communication path.
Post a photo showing your hardware and connections and we'll take a look. 800x600 images usually work best.
Looking at the data itself, the first few bytes don't match the JFIF spec. The mandatory byte sequence for the beginning of a file is "FF D8 FF E0 00 10 4A 46 49 46 00", which supports your idea of problems in the communication path.
Post a photo showing your hardware and connections and we'll take a look. 800x600 images usually work best.
- BF72
- Posts: 6
- Joined: Sun Jun 21, 2015 9:34 am
Re: Unreadable JPG file from TTL camera
Thanks Mike. Photo below. This is how it was when working (perfectly) with VC0706 Comm Tool. When using with Snapshot, I used pins 2 & 3 and since it didn't like 0 & 1. (The wiring of the 2 & 3 was definitely correct because it found and activated the camera). All the jumpers/resistors feel snug. As mentioned, Snapshot does save JPEGs but they are unreadable.
Thanks for any suggestions.
Thanks for any suggestions.
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Unreadable JPG file from TTL camera
That wiring is what you use for the 'direct connect' method, where you bypass the microcontroller and let the camera talk directly to the USB cable. You need to reverse the connections if you want the microcontroller to talk to the camera.
Please be positive and constructive with your questions and comments.