ESP32 Cam - working!

This node red flow, gets triggered by my motion sensor on the gate, and takes a picture on camera 4, stores it locally and sends the picture as an attachment to my email, then camera 2, after 15 second delay, (further up my drive) takes another picture and stores it locally and also sends me an email. The 2 pictures stored locally get over written each time the cameras are triggered (so as not to fill up the HD), but the email’s are individual hence multiple emails upon motion sensor being triggered. I’m using the AI thinker modules, from banggood and ESPhome software.

The set up has been running continuously for a week now and no problems, My camera’s dont have AI Thinker written on them. Other AI Thinker cameras from banggood that do have the AI Thinker logo on them seem to go offline after 10-20 mins and need a reset…

[{"id":"fd9bca74.3c93e8","type":"api-call-service","z":"672e99f5.a6edf8","name":"Front Door Cam","server":"62d7bb2f.196044","service_domain":"camera","service":"snapshot","data":"{\"entity_id\":\"camera.espcam_4\",\"filename\":\"/config/www/photos/doorbell_{{ now().strftime(\\\"%Y%m%d-%H%M%S\\\") }}.jpg\"}","mergecontext":"","output_location":"payload","output_location_type":"msg","x":560,"y":300,"wires":[[]]},{"id":"35499e35.82d0e2","type":"ha-api","z":"672e99f5.a6edf8","name":"","server":"62d7bb2f.196044","protocol":"websocket","method":"get","path":"","data":"{\"type\":\"camera_thumbnail\",\"entity_id\":\"camera.espcam_2\"}","location":"doorbell","locationType":"msg","x":530,"y":460,"wires":[["59f82765.8a0a38"]]},{"id":"8e1e73bd.f9ad7","type":"e-mail","z":"672e99f5.a6edf8","server":"smtp.gmail.com","port":"465","secure":true,"tls":true,"name":"[email protected]","dname":"","x":990,"y":400,"wires":[]},{"id":"59f82765.8a0a38","type":"function","z":"672e99f5.a6edf8","name":"","func":"msg = {\n    topic: `Doorbell Camera @ ${Date()}`,\n    payload: 'Doorbell',\n    attachments: [{\n        \"filename\": \"doorbell.jpg\",\n        \"content\": msg.doorbell.content,\n        \"encoding\": 'base64'\n     }]\n}\nreturn msg;","outputs":1,"noerr":0,"x":790,"y":400,"wires":[["8e1e73bd.f9ad7"]]},{"id":"72893018.fdbbd","type":"server-state-changed","z":"672e99f5.a6edf8","name":"Driveway sensor","server":"62d7bb2f.196044","entityidfilter":"binary_sensor.driveway_sensor","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":140,"y":460,"wires":[["330aa2f.a6d1d5e","e7b80f61.7776b","35499e35.82d0e2"]]},{"id":"330aa2f.a6d1d5e","type":"api-call-service","z":"672e99f5.a6edf8","name":"Drive Cam","server":"62d7bb2f.196044","service_domain":"camera","service":"snapshot","data":"{\"entity_id\":\"camera.espcam_2\",\"filename\":\"/config/www/photos/intruder{{ now().strftime(\\\"%Y%m%d-%H%M%S\\\") }}.jpg\"}","mergecontext":"","output_location":"payload","output_location_type":"msg","x":550,"y":540,"wires":[[]]},{"id":"e7b80f61.7776b","type":"stoptimer","z":"672e99f5.a6edf8","duration":"15","units":"Second","payloadtype":"num","payloadval":"0","name":"","x":350,"y":400,"wires":[["fd9bca74.3c93e8","39221271.cc66ce"],[]]},{"id":"39221271.cc66ce","type":"ha-api","z":"672e99f5.a6edf8","name":"","server":"62d7bb2f.196044","protocol":"websocket","method":"get","path":"","data":"{\"type\":\"camera_thumbnail\",\"entity_id\":\"camera.espcam_4\"}","location":"doorbell","locationType":"msg","x":530,"y":380,"wires":[["59f82765.8a0a38"]]},{"id":"62d7bb2f.196044","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]
2 Likes

Thanks a lot for that. I will try it next time I am at home.

Edit: I tried your flow and it works perfectly. I am quite new to Node-Red so don’t know much about it. I ended up having to duplicate each node to get it to work properly but in the end I got there and now save and receive an image when needed.

Good to hear, I bought some dummy camera housings https://www.amazon.co.uk/gp/product/B00FGP8EGQ/ref=ppx_yo_dt_b_asin_title_o02_s00?ie=UTF8&psc=1
took out the inners and hot glued the cameras in place, mounted them under the eaves for a bit of protection giving me a streaming camera feed in home assistant for £10, can’t really complain at that price.

2 Likes

How are you powering them?

I have a 5v power supply mounted in a waterproof container on my lean to roof (flat roof), I use this to power my external home lighting WG2812 LED’s, ran some small cable from PSU to each of the cameras and they are left running 24/7 recording snapshots each time a visitor enters my drive.

1 Like

What do you recommend Mr Klagio for a similarly priced WiFi cam with night vision? If indeed there is anything available? Cheers!

Check the hackable Xiaomi cam or Keekoon. Just make sure they have rtsp access

I think I saw this - but isn’t it only certain models which are hackable? I’d be concerned about buying the right iteration!

Yes you are right. You might be better off with other brands, just make sure they have rtsp access. Keekoon do. I bought them on Amazon at 30$.
Just check on Amazon for RTSP CAMERA,
there is now one at 25.49€.
Plenty of choices

I use 2 Digoo DG - MYQ … ~10 $/pcs
But they were sending a lot of data so they are blocked from accessing outside world

Saw this recently, worth looking at but I see there have been some onvif problems. Finally found a decent & cheap IP camera: Dericam

1 Like

Didn’t have any problems with them.
Both are streaming to Home Assistant using stream component and at the same time I have them working in MotionEye add-on.
And they are so cheap :wink: … I can see now they cost ~15$

2 Likes

Hi,
Just got one esp32-cam working! But I’m wondering how to use it with motioneye. Is there a way to do that? I know… it was supposed to work with HA but I prefer to have them on motioneye so i can use motion, history playback interface, etc.

1 Like

Hello,

I have an AI-Thinker cam.
What board should I select when configure it?
esphome:
name: camera
platform: ESP32
board: ???

“board”: “esp-wrover-kit”,

substitutions:

Modify variables based on your settings

hostname: ‘my_cam’
ssid: ‘put yours here’
password: ‘put yours here’
esphome:
name: $hostname
platform: ESP32
board: esp-wrover-kit
wifi:

manual_ip:
# Set this to the IP of the ESP
static_ip: 192.168.1.8
# Set this to the IP address of the router. Often ends with .1
gateway: 192.168.1.1
# The subnet of the network. 255.255.255.0 works for most home networks.
subnet: 255.255.255.0
ssid: $ssid
password: $password
fast_connect: True
api:
reboot_timeout: 0s
ota:
logger:

ESP32-CAM2

esp32_camera:
external_clock:
pin: GPIO0
frequency: 20MHz
i2c_pins:
sda: GPIO26
scl: GPIO27
data_pins: [GPIO5, GPIO18, GPIO19, GPIO21, GPIO36, GPIO39, GPIO34, GPIO35]
vsync_pin: GPIO25
href_pin: GPIO23
pixel_clock_pin: GPIO22
power_down_pin: GPIO32

name: my

… Frame Settings

Flashlight

output:

  • platform: gpio
    pin: GPIO4
    id: gpio_4
    light:
  • platform: binary
    output: gpio_4
    name: $hostname light

You can add a statuslight, its a red small led on the back of the board.

output:
#flashlight
  - platform: gpio
    pin: GPIO4
    id: gpio_4
#statuslight
  - platform: gpio
    pin:
      number: GPIO33
      inverted: True
    id: gpio_33
light:
#flashlight
  - platform: binary
    output: gpio_4
    name: $hostname flash
#statuslight
  - platform: binary   
    output: gpio_33
    name: $hostname status
3 Likes

With respect, it is esp32dev. And please forward your code correctly

how you do that?

Please stick to esp32 in this topic.

@RGN01 @daveyrb,

Hi there!
It looks like we have the same camera: I successfully (with same pain) flashed it and it is now working but image quality is terrible.
I am using esphome: image size 800x600, jpeg quality 10 (suggested value by esphome)
What about you? Are you happy with image quality?