Working with solenoids

What we are going to make is an automation system that will water your plants whenever they need it. So technically, once it is set up, you don't really have to worry ever about watering your green creatures. Whether you are at your home, at the office, or on a vacation, this will keep doing its job no matter what. 

Now, you must be wondering how it will water the plants, so let me tell you, for every problem in this world, there exists a solution. In our case, that solution is called a solenoid valve. What it essentially does is switch the flow of liquids. There are various solenoid valves available in the market; some of the identifying features are as follows:

  • Size: They come in various sizes such as half an inch, three quarters of an inch, 1 inch, and so on. This basically will determine the flow rate of the solenoid valve.
  • Medium: Whether it is meant for fluid, gas, vapor, and so on.
  • Normal condition:
    • Normally opened: This valve will allow the flow of liquids in the off state—when no power is supplied to the valve
    • Normally closed: This valve will stop the flow of liquids in the off state—when no power is supplied to the valve
  • Number of ways: A simple valve will have an inlet and an outlet. So, when it is open, it will allow the liquid to flow from the inlet to the outlet. However, there can be other types of valve such as a three-way valve which might have two outlets and one inlet. It would regulate where the flow of the liquid would happen. 

There can be some more specifics in terms of the valves as well, but for now that's all we need to know. One thing to notice about the solenoid valve is that these valves can either be opened or closed. Achieving any state in between or controlling flow via these valves is not possible. For this we can use a servo valve or motor valve. But as of now, we don't need it. 

What we will be using in this chapter is a half inch valve for water/fluid, which is normally closed. When you look closely at this valve you will see that it operates at 12 volts and the current consumption is close to 1 amp. This is a lot of current for Raspberry Pi. The upper limit of current that Raspberry Pi can provide per pin is about 50 milliamp. So if we connect this valve to Raspberry Pi then it's surely not going to work. 

What do we do now? The answer to this question is a relay. The basic job of a relay is to re-lay the circuits. Basically, it's an electronically controlled switch. The basic job of a relay is to switch devices that have a higher current/voltage consumption than what can be given by a controlling unit on and off. This is a fairly simple device, as you can see in the diagram. There are two circuits. One is depicted in blue, which is a low voltage and low current circuit. This circuit is powering up a coil. The other circuit is depicted in red and black. This circuit is a high voltage, high current circuit. 

In the initial stages, as you can see, the high voltage high current circuit is not complete and the oven will not work:

Now, in this second diagram, you can see that the blue circuit is connected to the 5V power source and that the coil is energized. Whenever a coil gets energized, it forms an electromagnet and attracts the metal leaf of the high power circuit to make the circuit complete, hence powering up the oven:

This is how a solenoid works. The consumption of the coil is hardly a few milliamps, hence it is very easy to actuate a coil via a micro-controller. This in turn makes a contact between the final circuit. 

There are various kinds of relays available on the market; some of the identifying features are as follows:

  • Max output voltage: The maximum voltage that it can handle
  • Maximum output current: The maximum current that it can bear for any output device connected to it
  • Signal voltage: The voltage that it requires switch the components on or off
  • Normal condition
    • Normal off: This will not allow any current to flow until the time the signal is not received
    • Normal on: It will allow the current to flow until the time the signal is not received

Now, coming back to our gardening robot, the solenoid attached to it will be working on 1 amp and 12V, so any relay which can supply equal to or more than 1 amp and 12V would work. 

Commonly, the relays available on the market are 120V and 12 amp DC. One important thing to remember is that there will be two separate ratings for AC and DC voltage and current. As our solenoid will be working at 12V, we will only be considering the DC upper limit.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.157.45