Posted on August 4, 2016

Riego automático arduino

Upload your programs direct to ESP8266  your ESP8266 by pressing the button ‘upload’ in Arduino.  Use the standard sketches like “blink” or use the basic examples like wifi_blink.

Arduino programs running on your ESP8266 a 3 US$ wifi enabled board.





Ver video acerca riego automático arduino


This project is in BETA status.

    • Balanced and unbalanced output
    • Support for “true” balanced L-C-L matching networks, or floating ground
    • Optional LCD display
    • Lock switch
    • Tune button
    • Receive bypass
    • Regular and Latching Relay support through the use of hardware control macros
    • 8 switched inductors and 8 switched capacitors
    • Optional multiple transmitter and antenna switching
    • Serial port controllable
    • Low power sleep mode
    • Rig control and computer to rig control “pass through”
    • Highly configurable options for custom hardware


The reference design / prototype unit was designed for 100 watts, however this design can undoubtedly be scaled for lower or higher power capability.

That means it is not a finished, polished product

Project Status

I have built one unit which was intended to be a prototype.  It worked so well that I haven’t built another one and the prototype continues to be used in my shack on a nearly daily basis.  The bottom line is, it works rather well.  I would eventually like to build a QRP model with latching relays and sleep mode.

If you would like to improve this code or hardware design and contribute or fork the project, please do.


Basic Operation

The Arduino controls a relay-switched matching network consisting of capacitors and inductors.  The reference hardware design is a balanced L, with the capacitor bank switched between the input and output of the network to provide Hi Z and Lo Z impedance transformation.  Standing Wave Ratio or SWR is sensed by the Arduino by feeding a forward RF detected voltage and a reverse RF detected voltage from an SWR bridge into two Arduino analog pins.  When the Arduino senses an SWR over a configurable threshold, the unit begins a tune sequence in which numerous relay combinations are tried to find the best match within a configurable amount of time.  When an acceptable match is found, the tuning routine stops.

The Arduino also frequency-counts the RF signal and stores tuning combinations along with the frequencies in non-volatile EEPROM memory for future use.  Before invoking a tuning combination search, the list of past tuning combinations is queried to see if a close frequency match is available.

Optionally, the unit interfaces to a transceiver to periodically query its frequency which is used to automatically switch the tuning network when the band is changed or if the frequency changes more than a configurable threshold.  The code can be configured for rig pass-through where the Arduino will pass through an rig commands from the computer to the rig, and vice versa.  This makes the Arduino look transparent to the computer, but still allows the Arduino to query frequency information from the rig.

An optional LCD display shows SWR, the currently tuned frequency, the radio frequency, and current tuning network values.



Hardware Designs

The reference hardware design ad prototype I built is using an Arduino Uno and has 100 watt capability.

Hardware Description

General Technical Description

The RF signal is sampled after the tandem match directional coupler.  This voltage is fed to a limiter which converts the high voltage sine wave to a 0 to +5V square wave which is then frequency divided by 4 using a dual D-type flip flop.  The divided signal is routed to the Arduino which counts the signal in order to detect the transmitter frequency.

The RF signal then travels through a 1:1 balun which converts the unbalanced transmitter output to a balanced signal.  The tuning network is a balanced L design.  Inductors and capacitors are switched in and out of the circuit by relays.  Additionally, the entire capacitor bank is switch by relays unto the output and input of the tuning network in order to provide impedance step up (“HiZ”) and impedance step down (“LoZ”) capability.  Relays are controlled by the Arduino via its I2C bus which interfaces with two I2C expander ICs.  These each provide eight output lines which feed darlington transistor buffer ICs, which in turn activate the relays.  A switch is provided to interrupt the voltage to one side of the network, deactivating one leg of inductors, in order to provide an option to feed an unbalanced load.

An LCD unit interfaces with the Arduino using the I2C bus.  (A classic four bit interface unit can be used as well, if desired.)  A bank of LEDs provide indication of relay operation and make a nice blinky light show when tuning.  A momentary switch can be depressed to manually invoke tuning and a lock switch, when closed, inhibits automatic triggering of tuning.  Two expansion ports provide access to all major pins for future add ons, like antenna and transmitter switching units or external SWR sensors.



Pins for core administrative functions are defined here:

These pins are basically used for everything except driving relays for inductor and capacitor switching, antenna switching, transmitter switching, and Hi Z/Lo Z switching.  The pin definitions are most self-explanatory and pins can be substituted as long as the pin has the appropriate capabilities (i.e. analog).  Note the rig TX and RX lines are for a SoftwareSerial RS-232 port.

Features are turned on and off at compile time here:

These activate various serial port messages for events.  The most useful one for code troubleshooting is DEBUG_STATUS_DUMP which can be used with the CLI S and P commands to get an instant status of the tuner.

Feature Detail


This enables the LCD display code.  The LiquidCrystal library is used and typical 4 bit LCD displays can be used with the appropriate pins defined in this line:



Enables base serial port functionality.


Activates a basic command line help menu that is accessed using a ? (question mark).   The help menu items that are displayed depends on what functionality is enabled.

Sample menu:



This feature declaration is going to be deprecated.  The frequency counter will be a standard required piece of hardware.


If enabled the tuner will bypass the matching network when no transmit signal is detected.  The delay time is set with:


Enables automatic sleep mode.  The unit will put the AVR in power saving sleep mode after a certain amount of inactivity time.  The inactivity time is defined here (units are mS):

A pin can be configured to go high when the unit is awake:

This pin could be used to drive a relay or transistor that activates and deactivates ancillary circuits in order to conserve power.

The unit can be awoken from sleep mode by driving the following pin high:




Thus feature reads the rig frequency regularly and will switch the tuner to the closest stored match when the rig receive frequency / band is changed.


