Difference between revisions of "APC7921-esp"
(added PCB section) |
(→Boot issue WT32-ETH01) |
||
(10 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{Project | ||
+ | |ProjectStatus=Active | ||
+ | |ProjectNiche=Electronics | ||
+ | |ProjectPurpose=Infrastructure | ||
+ | }} | ||
= Introduction = | = Introduction = | ||
Line 43: | Line 48: | ||
[[https://www.youtube.com/watch?v=OvMxpbQG6Gg Video prooof here]] | [[https://www.youtube.com/watch?v=OvMxpbQG6Gg Video prooof here]] | ||
− | == Iteration 3 == | + | == Iteration 3 ; == |
It turns out that there's now a fair amount of ESP32 boards available with ethernet onboard. Most based on the LAN8770 chipset. | It turns out that there's now a fair amount of ESP32 boards available with ethernet onboard. Most based on the LAN8770 chipset. | ||
Line 61: | Line 66: | ||
First test made: | First test made: | ||
[[https://youtu.be/MdevrENf2K8 See here]] | [[https://youtu.be/MdevrENf2K8 See here]] | ||
− | + | == Current Design == | |
− | = the PCB for on the ESP32 | + | === the PCB for on the ESP32 === |
Todo | Todo | ||
* combine the 2 x 24VDC power sources with diodes and a capacitor | * combine the 2 x 24VDC power sources with diodes and a capacitor | ||
* add pull up/down to A0-A3 for I2C address as power up | * add pull up/down to A0-A3 for I2C address as power up | ||
+ | * 3-phase power sensing: https://learn.openenergymonitor.org/electricity-monitoring/ac-power-theory/3-phase-power?redirected=true | ||
* add voltage detection wiring to ESP32 with step down to 3.3V max (for now using easy 2 resistor method 1KOhm + 10KOhm for 36V down to 3.3V) | * add voltage detection wiring to ESP32 with step down to 3.3V max (for now using easy 2 resistor method 1KOhm + 10KOhm for 36V down to 3.3V) | ||
* fix the grounding of power sources / relais / control circuits | * fix the grounding of power sources / relais / control circuits | ||
Done | Done | ||
+ | * created footprint for power converter 24V -> 3.3V to power control circuit | ||
* remove 4 pins from ESP32 header to accomodate the 3d printed part fixing it to the case | * remove 4 pins from ESP32 header to accomodate the 3d printed part fixing it to the case | ||
Started work on the schematics of the PCB for the WT32 board | Started work on the schematics of the PCB for the WT32 board | ||
[[File:Schema wt32 shield.png]] | [[File:Schema wt32 shield.png]] | ||
+ | |||
+ | === Making the WT32-ETH01 fit the APC === | ||
+ | |||
+ | The WT32-ETH01 is a useful board but rather cumbersome to mount. | ||
+ | While fitting it into the original Ethernet-jack hole would be preferable, it became clear that mounting it in the former SerialPort seems to be much more straightforward. | ||
+ | In short, the board fits by putting the bottom of the PCB onto the metal bottom-plate of the APC and sticking the ethernet-jack through the hole for the serial port. | ||
+ | This has some implications: | ||
+ | * The APC-bottomplate should be taped with Kapton-tape or somesuch to prevent shorts | ||
+ | * There are 3 mounting-points on the front-panel of the APC that allow for mounting the original PCB. | ||
+ | * Mounting the board using these mounting-points requires a plastic adapter-plate | ||
+ | |||
+ | Design for the adapterplate was easy as early ideas for this project involved just replacing the PCB with another; so measurements had been taken and a FreeCad model of the PCB outline existed to be able to 3dprint it for a test-fit. | ||
+ | |||
+ | [[File:Apc-wt32-fitplate-rev7.png|thumb]] | ||
+ | The current iteration of the adapterplate has: | ||
+ | * Three 5mm standoffs to make the space between front-panel and adapter-plate fit the ethernet-jack perfectly | ||
+ | * a cup enveloping the ethernet-jack should supply extra stability and can be used to glue-in | ||
+ | * a hexagonal grid of ribbing stiffens the design against bending while reducing needed filament | ||
+ | [[File:Apc-esp32-eth0-ver7-hex.FCStd.gz]] | ||
+ | [[File:apc-esp32-eth0-BodyPad001-7.stl.tar.gz]] | ||
+ | |||
+ | === Software for the WT32-ETH01; ESPHome === | ||
+ | |||
+ | On the software side things are quite easy for us. | ||
+ | Using ESPHome , we have direct support for: | ||
+ | * Ethernet (done) | ||
+ | * Home-Assistant (done) | ||
+ | * Direct web UI (done) | ||
+ | * pcf8574 i2c expander (done) | ||
+ | * PSU sensing via ADC (wip) | ||
+ | * Current sensing via ADC (wip) | ||
+ | |||
+ | A reference .yaml file is provided here: | ||
+ | [[File:Apc7921-wt32.yaml.gz]] | ||
+ | |||
+ | === Boot issue WT32-ETH01 === | ||
+ | |||
+ | The WT32-ETH01 has a boot issue where it goes in to flash mode when it comes back up after the power is cut. Online there are some sources with possible sollutions. So far none of these sollutions work every boot. | ||
+ | * Add a capacitor between the enable pin and GND | ||
+ | * [[https://wled.discourse.group/t/wt32-eth01-hangs-on-boot-after-psu-power-up/2937/9]] | ||
+ | This will delay the boot until the cap is charged. | ||
+ | |||
+ | still to try | ||
+ | * add a pull-up resistor between IO0 and 3.3v | ||
+ | This will make sure we don't go into flash mode (maybe add a switch for when we need to flash) | ||
= Steps to be taken = | = Steps to be taken = |
Latest revision as of 08:50, 29 July 2023
Projects | |
---|---|
Participants | |
Skills | |
Status | Active |
Niche | Electronics |
Purpose | Infrastructure |
Contents
Introduction
Update history
- Iteration 2 PoC @ 20201007
- Iteration 3 PoC @ 20210829
First steps
The APC7921 controls the relays via an I2C bus which is supplied via a flatcable from the controller-board.
By putting an intermediate board between the controller and the relay-board, we are able to take over the i2c handling, but leave the rest (PSU, etc) to the controller-board to handle for now.
Iteration 1
An initial test for the principle was hacked together in about 2 hours; with the hardest part being to figure out what are the right pins on the esp8266 for i2c (and, to find the right reference which lists the correct order for SDA and SCL... first google-hit was wrong...) The only other 'smart' thing is to add an 1n4148 diode in line with the VCC line as the controller supplies 3.5-3.6volts, which is still within spec, but at the edge of what the esp8266 should be fed with. With the diode in series, Vcc is now at the low-side of the spec: 2.6-2.7 volt. A good thing is that it's well within tolerances for the Vih (high-level input threshold voltage) for the PCF8574 fed on 3.5V; so no issues are to expected with having to level-shift. Obviously, production-model should just run all of it on 3.3V; unless that voltage is not enough to drive the base of the switching-transistor that drives the relay-coil. This is however quite unlikely to be the case as hFE is 35 at worst case, 100 typical.
Iteration 2
Before extending the prototype software with HTTP/JSON/MQTT functionality, I drank a Flora Mate and realized that probably the [ESPHome] software had a way to control pcf8574 , and indeed it did. This resulted in the second iteration of the PoC board to have:
- All 8 relays working
- Have HTTP control interface
- Be able to provide control via API
- Work with HomeAssistant
- Have MDNS announcing
and next to that, ESPHome also:
- Has support for the likely candidate chipset for ethernet-functionality (LAN8720)
- supports using Current Transformers
- Knows how to drive led-displays
- Provides handling of buttons , with automations (resets?)
- Is able to do OTA upgrades
Iteration 3 ;
It turns out that there's now a fair amount of ESP32 boards available with ethernet onboard. Most based on the LAN8770 chipset. More importantly, there's one that seems to fit perfectly into the application
The board in question is the [Wireless-tag.com] board that is intended to be used as a serial-passthrough to ethernet, wifi, bluetooth and seems to also be able to handle RS485. in some way. [ESPhome] has listed the board [here]
This board would be usable almost directly as long as there's a small PCB that takes care of:
- dual 24v PSU connection and monitoring
- _Logic-level translation from 3.3v logic to 5v (perhaps not required)_
- 2x5 2mm headers for PSU and Relay connection
- Provide a way to mount the board in some way
First test made:
[See here]
Current Design
the PCB for on the ESP32
Todo
- combine the 2 x 24VDC power sources with diodes and a capacitor
- add pull up/down to A0-A3 for I2C address as power up
- 3-phase power sensing: https://learn.openenergymonitor.org/electricity-monitoring/ac-power-theory/3-phase-power?redirected=true
- add voltage detection wiring to ESP32 with step down to 3.3V max (for now using easy 2 resistor method 1KOhm + 10KOhm for 36V down to 3.3V)
- fix the grounding of power sources / relais / control circuits
Done
- created footprint for power converter 24V -> 3.3V to power control circuit
- remove 4 pins from ESP32 header to accomodate the 3d printed part fixing it to the case
Started work on the schematics of the PCB for the WT32 board
Making the WT32-ETH01 fit the APC
The WT32-ETH01 is a useful board but rather cumbersome to mount. While fitting it into the original Ethernet-jack hole would be preferable, it became clear that mounting it in the former SerialPort seems to be much more straightforward. In short, the board fits by putting the bottom of the PCB onto the metal bottom-plate of the APC and sticking the ethernet-jack through the hole for the serial port. This has some implications:
- The APC-bottomplate should be taped with Kapton-tape or somesuch to prevent shorts
- There are 3 mounting-points on the front-panel of the APC that allow for mounting the original PCB.
- Mounting the board using these mounting-points requires a plastic adapter-plate
Design for the adapterplate was easy as early ideas for this project involved just replacing the PCB with another; so measurements had been taken and a FreeCad model of the PCB outline existed to be able to 3dprint it for a test-fit.
The current iteration of the adapterplate has:
- Three 5mm standoffs to make the space between front-panel and adapter-plate fit the ethernet-jack perfectly
- a cup enveloping the ethernet-jack should supply extra stability and can be used to glue-in
- a hexagonal grid of ribbing stiffens the design against bending while reducing needed filament
File:Apc-esp32-eth0-ver7-hex.FCStd.gz File:Apc-esp32-eth0-BodyPad001-7.stl.tar.gz
Software for the WT32-ETH01; ESPHome
On the software side things are quite easy for us. Using ESPHome , we have direct support for:
- Ethernet (done)
- Home-Assistant (done)
- Direct web UI (done)
- pcf8574 i2c expander (done)
- PSU sensing via ADC (wip)
- Current sensing via ADC (wip)
A reference .yaml file is provided here: File:Apc7921-wt32.yaml.gz
Boot issue WT32-ETH01
The WT32-ETH01 has a boot issue where it goes in to flash mode when it comes back up after the power is cut. Online there are some sources with possible sollutions. So far none of these sollutions work every boot.
- Add a capacitor between the enable pin and GND
- [[1]]
This will delay the boot until the cap is charged.
still to try
- add a pull-up resistor between IO0 and 3.3v
This will make sure we don't go into flash mode (maybe add a switch for when we need to flash)
Steps to be taken
- Experiment with [ESPHome Current-clamp sensor support] using onboard Current-transformer(s)
- Check function of relay board with 3.3V IO
- Work on approach for driving LED-display OR replace with TFT/OLED (all supported by ESPHome)
- Produce some extra 2mm->2.54mm convertor-cables for experimentation/splicing
- PCB design, first steps
- Make PCB-template for KiCad based on measurements
- Produce BOM for essential components; headers, jacks, PSU, Schottky-diodes, ESP32-module (suggested: with uFL)
- Field-test Ethernet-functionality of ESP32/ESPHome based on ordered Lan8720 modules (6 arriving end of Oct)