Skip to content

Instantly share code, notes, and snippets.

@Snipercaine
Created April 28, 2019 21:16
Show Gist options
  • Star 19 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save Snipercaine/d8345571563536e9661422c3509d1119 to your computer and use it in GitHub Desktop.
Save Snipercaine/d8345571563536e9661422c3509d1119 to your computer and use it in GitHub Desktop.
substitutions:
devicename: ttgocam
friendly_name: test esp32cam
ip_address: 192.168.1.230
esphome:
name: $devicename
platform: ESP32
board: esp-wrover-kit
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_psk
manual_ip:
static_ip: $ip_address
gateway: 192.168.1.1
subnet: 255.255.255.0
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
binary_sensor:
- platform: gpio
pin: GPIO33
name: $friendly_name PIR
device_class: motion
- platform: gpio
pin:
number: GPIO34
mode: INPUT_PULLUP
inverted: True
name: $friendly_name Button
- platform: status
name: $friendly_name Status
sensor:
- platform: wifi_signal
name: $friendly_name WiFi Signal
update_interval: 10s
- platform: uptime
name: $friendly_name Uptime
esp32_camera:
name: $friendly_name Camera
external_clock:
pin: GPIO32
frequency: 20MHz
i2c_pins:
sda: GPIO13
scl: GPIO12
data_pins: [GPIO5, GPIO14, GPIO4, GPIO15, GPIO18, GPIO23, GPIO36, GPIO39]
vsync_pin: GPIO27
href_pin: GPIO25
pixel_clock_pin: GPIO19
power_down_pin: GPIO26
resolution: 640x480
jpeg_quality: 10
vertical_flip: false
horizontal_mirror: false
i2c:
sda: GPIO21
scl: GPIO22
font:
- file: "fonts/times-new-roman.ttf"
id: tnr1
size: 20
- file: "fonts/times-new-roman.ttf"
id: tnr2
size: 35
time:
- platform: homeassistant
id: homeassistant_time
display:
- platform: ssd1306_i2c
model: "SSD1306 128x64"
address: 0x3C
lambda: |-
it.strftime(64, 0, id(tnr1), TextAlign::TOP_CENTER,"%d-%m-%Y", id(homeassistant_time).now());
it.strftime(64, 64, id(tnr2), TextAlign::BASELINE_CENTER, "%H:%M", id(homeassistant_time).now());
@iccoVN
Copy link

iccoVN commented Oct 17, 2020

I used this code but seems it doesn't work after some updates

[20:54:53][E][camera.c:1270] esp_camera_init(): Camera init failed with error 0x20003
[20:54:53][E][esp32_camera:017]: esp_camera_init failed: ERROR

@Bazmundi
Copy link

Bazmundi commented Feb 15, 2021

@iccoVN. Can't help you myself with your problem, sorry.

For general consumption the following info may help depending on the version of TTGO T-Camera you lucked into.

I seem to have a T_CarmerV162. The page that linked to this gist was a youtube tutorial by DrZzs, that appears to be using a T_CarmerV17. The pins in the gist above certainly do map to the T_CarmerV17.

There may therefore be pinout differences to take account of. If you are having a problem, check your TTGO T-Camera version against the series info.

Don't forget this is also covered (somewhat) at ESPHome with the ESP32 Camera component.

@chjud
Copy link

chjud commented Nov 11, 2022

@Bazmundi What you wrote is absolutely right.
Modified YAML with Pinout for v162 (with Mic on board, but not working)

substitutions:
  devicename: doorbell
  friendly_name: doorbell
#  ip_address: 192.168.25.230

esphome:
  name: $devicename
  platform: ESP32
  board: esp-wrover-kit

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
#  manual_ip:
#    static_ip: $ip_address
#    gateway: 192.168.25.1
#    subnet: 255.255.255.0


# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

binary_sensor:
  - platform: gpio
    pin: GPIO19 #33
    name: $friendly_name PIR
    device_class: motion

  - platform: gpio
    pin:
      number: GPIO15 #34
#      mode: INPUT_PULLUP
      inverted: True
    name: $friendly_name Button

  - platform: status
    name: $friendly_name Status

sensor:
  - platform: wifi_signal
    name: $friendly_name WiFi Signal
    update_interval: 10s
  - platform: uptime
    name: $friendly_name Uptime

esp32_camera:
  name: $friendly_name Camera
  external_clock:
    pin: GPIO4 #32 not sure!
    frequency: 20MHz
  i2c_pins:
    sda: GPIO18 #13
    scl: GPIO23 #12
  data_pins: [GPIO34, GPIO13, GPIO14, GPIO35, GPIO39, GPIO38, GPIO37, GPIO36] #[GPIO5, GPIO14, GPIO4, GPIO15, GPIO18, GPIO23, GPIO36, GPIO39]
  vsync_pin: GPIO5 #27
  href_pin: GPIO27 #25
  pixel_clock_pin: GPIO25 #19
  # power_down_pin: GPIO26 No PWD GPIO existing
  resolution: 640x480
  jpeg_quality: 10
  vertical_flip: false
  horizontal_mirror: false

i2c:
  sda: GPIO21
  scl: GPIO22

font:
  - file: "fonts/times-new-roman.ttf"
    id: tnr1
    size: 20
  - file: "fonts/times-new-roman.ttf"
    id: tnr2
    size: 35

time:
  - platform: homeassistant
    id: homeassistant_time

display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    address: 0x3C
    lambda: |-
      it.strftime(64, 0, id(tnr1), TextAlign::TOP_CENTER,"%d-%m-%Y", id(homeassistant_time).now());
      it.strftime(64, 64, id(tnr2), TextAlign::BASELINE_CENTER, "%H:%M", id(homeassistant_time).now());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment