1 / 2
Water valve stopcock actuator — zdjęcie 1
1 / 2

Water valve stopcock actuator

Zamów wydruk tego modelu

Obliczymy ostateczną cenę na podstawie wybranego pliku. Sprawdzisz ją i zaakceptujesz przed płatnością.

Zapisane na tym urządzeniu.

An addon to open and close a stopcock valve. Works with a continuous rotation servo.

Ocena
0 / 5
Polubienia
4
Pobrania
37
Wydruki
0
Wyświetlenia
848
Oceny
0

Aktualizacja u źródła:

Informacje o modelu

Źródło
Printables
Licencja
Creative Commons — Attribution

Disclaimer - I don't really know what I'm doing and didn't spend the time to clean this up. So might be a bit rough around the edges. But works really well.

Made to fit the stopcock shown in the photo.

Works with a continuous rotation servo with a body size of 40X40.5X20mm. Initially I used a 5kg servo but it didn't have enough power. I then used a 25kg servo which works great. Luckily they both have the same dimensions. This is the one I used (https://www.amazon.co.uk/gp/product/B088H4WWN4/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1).

Fits on 15mm diameter pipe.

I controlled it with a nodeMCU with MQTT commands through homeassistant.

I was initially thinking of using some kind of mechanism to allow the arduino to view the state of rotation/number of rotations but it seemed a bit complicated and unnecessary. 

There are small holes that allow you to add a zip tie for extra support. You should add zip ties before attaching it to the pipe. Otherwise, it will be very difficult to add once it's on. (depending on the position of your pipe.)

There are two parts. One which you can glue a servo attachment to and the other grips the body of the servo and attaches to the pipe.

After flashing the nodeMCU with servo data pin on D5. I added a homeassistant automation and MQTT sensor to control it through homeassistant. I will leave the YAML code below.

 

Print settings:

I would recommend printing with PETG if you are using this on a hot pipe.

Also make sure your support settings are tuned down well because there will be some difficult to reach supports.

 

Arduino code:

#include "EspMQTTClient.h"
#include <Servo.h>
#include <EEPROM.h>

Servo servo1;

//servoDelay is how long you want the servo to spin for in milliseconds. I set it to 8 seconds int servoDelay = 8000; int state; //This variable will stop a command being carried out when the servo is already turning bool working = false;

//Interval between nodeMCU sending its current state (on or off) const long interval = 120000; unsigned long previousMillis = 0; unsigned long currentMillis = 0; //EEPROM write address int adr = 3;

//Change all the below MQTT settings EspMQTTClient client( "WIFI SSID", "WIFI PASSWORD", "1.1.1.1", // MQTT Broker server ip "Username", // Can be omitted if not needed "Password", // Can be omitted if not needed "nodeMCU name", // Client name that uniquely identify your device 1883 // The MQTT port, default to 1883. this line can be omitted );

void setup() { Serial.begin(9600); Serial.println("Starting");

//Add servo to pin D5 of nodeMCU servo1.attach(14);

EEPROM.begin(1);

// Optional functionalities of EspMQTTClient client.enableDebuggingMessages(); // Enable debugging messages sent to serial output client.enableHTTPWebUpdater(); // Enable the web updater. User and password default to values of MQTTUsername and MQTTPassword. These can be overridded with enableHTTPWebUpdater("user", "password"). client.enableOTA(); // Enable OTA (Over The Air) updates. Password defaults to MQTTPassword. Port is the default OTA port. Can be overridden with enableOTA("password", port). client.enableLastWillMessage("valves/kitchenHeaters/lastwill", "I am going offline"); // You can activate the retain flag by setting the third parameter to true

previousMillis = millis();

}

void loop() { client.loop(); currentMillis = millis(); if(currentMillis - previousMillis > interval){ previousMillis = millis(); if(EEPROM.read(adr) == 0){ client.publish("valves/kitchenHeaters/tx", "Off"); }else if(EEPROM.read(adr) == 1){ client.publish("valves/kitchenHeaters/tx", "On"); } } }

//MQTT function void onConnectionEstablished() { client.subscribe("valves/kitchenHeaters/rx", [](const String & payload) if(working == false){
if(payload == "close"){ working = true;
Serial.println("Closing valves"); client.publish("valves/kitchenHeaters/tx", "Turning off"); servo1.write(180); //rotate counterclockwise at slow speed delay(servoDelay); servo1.write(90); client.publish("valves/kitchenHeaters/tx", "Off"); state = 0; EEPROM.write(adr, state); EEPROM.commit(); working = false; }else if(payload == "open"){ working = true;
Serial.println("Opening valves"); client.publish("valves/kitchenHeaters/tx", "Turning on"); servo1.write(0); //rotate counterclockwise at slow speed delay(servoDelay); servo1.write(90); client.publish("valves/kitchenHeaters/tx", "On"); state = 1; EEPROM.write(adr, state); EEPROM.commit(); working = false; } } }); }

 

Home assistant:

Automation:

alias: Valve turn on/off
description: to be triggered by button press
trigger: []
condition: []
action:

  • if:
    • condition: state entity_id: sensor.MQTTSensorName state: "On" then:
    • service: mqtt.publish data: topic: valves/kitchenHeaters/rx payload: close
  • if:
    • condition: state entity_id: sensor.MQTTSensorName state: "Off" then:
    • service: mqtt.publish data: topic: valves/kitchenHeaters/rx payload: open

mode: single

 

YAML code to add to homeassistant config to add MQTT sensor which displays the current state of the valve:

mqtt:
  sensor:
    - name: "smart-valve-state"
      state_topic: "valves/kitchenHeaters/tx"

 

Tagi