Selaa lähdekoodia

giessomat i2c expansion

Thomas Buck 2 vuotta sitten
vanhempi
commit
51f748993b

+ 99
- 1
input/projects/giessomat.md Näytä tiedosto

@@ -4,7 +4,7 @@ parent: projects
4 4
 position: 6
5 5
 github: https://git.xythobuz.de/thomas/giess-o-mat
6 6
 date: 2021-03-29
7
-update: 2021-11-17
7
+update: 2022-02-07
8 8
 ---
9 9
 
10 10
 This project [was featured on Hackaday](https://hackaday.com/2021/05/14/automated-watering-machine-has-what-plants-crave-fertilizer/)!
@@ -244,6 +244,8 @@ KP_R4 <---| | * | | 0 | | # | |                |   --------------------   |
244 244
 
245 245
 As you can see, the schematic is relatively simple, not doing much more than connecting some modules with each other.
246 246
 I did not (have to) add any kind of filtering or other passive circuitry.
247
+The only exception are **flyback diodes** for all inductive loads connected after the relais.
248
+They are not included in the schematics, so **don't forget to add appropriate ones**, depending on the exact valves you use.
247 249
 
248 250
 On the schematic above, only the four required connections between controller and user interface are shown.
249 251
 I have used a DB-9 connector, running the power switch as well as the other voltages generated on the controller over it.
@@ -380,6 +382,102 @@ lightgallery([
380 382
 For a work-around, I simply replaced the power supply, now driving everything with 13.5V instead of 12V.
381 383
 This seems to solve the issue for now.
382 384
 
385
+## GPIO Expansion / Door Lock Update (February 2022)
386
+
387
+After a year of operating the Gieß-o-mat the time came to expand it with some more outlets.
388
+Because unused GPIOs on the ESP32 are starting to run out, I decided to try and add an I2C GPIO expansion for more relais.
389
+
390
+For this I used the [PCF8574](https://www.ti.com/product/PCF8574), which I already used in the past, but can now be bought easily [on nice little breakout boards](https://amzn.to/3LjmCav).
391
+As before, I added some [relais modules](https://amzn.to/3uwMYzT) to drive four more outlet [solenoid valves](https://www.ebay.de/itm/353234654746).
392
+As mentioned above, take care to add flyback diodes to all inductive loads (for the relais inductors, these are already included on the modules).
393
+
394
+<!--%
395
+lightgallery([
396
+    [ "img/giessomat_i2c_expansion.jpg", "Photo of I2C expansion, filtering caps still missing." ],
397
+])
398
+%-->
399
+
400
+Unfortunately, the breakout modules don't contain any filtering capacitors.
401
+Because of the long cable length to the expansion, as well as the relatively high power requirements of the loads, I had some issues with the power supply at the expansion.
402
+The ESP itself ran fine, only the PCF8574 saw a voltage glitch large enough that it resets.
403
+This caused the relais to try to turn on for a very brief time (milliseconds), immediately causing the supply voltage to the PCF to fall, which resets and then turns the relais off again.
404
+
405
+Adding liberal amounts of filtering capacitors (330µF) to all three power rails going to the expansion (12V, 5V, 3.3V), as well as more caps directly at the PCF module (3900µF), helped enough to completely fix the issue.
406
+
407
+<div class="textwrap"><pre class="ascii">
408
+Giess-o-mat I2C GPIO Expansion Schematic
409
+
410
+              --------
411
+  +13.5V <---|x +12V  |
412
+   +5V_R <---|x +5V_R |
413
+    +3V3 <---|x +3V3  |
414
+ ESP_SDA <---|x SDA   |
415
+ ESP_SCL <---|x SCL   |
416
+     GND <---|x GND   |
417
+              --------
418
+
419
+           ---------------------
420
+          |        Relais       |
421
+  GND <---|x GND    ----   NC1 x|
422
+   R1 <---|x R1    |    | COM1 x|---> +13.5V
423
+   R2 <---|x R2     ----   NO1 x|---> V6
424
+   R3 <---|x R3     ----   NC2 x|
425
+   R4 <---|x R4    |    | COM2 x|---> +13.5V
426
+ +3V3 <---|x VCC    ----   NO2 x|---> V7
427
+          |         ----   NC3 x|
428
+          |        |    | COM3 x|---> +13.5V
429
+          |         ----   NO3 x|---> V8
430
+          |         ----   NC4 x|
431
+          |        |    | COM4 x|---> +13.5V
432
+          |         ----   NO4 x|---> V9
433
+          |x VCC                |
434
++5V_R <---|x JC-VCC             |
435
+           ---------------------
436
+
437
+              -----------------
438
+    +3V3 <---|x VCC   P   IO1 x|--> R1
439
+     GND <---|x GND   C   IO2 x|--> R2
440
+ ESP_SDA <---|x SDA   F   IO3 x|--> R3
441
+ ESP_SCL <---|x SCL       IO4 x|--> R4
442
+             |        8   IO5 x|
443
+             |        5   IO6 x|
444
+             |        7   IO7 x|
445
+             |        4   IO8 x|
446
+              -----------------
447
+
448
+        330µF                    330µF
449
++3V3 <---||---> GND    +13.5V <---||---> GND
450
+       |    |
451
+        -||-            +5V_R <---||---> GND
452
+       3900µF                    330µF
453
+</pre></div>
454
+
455
+Below you can see some screenshots I took on my scope.
456
+
457
+<!--%
458
+lightgallery([
459
+    [ "img/giessomat_oszi_1.png", "12V rail glitching when turning on load" ],
460
+    [ "img/giessomat_oszi_3.png", "12V and 3.3V rail glitching when turning on load" ],
461
+    [ "img/giessomat_oszi_4.png", "As before, but moved side-by-side" ],
462
+    [ "img/giessomat_oszi_5.png", "With some more filtering caps" ],
463
+])
464
+%-->
465
+
466
+CH1 (yellow) is the 12V rail, CH2 (blue) is the 3.3V rail.
467
+In the first three screenshots you can see the glitch caused by switching on one of the loads at the GPIO expansion.
468
+The 12V rail goes down to about 5V and up to 19V.
469
+The 3.3V rail, at the same time, even goes slightly below 0V and up to nearly 7V.
470
+To be honest, I'm surprised nothing died in these experiments.
471
+On the last screenshot, with some filtering in place, you can see that the relais now keeps turned on, with the load dropping the 12V rail to about 8V.
472
+The last screenshot was still missing the 3900µF on the 3.3V rail, and there were still some problems then.
473
+
474
+Recently [bigclivedotcom reviewed chinese door lock solenoids](https://www.youtube.com/watch?v=hHuI2LSeTHI).
475
+I [ordered some](https://aliexpress.com/item/1005001526243239.html) as well and added them to my "greenhouse" doors.
476
+Because they pull a lot of current, I had to use another separate 12V power supply.
477
+
478
+The software [has been updated](https://git.xythobuz.de/thomas/giess-o-mat/commit/6de07b6cc9664cf78b337dc4b86d29a61fb20410) to now support 16 I2C GPIO expanders with 8 pins each, for all supported functions (valves, pumps, stirrers, locks).
479
+To unlock the doors I [added](https://git.xythobuz.de/thomas/giess-o-mat/commit/70659caf77d655febd31a877d98070db76cb462e) an optional PIN entry function on the start screen of the UI.
480
+
383 481
 ## Links
384 482
 
385 483
 You can find [all the source code for the device itself](https://git.xythobuz.de/thomas/giess-o-mat) (both the UI and the Controller) as well as the OpenSCAD [design files for the 3D printed parts](https://git.xythobuz.de/thomas/3d-print-designs/src/branch/master/giessomat) on my [Gitea instance](https://git.xythobuz.de).

BIN
static/img/giessomat_i2c_expansion.jpg Näytä tiedosto


BIN
static/img/giessomat_i2c_expansion_small.jpg Näytä tiedosto


BIN
static/img/giessomat_oszi_1.png Näytä tiedosto


BIN
static/img/giessomat_oszi_1_small.png Näytä tiedosto


BIN
static/img/giessomat_oszi_2.png Näytä tiedosto


BIN
static/img/giessomat_oszi_2_small.png Näytä tiedosto


BIN
static/img/giessomat_oszi_3.png Näytä tiedosto


BIN
static/img/giessomat_oszi_3_small.png Näytä tiedosto


BIN
static/img/giessomat_oszi_4.png Näytä tiedosto


BIN
static/img/giessomat_oszi_4_small.png Näytä tiedosto


BIN
static/img/giessomat_oszi_5.png Näytä tiedosto


BIN
static/img/giessomat_oszi_5_small.png Näytä tiedosto


Loading…
Peruuta
Tallenna