This feature passes commands from the computer coming into the USB port and forwards them out the rig serial port, and also sends responses from the rig back to the computer, effectively making the Arduino look transparent to the computer.  This allows computer logging programs to continue to control  the rig and also allows the Arduino to query the radio.  This feature seem to work best when serial port and rig port are set to the same baud rate.  (Probably some optimization is needed for this code.)  Note that you cannot currently use this feature and FEATURE_COMMAND_LINE_INTERFACE simultaneously, however a future update will allow multi-native serial port units like the Arduino Mega to support both a computer rig pass through port and a serial command line port.


This feature makes an RGB I2C LCD display change colors based on the tuner state.  Colors for the various states are configured here:

The “lookups” for the colors are here:

Component Detail – 100 Watt Unit

Other Stuff You’ll Need:

The Relays

I’ve been asked by several folks what relays I used or what relays they should use.  In the prototype I used some relays I had laying around from Maker Shed, ones which are no longer offered by them and I don’t have sourcing information for.  This was a major screw up on my part but I honestly didn’t think the prototype unit would be in use long and would essentially be disposable.  It’s worked so well that I use it every day and haven’t had the motivation to build a second unit to replace the prototype.  Worthy choices for relays include:

There are undoubtedly hundreds of suitable relays, but these are just some suggestions.

Rig Interface

The rig interface functionality currently provides two features: tuning autoswitching (when the receive frequency is changed, mainly when bands are switched), and automatic invoking of transmitter tune mode.

In order to activate the rig interface, the rig must be configured in the Rig serial port definitions area of the code:

The baud rate for the rig is set here:

There are several configuration parameters available for tweaking.  Note that rig 0 in the code is actually rig 1 in the user interface, rig 1 is rig 2, etc.

As of this writing there are no provisions in the CLI or LCD menu to change the transmitter (nor is there an LCD menu yet!).  It’s coming :-)

Various rig interface settings are in k3ng_rig_control.h .

The following lines in k3ng_rig_control.h determine what rig support is compiled into the code.  Naturally, more rig types consume more memory; comment out any unneeded rigs.

As of this writing, Yaesu support is working, and I haven’t had the opportunity to test Kenwood.  Icom, Elecraft, and other major rigs and vendors will be supported.

Debugging Functionality

Extensive debugging options are provided.  These should only be enabled if troubleshooting an issue or working on code as any enabled options take up memory and can slow tuning down.

Debugging Options:

This enables the S and P commands in the CLI, which are the Status Dump and Periodic Status Dump commands.  These display a status message that give the state of the tuner and its various measurements and subsystems:

Enables logging of tune buffer operations.  The tune buffer stores in EEPROM successful tuning combinations.  With DEBUG_TUNE_BUFFER enabled, two command line commands are enabled:

B Command – List Tune Buffer


#: the index number of the entry

C – Clear Tune Buffer


Source Code

pins.h – administrative and control pin definitions


hardware.h – hardware configuration

The include files are activated by uncommenting and customizing these lines:

Bugs and Feature Requests


Imágenes sobre riego automático arduino de Google

Bordignon, Fernando-Raul-AlfredoIglesias, Alejandro-Adrian

Download (12Mb)

English abstract

In design and construction of digital interactive objects described Arduino, a free software platform and hardware, such as the "electronic clay" with students and artists are making the objects of the future: from robots or automatic irrigation equipment for school gardens , intelligent lighting systems, household meteorological stations, musical instruments or vernacular novel adaptations of industrial artifacts. This sequence, accompanied by a theoretical introduction about the landmarks of the digital revolution and technological literacy, hopes that consumer traspasemos border technology to become creators. To do this, in this book step by step how to make the Arduino platform, and a healthy dose of wit, objects like a traffic light a MiniPiano, digital and even given a mechanical vampire detailed. The commitment of this volume in the Tools collection focuses on strengthening a culture of learning that dissolve the distinctions between professional and academic training as well as between teaching and play. This book also seeks to participate in the education of a citizen able to escape them to the uses of technology scripted by corporations, by creating digital objects that respond to their own imagination and the needs of their community.

Spanish abstract

En Diseño y construcción de objetos interactivos digitales se describe a Arduino, una plataforma de software y hardware libre, como la “arcilla electrónica” con la que estudiantes y artistas están fabricando los objetos del futuro: desde robots o equipos de riego automático para huertas escolares, a sistemas de iluminación inteligente, estaciones meteorológicas hogareñas, instrumentos musicales novedosos o adaptaciones vernáculas de artefactos industriales. Esta secuencia didáctica, acompañada por una introducción teórica en torno a los hitos de la revolución digital y la alfabetización tecnológica, aspira a que traspasemos la frontera del consumidor de tecnología para convertirnos en creadores. Para ello, en este libro se detalla paso a paso cómo fabricar con la plataforma Arduino, y una buena dosis de ingenio, objetos como un semáforo, un minipiano, un dado digital e incluso un vampiro mecánico. La apuesta de este volumen de la colección Herramientas se centra en fortalecer una cultura del aprendizaje que disuelva las distinciones entre formación profesional y académica, así como entre la enseñanza y el juego. Con este libro también se busca participar en la educación de un ciudadano capaz de escaparles a los usos de la tecnología guionados por las corporaciones, mediante la creación de objetos digitales que respondan a su propia imaginación y a las necesidades de su comunidad.

Item type: Book
Keywords: Tecnología, Arduino, Objetos interactivos digitales, Software, Educación
Subjects: L. Information technology and library technology. > LD. Computers.
Depositing user: Fernando Bordignon
Date deposited: 29 Dec 2015 18:15
Last modified: 29 Dec 2015 18:15

Actions (login required)

View Item