VC0706 and ESP-01

On a lark I tried accessing the Adafruit JPEG serial camera (a VC0706 module) via the TX/RX serial lines of the ESP-01. And…. it sort of works. The library suggests software serial, and with

SoftwareSerial camera connection = SoftwareSerial(3,1);

and

cameraconnection.begin(38400);

the library functions for taking a picture, setting the size, and fetching a jpeg all work.

What’s weird is that there appears to be a one-frame delay, so if a command is issued it won’t affect the next cam.takePicture() call, but the one after that.

Anyway, the other thing that isn’t 100% obvious is that the ESP8266WebServer code for serving a jpeg expects it to stream from the SPIFFS, not from an in-ram buffer. I wanted to keep the images in memory instead of writing them out flash, so this was a bit different.

After a few dozen different gyrations and combinations, this is all it takes to serve a jpeg from an in-memory array:

  WiFiClient client = server.client();
  client.write(image, imageLen);
  server.send(200, "image/jpeg", "");

In the end what you get is a camera with built-in motion detection and a web server that can provide images from the camera. My method of logging over UDP meant that I didn’t miss not having a serial debugger, and the logger also functions a mini-NTP server, so the images can be served up with a line of text showing the time-of-picture.

The janky color is due to high sensitivity to IR light; expected for a security camera.

I’ll post again once I get the enclosure done (a retrofit of one of those $4 decoy security cameras), and get some of the motion detection stuff rolled in.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.