Automated Yard Watering Project – InApps Technology is an article under the topic Software Development Many of you are most interested in today !! Today, let’s InApps.net learn Automated Yard Watering Project – InApps Technology in today’s post !

Read more about Automated Yard Watering Project – InApps Technology at Wikipedia



You can find content about Automated Yard Watering Project – InApps Technology from the Wikipedia website

The eight-channel relay board for my latest project, the Automated Yard Watering system, recently arrived on my workbench. I don’t have a Raspberry Pi Zero W module just yet, so in the meantime, I thought it might be interesting to see what could be accomplished with a Wi-Fi-enabled Arduino clone known as the NodeMCU.

I bought three of these devices from Banggood for about $15. They are little ESP8266 boards that bring the general purpose input/outputs (GPIO) out to breadboard-friendly pins, while adding a voltage regulator and USB communication circuitry. A wireless (ESP8266-01 based) dual-relay module is available for plug and play use for about $8.

Summarizing the project, I want to control my yard sprinklers using a microcontroller, a relay board and a few 24-volt sprinkler solenoid valves. We discussed the process in a recent story.

Today we’ll look at connecting the relay board to the microcontroller and using a program to test basic relay operation. A future article will integrate control software to actuate the solenoids. When I get my hands on a Raspberry Pi Zero W, we’ll swap it in place of the NodeMCU module and give that configuration a try. Being able to use multiple solutions, with a little tweaking, is an important skill to develop for off-the-shelf hackers.

Making Connections

Ideally, we’d have a 10-pin 0.1 mm spaced connector to use to wire the relay board to the microcontroller. There wasn’t one handy so I modded the usual obsolete hard-drive cable connector down to 10 pins and soldered the wires into place. Just clamp the connector in a vise and cut the plastic connector with a small saw or Dremel abrasive disk. Here’s a close-up of the connector.

Hacked hard-drive cable connector used on relay board

I found it best to “touch” solder to both the pins and the ends of the wires before trying to join them. Old school hackers call this process “tinning.” The flux in the solder cleans the surface of the pin and makes the solder flow properly. The end of the wire is then positioned against the pin and soldered with a minimum of heat. Try to solder the pins as quickly as possible or the pins will melt the plastic in the connector and possibly short together.

For preliminary testing, I cut all the wires down to about two inches in length and used a small breadboard to connect to the NodeMCU board. Once I made sure the relay board worked, I removed the wires from the breadboard and soldered them to the top of the NodeMCU module pins. This operation is a little tricky since space is pretty tight between pins.

Wires soldered to the NodeMCU module

I prefer to use 22-gauge solid wire when working with breadboards and prototype projects. Stranded wire always separates when pushing it into a breadboard. Straight, solid wire ends go in very easily and minimize the chance of a shorted or open connection.

Read More:   A Look at Lazydocker, a Cursor-Based Docker Management Tool – InApps Technology 2022

Finding good documentation for the eight-channel relay board is a bit sketchy on the web. I wasn’t sure if the board worked with 3.3-volt or 5.0-volt logic. Regular Arduino modules use 5.0-volt logic, while the Raspberry Pi and ESP8266 boards (NodeMCU) both use 3.3-volt logic. It turned out not to matter. I just hooked it up and gave it a try. Take a look at a generic internal schematic of the relay board.

I hooked the ground pin on the relay board up to a GND pin on the NodeMCU board. Likewise, the VCC pin on the relay board went to one of the 3.3-volt pins on the NodeMCU. Eight of the 13 digital GPIO pins are connected to the relay board for use and testing, so you can use the remainder for other purposes. There is also an analog input pin labeled A0, which we aren’t using at this time.

relay pinNodeMCU GPIONodeMCU physical pin
N1GPIO16D0
N2GPIO5D1
N3GPIO4D2
N4GPIO0D3
N5GPIO2D4
N6GPIO14D5
N7GPIO12D6
N8GPIO13D7

Google has plenty of NodeMCU pinout images for your reference and entertainment.

Make sure the configuration jumper at the bottom right-hand side of the relay board (with the connector facing front center and the relays at the back) is positioned between the VCC and JDVcc pins. Ignore the adjacent Gnd pin. This setup should also work for the Raspberry Pi. You couldn’t ask for a cleaner or simpler layout of the NodeMCU and relay board. Connect the USB cable to a Linux notebook for the programming phase.

Upload the Test Firmware

The NodeMCU uses the Lua programming language and comes already loaded in the firmware. IBM has a little mini-intro for the NodeMCU that you might check out if you’re interested in their development kit and using Lua. I don’t have any experience with the language, so instead opted to write regular old Arduino code for this part of the project. Perhaps, we’ll investigate Lua in a future story, seeing as I have two other NodeMCU modules with which to experiment. It looks like it’s pretty easy to use.

Current versions of the Arduino IDE support the NodeMCU modules. I downloaded and installed version 1.8.7 on the ASUS Linux notebook. Be sure to select “ESPduino (ESP-13 module)” for the board type or the firmware upload will fail.

Next, I modded the example code for the ESP8266 blink program to basically blink the eight relays on the relay board. Here’s the code.

We start by initializing the pins with pinMode statements followed by beginning states of pins HIGH. Switching the pin to LOW turns ON the relay, so by default the pins are HIGH (+3.3 volts) meaning OFF. We don’t need any special libraries at this point since we are just turning the GPIO pins on and off. We’ll need a few when integrating the wifi and MQTT functionalities, later on.

Read More:   Docker Contributor Analysis – InApps 2022

The digitalWrite statements step down through the pins, turning the relays on for two seconds, then off for two seconds, as long as the board is hooked up to power.

After uploading the firmware to the NodeMCU you should see each LED light in succession and hear the click of the relay as it is actuated.

Wrap up

We’ve looked at hooking up the NodeMCU to an eight-channel relay board. The wiring is simple and clean. Testing is pretty easy, with a brute force blink program. The switch contacts in each relay can handle 240 volts AC at 10 amps or 30 volts DC at 10 amps, making the setup suitable for a variety of power on/off jobs. I’ll use it to switch 24-volt sprinkler solenoids at about half Amp. The switched side of the relays are totally isolated from the logic side.

Look for coverage of upgrading the setup to connect to my local network and receive commands via MQTT in upcoming articles. Later on, we’ll swap in a Raspberry Pi Zero W, for even more hacking fun.



Source: InApps.net

Rate this post
As a Senior Tech Enthusiast, I bring a decade of experience to the realm of tech writing, blending deep industry knowledge with a passion for storytelling. With expertise in software development to emerging tech trends like AI and IoT—my articles not only inform but also inspire. My journey in tech writing has been marked by a commitment to accuracy, clarity, and engaging storytelling, making me a trusted voice in the tech community.

Let’s create the next big thing together!

Coming together is a beginning. Keeping together is progress. Working together is success.

Let’s talk

Get a custom Proposal

Please fill in your information and your need to get a suitable solution.

    You need to enter your email to download

      [cf7sr-simple-recaptcha]

      Success. Downloading...