Close
0%
0%

ESP32 / 8266 WiFi instant Camera

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

Public Chat
Similar projects worth following
This WiFi instant camera is powered by a 2000mA/hr LiOn battery and Espressif state of the art WiFi "System of a Chip" allowing to be about 15 hours online and take hundreds of pictures. Press the shutter button and the JPEG will be uploaded to a digital gallery in the next 4 seconds. It’s a pure WiFi camera, without a memory card, so you need to be online to use it. The ESP8266 version allows 3MB of SPI Flash system as offline photo storage. The ESP32 version has save on Spiffs disabled since it's slower (Didn't found out why). It supports also a small oled display (128x64 pixels) and the upload API returns a small thumbnail. Any spare ESP board and Arducam OV2640/5642 will make it work. If it sparks your interest, check the files, and make one.

Todo's first things first:

  1. Make consumption lower. Camera and any display should go to deep sleep after A data from Arducam fifo is read and B after any display shows fore some seconds the thumbnail or the message that the upload is done. UPDATE: Some steps on this direction taken. New versions will use the camera only for the moment to take the picture and then it will be disconnected (VCC off, connected to 3.3v through a P-channel mosfet) I tried to use VEXT on Heltec ESP32 but it does not support 200mA and voltage goes lower than 3v.
    On FS32 esp-32 version of the repository this is already implemented, just set gpioCameraVcc to the gate to your mosfet.
  2. Finish the ESP32 case design and find a good to way to connect power. I'm not satisfied with current Heltec ESP32 Wifi board in terms of battery charging since it drops voltage to a point that after some minutes the Espressif chip resets in a loop.
    UPDATE: Got feedback from the nice people from Heltec automation, the version V2 has this improved, now it's not optimal but it charges battery. Anyways without point 1 is pointless, since there is no battery that can resist 200+ mA of continuous power.

    EXTRA: Make a chunk-uploader to reduce the amount of failed uploads. Not sure if this idea will maturate but sounds challenging and doable. More about this idea here. Working on this next weekend.

    LoRa: There is a design with a Lora Antenna holder in the front. I though that it can be an interesting idea to make a "spy" camera that you can place somewhere as a security measure and will detect movement, take pictures and send a LoRa message. It can be placed remotely and if has no WiFi, can save the images on SPIFFs. Anyone interested ? Sending a 4Kb JPEG via LoRa should be also possible but don't think makes too much sense at the beginning.

History

This project started somewhere around middle Sept, 2018. I was fiddling around with the Wemos D1 and I found out that I could create something to push pictures to the cloud without effort trying a SPI camera. So I just remixed an 3D design I found on Thingiverse and created a very simple WiFI camera. This first version was very raw, it had HTML mixed between C++ lines of code and it did little more than being a point and shoot camera with a one button web UX. This is how it looked after a few design iterations and about 300 grams of PLA wasted:

FS2 print in PETG

But it kick started the feeling that it could be much more.

The pictures where raw like a digital Polaroid, no camera software deciding that I need more light or focus here and multiple shoots. No. Just a raw JPEG delivered as a "best try" to your preferred upload endpoint. That was the beauty I've seen. Simplicity.

But of course not all where Roses and Guns, one of each 10 or 20 pictures, come out like this pictures you can see in the Album broken-uploads.

Then my father, that is an electronic self taught engineer since 20, told me that he wants to take time-lapse pictures of the puzzles he is making. So I started programming this as the first feature that you can preview in this simple gallery pressing the bottom-right Slideshow button.  He later helped me out to try it and kill some bugs.

As an introduction to programming I must say that I'm not a good C++ programmer since I come from a different world professionally, doing mobile API endpoints and Admin-panels for clients here in Germany mostly using PHP and frameworks like Symfony. So I had to first pick a book and digest how this new variable types and strict chars are supposed to work together. It was painful but I got to like it and this project is really my first step on this world of IoT. So please excuse me if you see some horrible coding style there. Just make your own fork and beautify it.

