How to use Smart Device to Control a Solenoid Valve

Published August 10, 2020  ( 5 min read )
automation

In this blog we will learn how to connect the smart device to a solenoid valve and how to configure it such that the valve is turned on at regular intervals (say, at 8:00PM every day). Such rerquirements are common either in home or industry. For example, one may have a need to put on a sprinkler system in the garden at, say, 6:00AM every day. This type of requirements in home or industry can be easily met by the Smart device. So, let us get started...

Things we need


  1. One unit of WifiSecureAccess Smart Device
  2. One solenoid vavle (Refer to its rating in step 1).
WiFiSecureAccess smart device can be purchased from Amazon.

Fig 1: WiFi Secure Access Smart Device


Purchase the solenoid valve as per your requirements. If you do not have an external power supply, voltage rating of the solenoid valve must be 12V and its current rating must be below 500mA. If you are using a solenoid valve at a higher voltage and/or current rating, an external power supply must be available to power the solenoid. The shown below in Fig 2 is an example of a 12V 450ma solenoid.
Fig 2: Solenoid Valve

Step 1

As a first step, obtain a solenoid valve that you need. If you are using a 12V, 500ma(or less) solenoid and want to use the power from the smart device, cable the solenoid to the smart device as per the diagram shown in Fig 3 through 5. As shown in the diagram, cable the two terminals of the solenoid to P0 and GND of the J9 connector on the smart device. If you are using a solenoid with 12V, 500mA (or less), connect 12V terminal on J2 connector to VDD of J9 connector (Fig 3). If you are using a solenoid with higher voltage rating (less than 40V), but with a current rating of 500ma or less, then, connect that power souce to VDD instead of internal 12VDC. If you do that, the GND of that power source must be connected to the GND on J2 connector as well.

Fig 3: Cabling a Solenoid to Smart Device

Fig 4: WiFi Secure Access Smart Device

Fig 5: Cabling a solenoid valve to Smart Device

If you are using a higher powered solenoid, cable the solenoid to the RELAY of the smart device as per Fog 6 and 7. You need an external power supply to complete this cabling.
Fig 6: Cabling a HigherPower Solenoid to Smart Device


Fig 7: Cabling a HigherPower Solenoid to Smart Device

Note: Regardless whether you use external power to the solenoid or not, the smart device needs either 12VDC power or 110/240VAC as explained in section 2.2 'Setting up the Device' of the documentation.

Step 2

Once the cabling is completed, power on the smart device. If this is a brand new device, follow the steps given in section 2.0 Installation of the documentation. That section explains how to connect power to the smart device and how to set up WiFi of this device. It is a requirement to have WiFi available at the location where this smart socket is used. If the above steps are completed successfully, you should be seeing the LED of the smart device red

You have now connected the solenoid to the internet. You can now manually operate it from remote using a smart phone. You can also use Google assistant or Amazon Alexa to put ON or OFF the solenoid. Before trying to use Google Home or Alexa, try to name the output port of this smart device. As this device has two discoverable ports (P0 and RELAY), and as you have cabled the solenoid to only one of those ports, it is better if the unused port is disabled so that it will not appear in Google Home or Alexa when trying to add this device. To do that, follow the steps given in section 2.10 and 2.11 of the documentation. When going through those steps, you need to select 'Yes' for either 'Allow DOUTP0 in Google Home' or 'Allow RELAY in GoogleHome' depending on which port you have cabled solenoid to, and select 'No' for the other port. Do similarly to enable/disable port in Alexa. (Fig 14A of the documentation).

Step 3

Now that we have configured everything such that the solenoid valve can be operated manually, let us configure it such that the valve comes ON automatically, say, at 6:00AM every day for a duration of, say, 20 minutes. This can be achieved by configuring 'Periodic Actions' as described in section 5.2 of the Documentation. So, follow the steps given in section 5.2. When going through those steps, make sure to choose the correct OutPort (either P0 or RELAY) depending on your cabling of solenoid valve. Also to match with our example requirement in this blog, set the repeat time period as 86400 (24 hours = 86400 seconds). Set duration as 1200 (20 minutes = 1200 seconds). Set the Next Start as the date and time of 6:00 AM of the next day. For example if you are doing this setting on, say, April 04, 2020, then set the next start as 2020-04-05 6:00.

Once this cabling and configurations are completed, you can observe that the solenoid valve comes ON at 6:00AM every day. It stays ON for 20 minutes and gets put OFF automatically. You can also manually override the automatic controll any time by activating the solenoid either from a smart phone by pressing 'Activate a Device' in the app, or by using Google Home assistant or Amazon Alexa. But, keep in mind that manual override will not make automatic controls inactive. So long as the automatic control configuration is active, the solenoid valve will come ON at 6:00AM every day and will stay ON for 20 minutes even if you have manually put the valve on any other time.

You can re-configure this any time by either modifying the parameters of the port control or by deleting the current port control and creating another as explained in section 5.2 of the documentation.

As explained in section 5.2 of the documentation, you can add multiple periodic controls for the same port. For example, say, you want the valave to come on at 6:00PM in the evening in addition to 6:00AM every day, add another periodic port control for 6:00PM.

If want to make this slightly more complicated such that you do not want the valve to come ON when there is rain, it can be done by connecting a rain sensor to smart device and choosing it to apply a condition in each periodic port control. Section 5.2 of the documentaipn explains this as well.