Hi folks – I’m trying to get an Adafruit VC0706 camera working with a Particle Electron. This camera works with the official Windows-based tool but I cannot retrieve a valid image off of it via the electron. My setup is basically the camera is connected to Serial1, the electron receives those bytes and prints them to Serial, which is connected to my computer where I save them in a file. The JPEGs always have some sort of error preventing them from being read, usually a bogus DQT value of some sort.
Before the photo is downloaded, a message is printed to the Serial console that says “wait to fetch 47044 byte image …” or so. I noticed that the actual data received is about 300-400 bytes shorter than its stated length.
The image data is read in 32-byte chunks from Serial1 and then printed to Serial with Serial.write(). As a debugging measure, I started to print the value returned from Serial.write() (which is the number of bytes it claims to have written) alongside each data chunk, so that my file looks like this:
(data chunk)WRITTEN: 32(data chunk)WRITTEN: 32(data chunk)WRITTEN: 32 …
Serial.write() prints that it wrote 32 bytes every single time. That is often accurate, but many times the actual size of the data chunk is lower, usually by 1 byte, sometimes as much as 4 bytes. I’m using a hex editor so non-printable characters are still counted. An example file is visible at https://github.com/durkie/durkie.github.io/blob/master/assets/files/screenlog.txt
This doesn’t feel like an issue with the camera since Serial.write() seems to be claiming to write more than it actually did and that seems unrelated to anything happening on Serial1. For what it’s worth, I’m connected to the camera at 38400 baud and the Electron is connected to my computer at 115200, but it seems to happen at any baud rate between Electron and computer: 9200 and 2400 baud both give the same errors and same frequency of errors. The baud rate of the camera is not easily changed.
I’m observing this behavior with the camera connected to either Serial1, Serial4 or Serial5. The cellular radio is off and the camera/electron connection is via 6" long jumper wires. The USB cable is stock. SYSTEM_THREAD(ENABLED) doesn’t seem to make a difference (not that I really know anything about this mode), nor does changing the read/write size from 32 bytes to 16. This is also an error I’ve observed with several other similar types of camera modules but the Adafruit is the only one I have verified to actually work with its windows setup though.
I’m using the library here for interfacing with the camera: https://github.com/adafruit/Adafruit-VC0706-Serial-Camera-Library – the code I’m using is basically the same as in examples/Snapshot.ino, except I’m printing to serial instead of writing image data to an SD card.
Any ideas on things to try? I feel like I’m running out of levers to pull.