Project

Algemeen

Profiel

Esphome » Geschiedenis » Versie 5

Micha Kersloot, 14-04-2023 19:59

1 1 Micha Kersloot
h1. Esphome
2
3 4 Micha Kersloot
{{>toc}}
4
5 1 Micha Kersloot
h2. TTGO T-Journal
6
7 2 Micha Kersloot
The T-journal is able to communicate the battery state over i2c. After bridging the pads as shown in the picter the IP5306 that is used is connected to pins 13 (scl) and 14 (sda). 
8 1 Micha Kersloot
9 2 Micha Kersloot
!clipboard-202303271732-dyvee.png!
10
11 3 Micha Kersloot
12
working configuration:
13
<pre>
14
substitutions:
15
  device_name: "cam01"
16
17
esphome:
18
  name: '${device_name}'
19
20
esp32:
21
 board: esp32dev
22
 framework:
23
   type: arduino
24
25
# Enable Home Assistant API
26
api:
27
  encryption:
28
    key: "xxxxxxxxxxxx"
29
30
ota:
31
  password: "xxxxxxxxxxxxx"
32
33
wifi:
34
  ssid: !secret wifi_ssid
35
  password: !secret wifi_password
36
37
  # Enable fallback hotspot (captive portal) in case wifi connection fails
38
  ap:
39
    ssid: "cam01 Fallback Hotspot"
40
    password: "xxxxxxx"
41
42
captive_portal:
43
44
external_components:
45
  - source:
46
      type: git
47
      url: https://github.com/MichaKersloot/esphome_custom_components
48
    components: [ ip5306, esp32_camera ]
49
50
i2c:
51
  - id: bus_a
52
    sda: 14
53
    scl: 13
54
    frequency: 400kHz
55
    scan: true    
56
57
ip5306:
58
  battery_level:   # sensor
59
    name: '${device_name} - Battery Level'
60
  charger_connected:  # binary_sensor
61
    id: connected
62
    on_press:
63
      then:
64
        - lambda: ESP_LOGD("TEST", "charging");
65
    on_release:
66
      then:
67
        - lambda: ESP_LOGD("TEST", "not charging");
68
  charge_full:  # binary_sensor
69
    id: full
70
    on_press:
71
      then:
72
        - lambda: ESP_LOGD("TEST", "fully charged");
73
    on_release:
74
      then:
75
        - lambda: ESP_LOGD("TEST", "still charging");
76
77
esp32_camera:
78
  name: '${device_name} - camera'
79
  external_clock:
80
    pin: GPIO27
81
    frequency: 20MHz
82
  i2c_pins:
83
    sda: GPIO25
84
    scl: GPIO23
85
  data_pins: [GPIO17, GPIO35, GPIO34, GPIO5, GPIO39, GPIO18, GPIO36, GPIO19]
86
  vsync_pin: GPIO22
87
  href_pin: GPIO26
88
  pixel_clock_pin: GPIO21
89
  agc_gain_ceiling: 8x
90
  # jpeg_quality: 16
91
  # max_framerate: 25Hz
92
  contrast: 0
93
  brightness: 1
94
  saturation: 0
95
  ae_level: 2
96
  # aec2: True
97
  horizontal_mirror: false
98
  vertical_flip: false
99
  resolution: 800x600
100
101
esp32_camera_web_server:
102
  - port: 8080
103
    mode: stream
104
  - port: 8081
105
    mode: snapshot
106
</pre>
107
108
109 2 Micha Kersloot
If you are unable to program:
110
111 1 Micha Kersloot
  python -m esptool --chip esp32 --port COM5 --baud 115200 --after hard_reset erase_flash
112
113 2 Micha Kersloot
and if even that doesn't solve it:
114 1 Micha Kersloot
115
  python -m esptool --port COM5 write_flash_status --non-volatile 0
116 4 Micha Kersloot
117
h2. p1 dsmr power meter with TTGO T7 v1.3 mini
118
119
I'm using a TTGO T7 v1.3 mini with and end of a phone cable with an RJ11 connector. I soldered the connections direct to the board.
120
121
!clipboard-202304142146-wfydy.png!
122 5 Micha Kersloot
123
On RJ11, pin 1 and pin 6 are not connected / available
124
125
|_.RJ11 P1|_.ESP32 Pin|_.4w cable|_.comments|
126
|2 - CTS|GPIO19|black|Clear to Send, High = allow P1 Meter to send data|
127
|3 - Data GND|GND|red||
128
|4 - nc|-|green||
129
|5 - RXD (data)|GPIO16|yellow|1K external pull-up resistor needed|
130
131
!clipboard-202304142159-fj2tf.png!