I’m working on my first custom ESPHome project based on a 4 relay esp32 board. It controls a Coop Controls (CC) door actuator on a chicken coop.
So far I’ve got basics down. Two relays trigger the CC to open or close, and I’m using a reed switch to detect if the door is closed. It’s a swing type door so it’s not practical to use a second reed switch like in this example
Is it possible to use the +/- DC voltage at the motor terminals to detect whether the door is opening or closing, and along with the reed switch infer all the states within the ESPHome programming?
We’d be making an assumption for the “open” state, but the other states should be confident.
Here’s my config so far, but I’m anticipating it will need to get revamped.
Yes. Just make voltage divider with two resistors to drop the sensing voltage to 3.3V. Then with two binary sensors you can detect all 3 states motor has. Make sure to have common GND between door power supply and Esp.
I left out a detail, I’ll edit the question. I meant to ask: is it possible to do this within the ESPHome programming itself?
Regarding common GND, the ESP is powered by the CC’d backup 12v battery which is charged by the CC board. How do I assess whether there is a common ground? Is that already the case, or would it be by bringing the - terminal from the motor to a GND on the ESP?
I’m fairly competent with house wiring (electrician background), but electronics is definitely an untrained hobby.
Don’t even think! If your motor driver swaps polarity for reverse direction you short the whole crap.
Why from battery? Tmho it would be better to power it from CC board DC supply. Battery charging circuit does not expect something drawing permanently current from battery and might misbehave (like never stop charging).
Anyway, the setup almost surely shares common ground already, but since esp is powered from battery which has some management circuit, it’s better to verify. Just measure that you have continuity with motor negative and Esp Gnd.
Good catch, as that’s exactly what it’s doing, and exactly how I was planning to infer closing vs opening.
For some reason the board is powered by 18v AC, although it does say 18vac/solar and I thought solar was usually DC without an inverter. Maybe the board has a switching power supply?
The ESP can take AC as well, however it’s at 220v, although some listings say 110v/220v which has been confusing.
That’s a valid concern about the charging circuitry. It sounds like a better solution is in order, investigation at least. I did notice yesterday that the board didn’t power up without the battery even though it had AC, and now reading the listing it says “A 12-Volt 7 Amp Hour Battery is required and not included.” Is that any clue as to how the charging circuit works?
Edit - looks like the solar panel puts out DC so the board must be able to handle either. I could presumably get an 18v dv power supply instead of the AC supply they provided.
That’s common, but somewhere there has to be AC/DC converter because it can’t charge battery from AC. Neither it can drive a DC motor from AC.
Do you have any manual or circuit diagram?
Of course, always do everything within Esphome. Doesn’t relay on HA.
It looks like the whole board works on DC, 18VAC is converted to DC. But I can’t tell from the image if there is any convenient place to get Esp powered. What are the two smaller connectors with double black and white wires?
My unfamiliarity with ESPHome made it take a moment to realize I can build out the binary sensors and then template them within the ESPHome itself. Pretty sweet. Thanks for confirming. That was the solution to the main inquiry.
Re: power, my conclusion was also that the board appeared to be DC. The motor is 12v, and the sensor and control switches are 5v per testing.
The second and third set of wires from the bottom left is “power switch” and “photo sensor” respectively. The power connector probably has 12v at all times on one side, so maybe that’s a good place to power the ESP?
That may be the cleanest option if it turns out the battery is a nogo. The reason it wasn’t the first is that the transformer is zip tied to the other side of the coop under an eve and plugged into an extension cord. Just have to do a little reconfiguration to make that work.
That battery connection probably works just fine, it’s not sophisticated lithium battery management circuit. Even if it keeps the battery under charge, nothing bad really happens…