Power rail: verschil tussen versies

Uit MakerSpace Leiden
Ga naar: navigatie, zoeken
Regel 15: Regel 15:
 
As the action of the OFF button needs to be reversed ("switch when released"), an extra 5V relay is added. Also the snubbers are removed to prevent 230V leakage when the relays are off.  
 
As the action of the OFF button needs to be reversed ("switch when released"), an extra 5V relay is added. Also the snubbers are removed to prevent 230V leakage when the relays are off.  
  
[[Bestand:Powerrail_Fig1.jpg]] [[Bestand:Powerrail_fig2.jpg]]
+
[[Bestand:Powerrail_Fig1.jpg|300px]] [[Bestand:Powerrail_fig2.jpg|300px]]
  
 
This is fitted in a box, fitted with 1.5mm^2 power cables, and mounted on the wall:
 
This is fitted in a box, fitted with 1.5mm^2 power cables, and mounted on the wall:
  
[[Bestand:Powerrail_fig4.jpg]] [[Bestand:Powerrail_fig5.jpg]]
+
[[Bestand:Powerrail_fig4.jpg|300px]] [[Bestand:Powerrail_fig5.jpg|300px]]
  
 
The ESP control unit plugs into the white connector with blue and red dots on Fig1. Pin1 is +5V, pin2 is GND, pin3 is Relay+5V, pin4 is relay return.
 
The ESP control unit plugs into the white connector with blue and red dots on Fig1. Pin1 is +5V, pin2 is GND, pin3 is Relay+5V, pin4 is relay return.
 
Relay coils require more current than a GPIO pin of ESP can deliver, so a transistor is used on the ESP print to boost the switching current to pins 3-4 on the white connector.
 
Relay coils require more current than a GPIO pin of ESP can deliver, so a transistor is used on the ESP print to boost the switching current to pins 3-4 on the white connector.
[[Bestand:Powerrail_fig3.jpg]]
+
[[Bestand:Powerrail_fig3.jpg|300px]]
  
The code for ESP is written in Arduino IDE and uses Adafruit_MQTT libraries:
+
The code for ESP is written in Arduino IDE and uses Adafruit_MQTT libraries. [[Bestand:powerrail_switching_off_MQTT_MSL_v3.2_nopwds.ino]]
{{scroll box|height=200px|text=
+
 
* Example 01
+
It creates two feeds: ''makerspace/powerrail'' (feed1) and ''makerspace/powerrail/status'' (feed2), writes "ON" to both feeds and "Power rail is ON" to feed1. When "OFF" is posted to feed1, it posts "Power rail is OFF" to feed1, "OFF" to feed2, and shuts down. If after 10sec it is still not off (stuck relay?), it will post an error message to feed1.
* Example 02
+
 
* Example 03
+
It is only possible to switch the power on by hand, pressing the green button on the box.
* Example 04
 
* Example 05
 
* Example 06
 
* Example 07
 
* Example 08
 
* Example 09
 
* Example 10
 
* Example 11
 
* Example 12
 
* Example 13
 
* Example 14
 
* Example 15
 
}}
 

Versie van 1 mei 2017 om 18:39

After comissioning the 230V power rail on the back wall of the "3d-printer" room, an idea came about of making it remote-controlled for an easy remote poweroff. Taking into account potential scaling up to other nodes at MSL, where there may be no line-of-sight access for radio- or IR-remote, a decision was made to use MQTT over WiFi with ESP8266 as hardware.

Both L and N wires were to be switched independently, so two relays capable of switching 16A @ 230Vac were needed. These commonly come with coil voltages of 12Vdc and higher.

At the same time, ESP8266 runs nominally on 3.3V, but takes 5V via a LM1777 3.3v regulator. Going higher (to 12Vdc) was considered not recommended, as the SMD regulator would then dissipate too much heat.

Meeting both requirements above, we went with Fujitsu K1CK005W 5Vdc relays [1], while the SLA-05VDC-SL-A relays from AliExpress [2] were in transit. This way, we need only one 230Vac->5Vdc supply for both the ESP and the relays.

For this purpose, HLK-PM01 power brick [3], delivering 3W, was sufficient (~1W for ESP, plus ~1W per relay).

As the implementation for the power rail in the printer room uses double-through Fujitsu relays, their contacts are connected in parallel to reduce the current load. The HV and LV areas are separated as much as possible. In order to have this working with or without the ESP, the latter was put on a connector. A shunt (pin1-3 and pin2-4 shorted) can be used to have it working without ESP (on-off by front panel buttons only).

The original schematic is done by Aart (thx!): Schema Aart.png As the action of the OFF button needs to be reversed ("switch when released"), an extra 5V relay is added. Also the snubbers are removed to prevent 230V leakage when the relays are off.

Powerrail Fig1.jpg Powerrail fig2.jpg

This is fitted in a box, fitted with 1.5mm^2 power cables, and mounted on the wall:

Powerrail fig4.jpg Powerrail fig5.jpg

The ESP control unit plugs into the white connector with blue and red dots on Fig1. Pin1 is +5V, pin2 is GND, pin3 is Relay+5V, pin4 is relay return. Relay coils require more current than a GPIO pin of ESP can deliver, so a transistor is used on the ESP print to boost the switching current to pins 3-4 on the white connector. Powerrail fig3.jpg

The code for ESP is written in Arduino IDE and uses Adafruit_MQTT libraries. Bestand:Powerrail switching off MQTT MSL v3.2 nopwds.ino

It creates two feeds: makerspace/powerrail (feed1) and makerspace/powerrail/status (feed2), writes "ON" to both feeds and "Power rail is ON" to feed1. When "OFF" is posted to feed1, it posts "Power rail is OFF" to feed1, "OFF" to feed2, and shuts down. If after 10sec it is still not off (stuck relay?), it will post an error message to feed1.

It is only possible to switch the power on by hand, pressing the green button on the box.