Import Arduino code to ESPHome - ESP32 Cam

I have a ESP32 Cam and MB from Amazon. I’ve installed ESPHome and got the cam working in HA.

On a spare ESP cam, I’ve installed this cam demo which works a treat, exactly what I need!

Question is, when building, can I also import that file either locally or via a git pull?

1 Like

That looks like a nice piece of kit, thanks for posting!

Sorry I can’t answer your question, but I am interested in any answers you get. I see myself buying a handful of these in the near future.

Also, what does the Arduino code do that the ESPHome code doesn’t?

No, you cannot use the code as-is in ESPHome.
If you have experience in C++/Arduino, you can re-use the concept of the code in a ESPHome custom component, but requires development work / skills.

1 Like

No worries :slight_smile: let me know if you ever manage to get this into ESP Home!
In short, the main function I want is using the SD card in 1bit mode so I can free up other pins on the ESP32-CAM-MB.

The benefits are actually quite useful…

  • Makes use of the onboard SD Card
    –Also uses 1-bit mode as described below. which frees up pins 12 & 13

SD card support (using 1-bit mode - gpio pins are usually 2, 4, 12 & 13 but using 1bit mode only uses pin 2) - I have heard there may be problems reading the sd card, I have only used it to write files myself?

  • Uses the flash when taking an image (and ability to disable this function)
  • Simple web interface (could be improved) but does the job
  • Enable live stream when required (so it doesn’t kill the board)
  • Ability to customise the LEDs / Brightness / on-off

This was my initial thought.
I have some experience with C++ but little with Arduino (and want to keep it that way - prefer ESPHome).

My initial thoughts (and I’m probably way off) - is that the code would just need altering slightly to not pull some libraries(?) but not 100% sure what needs editing from the GitHub file.

I’ve also looked into the ESPHome Custom Component but again I’m not too familiar with it.

I think for now I’ll leave that standard software on (even thought I can’t get pin13 connected to a motion sensor!).


On a separate note, I’m also confused about the boards when using ESPHome.
For the above ESP32 CAM, I’m using this config but not sure on how to find a list of boards and the GPIOs.

esphome:
  name: camnode
  platform: ESP32
  board: esp32dev