First time using esphome, i used it for leds and it was awesome
Im am looking to press a button (very similar to a arduino pushbutton) using a Solenoid Electromagnet Push Pull
Does anyone know what kind of config i can use to control this via esphome?
also any help with a diagram to wire?
Is this the right module to use for this use case ? soldering on the pcb is a nono at the moment
If you have physical access to the wire terminals of the button, I’d wire an appropriately sized relay in parallel with the button, then use the simple output component to drive the relay. If you need it held, momentary, etc. can all be handled in automations of the output.
You would just need to define an output and wire it to a relay which then powers the solenoid.
You can then add some more code to force that output to only be on for a short duration (say 500ms) and then switch off again, so your button isn’t held down
The button that i want to control is the one on the lower side of the picture (smaller button)
I did put a voltmeter to read what happen when i press the button, its always at 3.3v
Quick explanation what does it do:
1st press - Turn led animation 1
2nd press - Turn led animation 2
3rd press - Turn led animation 3
4th press - Turn led animation 4
5th press - Turn led animation off
Then it just repeat the above presses
What would be a good type of solenoid for my use case? if you look in the picture above?
Never really worked with them, hence im looking for suggestions
Yeah you definitely want a relay there. A solenoid would either be too hard to mount or would potentially break the board. Which legs of the button did you measure when pressing it? Typically you want to put the negative lead of your meter to a common ground then probe each leg of the button with the positive lead of the meter. The leg that transitions from 0V to 3.3V when the button is pressed is the leg you want to attach one side of the relay contacts to and attach the other side of the relay contacts to a leg of the button that is always at 3.3V regardless of button state. The relay should have the contacts rated at least 5V (most are) and the coil side of the relay needs to be rated exactly for the voltage of the ESPHome device power supply (5V probably). Depending if you want to sink or source current from the output of the ESPHome device (I’d recommend sinking) determines if you wire the relay coil between the output pin and power pin (sink) or output pin and ground (source). Make sure you pick an appropriate pin that can be used in this manner and not restricted meaning if it’s held high or low (depends on the pin) at device power on, the ESPHome device won’t boot.
As for the code, just a simple output action that turns the output on, delays 500ms, then turns off would work. You could get creative and have a counter that keeps track of the current LED effect and another input number for the desired effect and the ESPHome device would calculate how many button “presses” need to happen to make that effect active.