STLs are available in the files folder in this repo, and on thingiverse at: https://www.thingiverse.com/thing:5321952
This Repo contains the Arduino program used to run the ESP-8266 controller.
The code has been tested on Arduino IDE v1.8.19 on Linux and Mac, if you have issues compiling please try using this version of the Arduino IDE.
IMPORTANT: You need to create constants.h
Copy-paste the file constants.example.h
to constants.h
and fill update at minimum the following variables:
WIFI_SSID
WIFI_PASSWORD
MQTT_SERVER
MQTT_USER
MQTT_PASSWORD
All MQTT topics are also defined in constants.h
, feel free to customise these if you prefer different topic naming.
Please ensure the following Arduino Libraries are installed using the Arduino Library Manager:
- ESP8266WiFi - https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/readme.html
- PubSubClient - https://www.arduino.cc/reference/en/libraries/pubsubclient/
If you are using the ESP-12F modukle as I did, use the following Board settings in Arduino IDE:
- Board:
NodeMCU 1.0 (ESP-12E)
- Upload Speed:
115200
- (I left all other settings as the default)
- 2.8v 1.7A Stepper Driver (SY42STH38-1684A): https://www.pololu.com/product/2267
- DRV8825 Stepper Motor Driver: https://www.pololu.com/product/2133
- ESP8266 12-F: https://www.katranji.com/tocimages/files/423280-229082.pdf
- 12v DC 50mm Fan: https://core-electronics.com.au/extruder-50mm-fan.html
- 12v 2A DC Power Supply (no link - just make sure the amperage is higher than your stepper, with some room to breath to also run the ESP8266)
- 4x8x3mm Bearings for the main gear - https://core-electronics.com.au/makeblock-plain-ball-bearing-4-8-3mm-10-pack.html
- M3x8mm screws (x4) for mounting the motor
- M3x4mm screws (x4) for mounting the lid
- 4x wood screws to mount the whole thing to the wall - you will need to decide the best screws to use based on what your wall is made out of.
...and some generic electronics components, such as 3.3v regulator, capacitors, resistors, and NPN transistors.
See the schematic for full details
NOTE The schematic shows the A4988 Stepper Driver, which was from a previous iteration. I am now using the DRV8255 which has a slightly different pinout.
Most notably on the DRV8255, the VDD pin is not present and instead replaced by the FAULT pin (which I am not using), and the RST and SLP pins go to 3.3v rather than being tied to each other.
- First mount the enclosure to the wall. The motor covers one of the screw holes.
- Mount the stepper motor before adding the main gear - it covers access to 2 of the motor screw holes
- Then put in the main gear and everything else
- Then add on the lid!
The unit is controlled remotely via MQTT, as I use Home Assistant and the MQTT integration for all my home automation projects.
See constants.example.h
for all the available topics - you can also change the topic stings to whatever you want.
The topics are grouped into two types: Control and Non-Control topics. Control topics have control
somewhere in the name, and the unit listens to these topics and does something (e.g. moves the blinds) when a message is received on the topic. Non-control topics don't have the word control
in the them, and are used to send messages out from the unit to let the world know it's current states and settings.
Enables/Disables the Stepper Motor Driver - useful for emergency stopping the motor
Expected Values:
0
- Disable1
- Enable
Changes the direction of the stepper motor/the direction the blinds will move
Expected Values:
0
- Open/Up1
- Close/Down
Immediately move the stepper motor X full steps, in the currently set direction (e.g. set via MQTT_TOPIC_CONTROL_DIRECTION
).
Expected Value: An integer for the number of steps
Tell the blinds to either open or close, for the set number of steps required to complete the journey (e.g. set via MQTT_TOPIC_CONTROL_STEPS_VERTICAL
)
Expected Values:
opened
- Open the blindsclosed
- Close the blinds
Set the stepper mode used during Opening of Blinds (e.g. full step, half step, quarter step, etc)
This value is saved to eeprom, so it will persist if the ESP8266 restarts or looses power
Expected Values:
1
- Full Step Mode2
- Half Step Mode4
- Quarter Step Mode8
- Eighth Step Mode
Set the stepper mode used during Closing of Blinds (e.g. full step, half step, quarter step, etc)
This value is saved to eeprom, so it will persist if the ESP8266 restarts or looses power
Expected Values:
1
- Full Step Mode2
- Half Step Mode4
- Quarter Step Mode8
- Eighth Step Mode
Set the stepper speed used during Opening of Blinds. (Less speed == more torque).
This value is saved to eeprom, so it will persist if the ESP8266 restarts or looses power
Expected Value: An integer for the microseconds between steps
Set the stepper speed used during Closing of Blinds. (Less speed == more torque).
This value is saved to eeprom, so it will persist if the ESP8266 restarts or looses power
Expected Value: An integer for the microseconds between steps
Set the number of steps to take when performing a full open
or close
cycle (See MQTT_TOPIC_CONTROL_BLINDS
)
This value is saved to eeprom, so it will persist if the ESP8266 restarts or looses power
Expected Value: An integer for the number of steps to take
Publishes the current movement state of the blinds
Expected Values:
opening
opened
closing
closed
Publishes the current movement state of the blinds
Expected Values:
opening
opened
closing
closed
Publishes the current number of full steps taken (note this is only sent every 250 steps)
Expected Value: Integer
Publishes if the stepper motor driver is currently enabled
Expected Values:
0
- Not Enabled1
- Enabled
Publishes the current stepper motor direction
Expected Values:
forwards
backwards
Publishes the current stepper motor step mode
Expected Values:
1
- Full Step Mode2
- Half Step Mode4
- Quarter Step Mode8
- Eighth Step Mode
Publishes the current MQTT connection status
Expected Values:
connected
- The unit is connected to MQTTdisconnected
- The unit has disconnected from MQTT (this is sent as an MQTT last-will message, so it is mostly reliable)
Publishes the current step mode for the Opening sequence (see MQTT_TOPIC_CONTROL_MODE_OPEN
)
Expected Values:
1
- Full Step Mode2
- Half Step Mode4
- Quarter Step Mode8
- Eighth Step Mode
Publishes the current step mode setting for the Closing sequence (see MQTT_TOPIC_CONTROL_MODE_CLOSE
)
Expected Values:
1
- Full Step Mode2
- Half Step Mode4
- Quarter Step Mode8
- Eighth Step Mode
Publishes the current step speed setting for the Opening sequence (see MQTT_TOPIC_CONTROL_DELAY_OPEN
)
Expected Value: Integer
Publishes the current step speed setting for the Closing sequence (see MQTT_TOPIC_CONTROL_DELAY_CLOSE
)
Expected Value: Integer
Publishes the setting for the current number of full steps to take when performing a full open
or close
cycle (see MQTT_TOPIC_CONTROL_STEPS_VERTICAL
)
Expected Value: Integer
Main gear with ball-chain gear attachment
Ball-chain gear attachment (another angle)
Control Board (with A4988 instead of DRV8255 stepper driver)
Housing with stepper motor and gear installed
Housing with stepper motorm, gears, and board installed
Everything ready to go, just need to put the lid on
MIT - see LICENSE.md