The features that this FS2 camera currently offers are:

  1. WiFi...
Read more »

FS32-back.stl

Second improved version for the Heltec ESP32. This one has a support at the USB side

sla - 439.29 kB - 11/26/2018 at 20:44

Download

FS32-front-with-antenna-holder.stl

If you are planning to use LoRa WiFi then print this to put the antenna in the case, fits the original Heltec ESP 32 Lora ( http://www.heltec.cn/project/wifi-lora-32/?lang=en )

sla - 746.47 kB - 11/25/2018 at 23:04

Download

FS32-back-Heltec-usb-holder.stl

Improved version to fit a Heltec with Oled (128x64). Needs a screw of 2.3x6 mm (2x5 mm will also work)

sla - 7.80 kB - 11/25/2018 at 22:58

Download

FS32-back-Heltec-and-battery-support.stl

Print 2 of this. One to secure the board and second one for the LiOn battery ( I used this LiOn battery: https://www.amazon.de/gp/product/B07CYMYMS9/ref=oh_aui_detailpage_o00_s00 )

sla - 13.36 kB - 11/25/2018 at 22:58

Download

FS2-OV5642-top.stl

Corrected version without holes for the ArduCam OV5642 (5MP)

application/sla - 1.42 MB - 11/10/2018 at 11:55

Download

View all 10 files

  • 1 × ESP32 Heltec Development Board GITHUB: board/esp32-oled branch | Used the version with 0.96inch OLED Display (128x64 pixels) LoRa 32 but you can use also the WiFi 32 without LoRa WiFi
  • 1 × Wemos D1 ESP8266 Board (Select one of them) GITHUB: develop branch | Please make sure to upload always the SPIFFS selecting the most bigger size.
  • 1 × ArduCam OV2640 ( 2 Megapixels and SPI version ) Both OV2640 and OV5642 with 5 Megapixels are supported. NOTE: At least SPI connections should be properly soldered otherwise the photo will look like a Mondrian, just without the charme
  • 1 × Adafruit Micro Lipo MicroUSB battery charger + diode Only if you use a Wemos D1 or similar board without battery charger included
  • 1 × 1 mini square shutter button

View all 8 components

  • ESP32 new version and repository: 2 important additions

    Martin Fasani10 hours ago 0 comments

      ESP32 project has moved here: https://github.com/martinberlin/FS32

      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:
        https://github.com/martinberlin/FS32/blob/master/src/FasarekFS2.ino#L491
      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.

  • Get consumption down

    Martin Fasani11/26/2018 at 14:14 0 comments

      First 3 TOP actions here would be:

      1. Power the camera via a MOSFET or using VEXT if your board supports it, only power it in the second that you take the picture and then disconnect it the hard way
      2. Same with OLED display show anything for no more than 8/10 seconds, then make it off (Or sleep)
      3. If you don't do any server.handleClient() action or you don't press the shooter the ESP32 will go into Deep sleep mode ( Not sure if it makes sense a sleepAfterMinutes new setting, for the moment no )

      Starting taking the necessary steps to make the battery last longer:

      https://github.com/martinberlin/FS2/issues/9 Read this if you are interested in the discussion


  • Finished the ESP32 integration

    Martin Fasani11/09/2018 at 11:38 0 comments

    ESP32 integration and refactoring from the ESP8266 is done. Uses XBM thumbnail rendering as a response from PHP Upload endpoint if you want to use a Board with Oled.  Please refer to this issue to see the JSON example: 

    https://github.com/martinberlin/FS2/issues/2

    The PHP upload endpoint is here in upload-xbm.php : https://github.com/martinberlin/php-gallery
    PHP Gallery is also a small Bootstrap 4 photo uploader and mini preview that is ready to receive the WiFi upload from the camera.

View all 3 project logs

View all 7 instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates