The LCD/keypad shield did not come with a
pinout for the top side breakout pins. Some of
the pins are labeled and some are not.
Figure 1 shows the digital I/O pins and some
of the power pins available on the LCD/keypad
shield. I/O pins 11, 12, and 13 are not needed
with my hardware, but they are available for use if
you choose different hardware or add additional
control features. I soldered pins into the shield for
Reset, Vin, and Ground on the bottom edge of
the shield (next to the reset pushbutton), and I
connected the ESP8266 and X- 10 interface
through pins on the shield.
The menu to set up the timer features is
entered by pressing the UP button. All of the
parameters except clock time are stored in the
Arduino Uno program memory using EEPROM
write commands, so they will be remembered
during loss of power. The clock time is stored in
the DS3231 ATC24C32 RTC. If you use the Set Clock
features available in the Setup function of my sketch, it will
store year, month, day, hours, minutes, and seconds in the
RTC.
There are many resources available through the
Internet to program the RTC that you can select if you
choose not to use what I provided in the Arduino Uno
sketch. A detailed flow chart of the menu system is
provided in the Software resources available for download
1. Set Zone 1 ON time.
2. Set Zone 1 OFF time.
3. Set Wi-Fi switches that are active and assign Zone
for control.
4. Set Zone 2 ON time.
5. Set Zone 2 OFF time.
6. Set Clock.
The hardware and all software (sketches for the
Arduino Uno, ESP8266-01 Wi-Fi module, Itead S20
and Sonoff) utilized in this project are provided at
the article link.
How Should I Package
My Timer Project?
I wanted a case that had space inside to mount
all the electronic components. Most of the cases I
found were only large enough for the Uno and LCD
shield. My design includes three satellite boards
(RTC, ESP8266, and Firecracker), and I wanted space
for these components inside my case also. I found a
3D file download; refer to Figure 2. The 3D files are
available at www.thingiverse.com/thing:142282.
This presented an additional challenge of
having the case printed, but I knew there were
many places that would 3D print items these days.
Unfortunately, many of the 3D print services I
contacted wanted in excess of $100 to print this
case. I then discovered that local libraries and
universities had 3D printing services and charge
by the ounce for the plastic used. This turned out
to be a very reasonable approach, and the total
print cost was less than $10.
If you take this approach, be prepared to
spend a significant amount of time sanding the
printed case to give it a professional look. It also
took several hours to file the holes in the case for
the included 3D printed buttons, and tweaking
the bottom of the button height so the buttons
interfaced with the pushbuttons on the
LCD/keypad shield. In addition, I had to remove
plastic on three sides of each pushbutton so they
would flex when pushed.
Helpful Tips for
Programming
All modules can be programmed using the Arduino
IDE (integrated development environment). To do so, you
must install the ESP8266 board manager files into the
Arduino IDE. SparkFun has published a helpful installation
tutorial at
https://learn.sparkfun.com/tutorials/esp8266.../installing-
the-esp8266-arduino-addon. In addition, you must install
the libraries necessary for my programs into the Arduino
IDE. The Resources sidebar in Part 1 includes links to the
add-on libraries available at GitHub.com; the Arduino
company supported libraries are available for installation
using the Library manager inside the Arduino IDE.
Programming the Arduino Uno requires a USB cable
with A and B connectors for attachment from your
September 2017 35
■ FIGURE 2. 3D printed case.
■ FIGURE 1.
LCD/keypad
shield pinout.
To post comments on this article and find any associated files and/or
downloads, go to www.nutsvolts.com/magazine/issue/2017/09.