-
Notifications
You must be signed in to change notification settings - Fork 41
Controlling Motors with GPIO
ESPSomfy RTS allows you to connect motors via GPIO to external relays or a dissected remote. In this configuration you can mix and match radio based motors with hardwired motors that are controlled via relays or trigged from an unsupported remote. You can use any of the available output pins that are remaining on your ESP32 to control up or down on the motor.
In addition to the radio based protocols, ESPSomfy RTS supports two distinctly different GPIO protocols. In cases where you have purchased bare naked motors that have no controller, you can simply trigger these using a pair of relays. By selecting IO-Relay as the motor protocol, ESPSomfy RTS will energize the pin selected for up and down depending on the desired direction. When the target position is reached it will automatically de-energize the pin.
Once configured, ESPSomfy RTS will trigger the up pin when the motor should be moving up and the down pin when the motor should be moving down. If the motor should be at rest it will turn off (pull low) both pins so the motor is not energized.
In this configuration, the motors operate as if they are controlled by the radio. All functions such as the My function work just like a radio controlled motor. Even the positioning works. If you have a spare channel on a remote you can even link that and begin moving this non-radio enabled motor with your remote. How cool is that! But I didn't stop there, you can even link this motor to a sun or wind sensor and all the functions work for that as well.
To set this up select the IO-Relay protocol for the Shade. When you do this, two dropdowns will appear next to the protocol dropdown. Select the pins that are used to energize the up relay and down relays then press save. Don't forget to set your timing so that the motor knows when to stop especially if you have no limit switches.
NOTE: If the type is a Dry Contact then ESPSomfy RTS will simply toggle the relay on or off. This can be useful for adding simple switches to the solution. In this configuration only one pin is used.
Only one pin is pulled high at a time to ensure only either the up or down is energized. The length of time that the pin is pulled high is determined by the up or down timing. So if you have a slow up and fast down motor then you are still in business. This also works with integrated tilt motors, toggles, and dry contact types. In the case of dry contact it will pull the down pin high for on.
If you are one of those poor souls with an unsupported protocol, then you can add your own support by dissecting a remote that controls the motor. There are lots of examples of this on the Interwebs. In this configuration ESPSomfy RTS will simulate button presses for up, down, and my.
Just like the operation of the IO-Relay all functions will continue to work with the motors. However, since you are not receiving feedback from the motor during its operation you can only control the motor via the ESPSomfy RTS interface.
To configure a IO-Remote motor select the IO-Remote protocol from the dropdown. You will be presented with either 3 pin function selections or 1 depending on the number of buttons on the remote you are emulating. For instance, a dry contact or 1-button garage door will present you with the down pin.
Please do some searches on the web for wiring up the remote. Many of the ones I found will trigger the remote properly if powered from the 3v3 pins on the ESP32. The center pin of the button is then connected to the pin supplied for the up, down, and/or my buttons.