ESP32 new version and repository: 2 important additions

A project log for ESP32 WiFi instant Camera

The FS32 is a digital Polaroid that uploads the photo instantly to the cloud

Martin FasaniMartin Fasani 12/11/2018 at 08:480 Comments

ESP32 project has moved here:

I'm a bit tired of switching branches all the time and I want to make a very basic version just for one camera model. Started using PlatformIO I find it much more versatile than Arduino, but it's compatible anyways, just open the contents of src/ and put the /data folder in the same level of your sketch. Camera firmware in this FS32 new repo is only for model OV5642 since I find it the best to take good pictures and finally after tweaking the code for weeks I'm able to take 19 good pictures out of 20 which is already much more than the previous rate. Stable code is currently merged on master.

There are two important additions that help to avoid wasting time and disk space:

  1.  Check that the Arducam fifo memory read starts with the JPEG headers 2F / D8 and if not abort upload inmediatly:
  2. Generate an MD5(Arducam_FIFO) and compare to MD5(After_upload)  if it does not match then show a message on the display (Or turn HIGH a digitalWrite to give a signal that upload is corrupt using a LED)
    Optionally you can change the code to save this picture to spiffs only if the upload failed
  3. Point 2 involves returning a JSON string after upload containing:

{"url": "full_url_to_image.jpg",  "hash": "md5_file(uploaded_file)" }
Please check upload-xbm.php for a reference, it can be done in any language following that reply model.

Already with this 2 things is much more versatile and secure to take a picture because you know that it's a JPEG (Also the camera is working good) and also that the upload worked out.
Additionally there are two functions: cameraInit() and cameraOff() that take care of waking up the camera and switching it off after every photo if the config parameter: camera_mosfet is set to 1.