Wiki source code of Documentazione

Last modified by Micky Grillo on 2023/02/24 00:32

Hide last authors
Micky Grillo 1.1 1 = Pinout =
2
Micky Grillo 1.2 3 [[image:http://192.168.82.200:2665/uploads/images/gallery/2023-02/kc868-e16s-1-04.jpg]]
Micky Grillo 1.1 4
5 I modelli che abbiamo acquistato usano 12V come alimentazione
6
7 I relays sono OMRON G2R-1-E
8
9
10 = Schematica =
11
Micky Grillo 1.2 12 [[image:http://192.168.82.200:2665/uploads/images/gallery/2023-02/2023-02-02-00-21-51-kc868-e16s-schematic-pdf-adobe-acrobat-reader-64-bit.png||height="917" width="1301"]]
Micky Grillo 1.1 13
14 [[attach:KC868-E16S-schematic.pdf||target="_blank"]]
15
16
17 = Definizione e esempio YAML =
18
19 == Definizione: ==
20
21 {{code language="yaml"}}
22 ANALOG_A1 GPIO36
23 ANALOG_A2 GPIO35
24 ANALOG_A3 GPIO34
25 ANALOG_A4 GPIO39
26
27 IIC SDA:GPIO16
28 IIC SCL:GPIO15
29
30 PCF8574:U27 (relay1-8): 100 001 = 0x21
31 PCF8574:U28 (relay9-16): 100 101 = 0x25
32
33 PCF8574:U23 (DI1-8): 100 010 = 0x22
34 PCF8574:U24 (DI9-16): 100 100 = 0x24
35
36 RF433MHz wireless receiver: GPIO4
37
38 BEEP:GPIO2
39
40 Ethernet (LAN8720) I/O define:
41
42 #define ETH_ADDR 0
43 #define ETH_POWER_PIN -1
44 #define ETH_MDC_PIN 23
45 #define ETH_MDIO_PIN 18
46 #define ETH_TYPE ETH_PHY_LAN8720
47 #define ETH_CLK_MODE ETH_CLOCK_GPIO17_OUT
48
49 --------------------
50 RS485:
51 RXD:GPIO13
52 TXD:GPIO32
53
54 Extend serial port (3.3v TTL level):
55 RXD:GPIO14
56 TXD:GPIO33
57 {{/code}}
Micky Grillo 1.2 58
59
60 == YAML: ==
61
62 {{code language="yaml"}}
63 esphome:
64 name: kc868-e16s
65 platform: ESP32
66 board: esp32dev
67
68
69 # Example configuration entry for ESP32
70 i2c:
71 sda: 16
72 scl: 15
73 scan: true
74 id: bus_a
75
76
77 # Example configuration entry
78 ethernet:
79 type: LAN8720
80 mdc_pin: GPIO23
81 mdio_pin: GPIO18
82 clk_mode: GPIO17_OUT
83 phy_addr: 0
84
85 # Optional manual IP
86 # manual_ip:
87 # static_ip: 192.168.1.199
88 # gateway: 192.168.1.1
89 # subnet: 255.255.255.0
90
91
92 # Example configuration entry
93 pcf8574:
94 - id: 'pcf8574_hub_out_1' # for output channel 1-8
95 address: 0x21
96
97 - id: 'pcf8574_hub_out_2' # for output channel 9-16
98 address: 0x25
99
100 - id: 'pcf8574_hub_in_1' # for input channel 1-8
101 address: 0x22
102
103 - id: 'pcf8574_hub_in_2' # for input channel 9-16
104 address: 0x24
105
106 # Individual outputs
107 switch:
108 - platform: gpio
109 name: "e16s-output1"
110 pin:
111 pcf8574: pcf8574_hub_out_1
112 number: 0
113 mode: OUTPUT
114 inverted: true
115
116 - platform: gpio
117 name: "e16s-output2"
118 pin:
119 pcf8574: pcf8574_hub_out_1
120 number: 1
121 mode: OUTPUT
122 inverted: true
123
124 - platform: gpio
125 name: "e16s-output3"
126 pin:
127 pcf8574: pcf8574_hub_out_1
128 number: 2
129 mode: OUTPUT
130 inverted: true
131
132 - platform: gpio
133 name: "e16s-output4"
134 pin:
135 pcf8574: pcf8574_hub_out_1
136 number: 3
137 mode: OUTPUT
138 inverted: true
139
140 - platform: gpio
141 name: "e16s-output5"
142 pin:
143 pcf8574: pcf8574_hub_out_1
144 number: 4
145 mode: OUTPUT
146 inverted: true
147
148 - platform: gpio
149 name: "e16s-output6"
150 pin:
151 pcf8574: pcf8574_hub_out_1
152 number: 5
153 mode: OUTPUT
154 inverted: true
155
156 - platform: gpio
157 name: "e16s-output7"
158 pin:
159 pcf8574: pcf8574_hub_out_1
160 number: 6
161 mode: OUTPUT
162 inverted: true
163
164 - platform: gpio
165 name: "e16s-output8"
166 pin:
167 pcf8574: pcf8574_hub_out_1
168 number: 7
169 mode: OUTPUT
170 inverted: true
171
172 - platform: gpio
173 name: "e16s-output9"
174 pin:
175 pcf8574: pcf8574_hub_out_2
176 number: 0
177 mode: OUTPUT
178 inverted: true
179
180 - platform: gpio
181 name: "e16s-output10"
182 pin:
183 pcf8574: pcf8574_hub_out_2
184 number: 1
185 mode: OUTPUT
186 inverted: true
187
188 - platform: gpio
189 name: "e16s-output11"
190 pin:
191 pcf8574: pcf8574_hub_out_2
192 number: 2
193 mode: OUTPUT
194 inverted: true
195
196 - platform: gpio
197 name: "e16s-output12"
198 pin:
199 pcf8574: pcf8574_hub_out_2
200 number: 3
201 mode: OUTPUT
202 inverted: true
203
204 - platform: gpio
205 name: "e16s-output13"
206 pin:
207 pcf8574: pcf8574_hub_out_2
208 number: 4
209 mode: OUTPUT
210 inverted: true
211
212 - platform: gpio
213 name: "e16s-output14"
214 pin:
215 pcf8574: pcf8574_hub_out_2
216 number: 5
217 mode: OUTPUT
218 inverted: true
219
220 - platform: gpio
221 name: "e16s-output15"
222 pin:
223 pcf8574: pcf8574_hub_out_2
224 number: 6
225 mode: OUTPUT
226 inverted: true
227
228 - platform: gpio
229 name: "e16s-output16"
230 pin:
231 pcf8574: pcf8574_hub_out_2
232 number: 7
233 mode: OUTPUT
234 inverted: true
235
236 binary_sensor:
237 - platform: gpio
238 name: "e16s-input1"
239 pin:
240 pcf8574: pcf8574_hub_in_1
241 number: 0
242 mode: INPUT
243 inverted: true
244
245 - platform: gpio
246 name: "e16s-input2"
247 pin:
248 pcf8574: pcf8574_hub_in_1
249 number: 1
250 mode: INPUT
251 inverted: true
252
253 - platform: gpio
254 name: "e16s-input3"
255 pin:
256 pcf8574: pcf8574_hub_in_1
257 number: 2
258 mode: INPUT
259 inverted: true
260
261 - platform: gpio
262 name: "e16s-input4"
263 pin:
264 pcf8574: pcf8574_hub_in_1
265 number: 3
266 mode: INPUT
267 inverted: true
268
269 - platform: gpio
270 name: "e16s-input5"
271 pin:
272 pcf8574: pcf8574_hub_in_1
273 number: 4
274 mode: INPUT
275 inverted: true
276
277 - platform: gpio
278 name: "e16s-input6"
279 pin:
280 pcf8574: pcf8574_hub_in_1
281 number: 5
282 mode: INPUT
283 inverted: true
284
285 - platform: gpio
286 name: "e16s-input7"
287 pin:
288 pcf8574: pcf8574_hub_in_1
289 number: 6
290 mode: INPUT
291 inverted: true
292
293 - platform: gpio
294 name: "e16s-input8"
295 pin:
296 pcf8574: pcf8574_hub_in_1
297 number: 7
298 mode: INPUT
299 inverted: true
300
301 - platform: gpio
302 name: "e16s-input9"
303 pin:
304 pcf8574: pcf8574_hub_in_2
305 number: 0
306 mode: INPUT
307 inverted: true
308
309 - platform: gpio
310 name: "e16s-input10"
311 pin:
312 pcf8574: pcf8574_hub_in_2
313 number: 1
314 mode: INPUT
315 inverted: true
316
317 - platform: gpio
318 name: "e16s-input11"
319 pin:
320 pcf8574: pcf8574_hub_in_2
321 number: 2
322 mode: INPUT
323 inverted: true
324
325 - platform: gpio
326 name: "e16s-input12"
327 pin:
328 pcf8574: pcf8574_hub_in_2
329 number: 3
330 mode: INPUT
331 inverted: true
332
333 - platform: gpio
334 name: "e16s-input13"
335 pin:
336 pcf8574: pcf8574_hub_in_2
337 number: 4
338 mode: INPUT
339 inverted: true
340
341 - platform: gpio
342 name: "e16s-input14"
343 pin:
344 pcf8574: pcf8574_hub_in_2
345 number: 5
346 mode: INPUT
347 inverted: true
348
349 - platform: gpio
350 name: "e16s-input15"
351 pin:
352 pcf8574: pcf8574_hub_in_2
353 number: 6
354 mode: INPUT
355 inverted: true
356
357 - platform: gpio
358 name: "e16s-input16"
359 pin:
360 pcf8574: pcf8574_hub_in_2
361 number: 7
362 mode: INPUT
363 inverted: true
364
365 # Enable logging
366 logger:
367
368 # Enable Home Assistant API
369 api:
370 {{/code}}
371
372