OV7670 with FIFO

This project shows how to interface the cheap OV7670 camera with FIFO using an ESP32 and display the image on an SPI TFT.

You can find the details on the project without the FIFO here.

Parts

The parts used here are the LOLIN32 microcontroller. Any ESP32 board can be used. The code is currently independent of the actual processor, so you can use also different platforms.

The camera is the cheap OV7670 with FIFO (AL422b). The camera supports up to VGA resolution but the FIFO can only store 3MBit. This is just sufficient for QQVGA or section of higher resolutions.

The “real-time” output is done on the 1.8″ SPI TFT display. Due to the single data line, the update rate is really limited. To be able to run the display on 3.3V the jumper on the back side must be closed.

  • Where to get them

These links are also supporting my work but I don’t mind if you find a cheaper source 😉

Schematics

The pin connections of the devices can also be found in the code. The definitions can be changed except for MOSI and SCK for the SPI interface which is native on these pins on the ESP32. Using other microcontrollers, the corresponding native SPI pins have to be used.

There are some limitations configuring the pins of the ESP32. Pins 34, 35, 36(VP), 39(VN) are read-only. Those can’t be used for I2C, the clock (XCLK) or TFT signals. Pins 0, 2 and 5 are used as boot signals. Those should not be used as inputs to avoid problems while programming. Pin 5 is also attached to the LED on the LOLIN32 board. Pins 6-11 (if available) are a no go since those are wired to the SPI flash memory connected to the ESP32.

Code

The code can be found in my github repository:
https://github.com/bitluni/ESP32Camera

  • The code is based on the ESP32 integration in the Arduino IDE. You need:
    Arduino IDE
  • ESP32 integration
  • Adafruit GFX library
  • Adafruit ST7735 library

Node.RED flow

This a simple flow that takes the IP announced by the ESP32 and constructs an iframe for Node.RED dashboard that shows the images from the camera

[{"id":"9ecc75dd.22e2e8","type":"mqtt in","z":"5a254896.947618","name":"","topic":"home/camera1","qos":"1","broker":"171132c7.ece67d","x":168.8333282470703,"y":222.0666732788086,"wires":[["784e5a67.89db04"]]},{"id":"6bd0fd9c.4f3c14","type":"ui_template","z":"5a254896.947618","group":"d960fd60.7c918","name":"","order":0,"width":"6","height":"5","format":"","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":612.83349609375,"y":222.0667266845703,"wires":[[]]},{"id":"784e5a67.89db04","type":"function","z":"5a254896.947618","name":"camera iframe","func":"msg.template = \"<iframe frameborder='0' width='100%' height='100%' src='http://\" + msg.payload + \"'></iframe>\";\nreturn msg;","outputs":1,"noerr":0,"x":408.83337783813477,"y":222.20002460479736,"wires":[["6bd0fd9c.4f3c14"]]},{"id":"171132c7.ece67d","type":"mqtt-broker","z":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""},{"id":"d960fd60.7c918","type":"ui_group","z":"","name":"Camera","tab":"e694697d.4bec28","order":1,"disp":false,"width":"6"},{"id":"e694697d.4bec28","type":"ui_tab","z":"","name":"Camera","icon":"dashboard","order":5}]

Datasheets

These are the useful sheets I found so far. If you have more resources please contact me

Similar projects