Zonnestroompanelen in Nederland

duurzaamheid achter de meter

(10) Arduino analog test bench

Arduino test bench with a 3.5 inch TFT displaying in analog fashion

by Floris Wouterlood – Leiden – The Netherlands – February 10, 2017


Analog meters have been around for more than 150 years. They breathe nostalgia, that’s for sure. The human eye grasps the position of a needle on a scale often easier than a number displayed on a digital display. Why then not simulate an analog meter in a digital environment? This was the starting point for this project.

The desire to develop a simulated analog display went hand in hand with the desire to have a test bench, that is, a compact device including an Arduino, a display and connectors to plug in all sorts of external sensors.
Here I discuss the construction of a ‘test bench’ powered by an Arduino Nano, and equipped with a versatile 3.5 inch 320×480 pixel color TFT display. In this example the test bench is used to measure ambient room temperature with a Dallas DS18B20 sensor while relative humidity is simultaneously measured with a DHT11 sensor.

The temperature is displayed numerically and in a simulated analog fashion while the relative humidity is displayed only digitally. Construction of the bench is such that four digital pins on the Nano remain available for data sensing or for output. In addition, the A5 pin on the Nano is available for analogous sensing.


In previous papers I described the construction and wiring of a board powered by an Arduino Nano and equipped with a 3.5 inch 320×480 color TFT display for visual output of readings of scores of Dallas DS18B20 temperature sensors and DHT11 relative humidity sensors. One prototype and two ‘production’ versions of these devices were constructed. After commission they started to provide valuable data concerning the environmental situation inside and outside my home.
However successful, these devices were built to suit specific purposes, that is, monitoring input-output temperatures in floor heating loops and measuring temperatures of photovoltaic energy inverters in the attic. Their application is very satisfactory. Although the sensors of these devices can be unplugged and the devices used for test bench purposes, the unplugging, replugging and reprogramming appear to be quite cumbersome. It became desirable to construct a general purpose test bench device. This device should be fitted with a TFT display with sufficient pixel resolution. The luxury of having a TFT display available is partly offset because these displays ‘consume’ the majority of the available pins of an Arduino device. Nevertheless several pins remain available for input- or output purposes. As a TFT shield completely covers all pin headers on an Arduino Uno board these free pins should be made easily accessible in some way
The expectation is that the test bench device will be of good service in many experiments. In this example the output of the device on the display is a simulation of an analog meter. Analog meters are very 19th-20th century devices. Everywhere in the world analog gauges are being replaced with digital meters because the latter kind is faster, more economical and, most of all, with this type of meter it is easy to relay data streams to recording devices or computers for logging and analysis. Most analog devices are therefore considered primitive today. On the other hand analog devices often do not need an external power supply, they are less privacy-sensitive than digital devices, and especially antique ‘clocks’ simply look good.
A characteristic of the human brain is that we often find gauges and analog readings more pleasant and easier to interpret than readings on digital displays. Why not simulate an analog display on our Arduino? A matter of nostalgia, perhaps. Let’s construct an Arduino test bench with exposed free pins and with a simulated analog display!


Necessary parts
1 x Arduino Nano
1 x soldering board 80×120 mm
3 x 5 pin female pin header (data, GND, 5V)
2 x 8 pin female pin header (TFT display)
2 x 6 pin female pin header (TFT display)
4 x 3-pin female pin headers (‘J1-braces’)
1 cassette tape box (functions as stand)
1 x 3.5 inch color TFT Arduino shield
2 x spacer, height 5 mm
electronic wire


The display (figure 1) is a combined 3.5 inch TFT display-memory card reader shield with the typical pin arrangement that nicely fits the female pin headers of an Arduino Uno microcontroller board. Of the 28 pins on the display’s pin headers, 16 need to be wired to the Arduino: the 5V, 3V3, GND pins and the pins marked ‘LCD_nn’. Because the shield requires specific pins on the Arduino to function properly, only a few pins on the Arduino remain free for experimentation purposes: pin A5 and pins D10 through D13.

figure 1. Nameless 3.5 inch 320×480 TFT shield for the Arduino Uno, with its pin layout. 16 pins need to be connected with pins on the Nano.

As I favor the use of an Arduino Nano because of its small footprint and economy, and also because a TFT shield by design renders free pins of an Arduino Uno hardly accessible, I needed to create pin-to-pin wiring between the display and the Nano. While this can be achieved by simple soldering there is a more elegant way of connecting display and Nano: the pin-and-socket plugin approach.
Here, I used a 80×120 mm soldering board on which I soldered two rows of female pin headers together forming a socket that receives the display shield’s pin headers. This socket construction is neat and it enables quick replacement of a display with another one. A small challenge here was that the pin headers J2, J3 and J4 on the TFT shield (visible in figure 1) seamlessly match the hole pattern in the soldering board while pin header J1 misaligns with the soldering board’s holes. This problem was solved by milling a rectangular cut in the soldering board that exactly matched the position and dimensions of the J1 pin header on the TFT display. The female ‘socket-J1’ pin header on the soldering board was positioned on the board above the cutout, and glued to four braces: ‘support’ female pin headers soldered to the board, flanking the cutout.

Once the positions of the ‘socket’ female pin headers on the soldering board had been figured out, those accepting J2, J3 and J4 soldered into their final position and the J1 socket glued in place, the wiring could be installed. Figure 2 shows the wiring scheme. In order to free pins on the Nano the SD slot functionality on the TFT shield was not used.

figure 2. Schematic wiring of the components of the test bench. All parts seen from the back of the soldering board. 16 pins of the TFT display shield need to be connected with pins on the Nano. The SD card slot is not used.

figure 3. Actual wiring of the components of the test bench. Looking at the back of the soldering board. Note the J1 socket cutout in the board. The two bolts (B) will fasten the board to the stand.

A female Data pin header block was attached to the front of the board as well as female pin headers supporting 5V and GND connectivity for sensors. These 5V and GND pin headers were implemented as four-pin sockets to allow multiple sensors, leds or experiments attached to the bench. The female Data pin header was wired to pins A5, D10, D11, D12 and D13 of the Nano.

figure 4. Actual wiring with the actual positioning of the components of the test bench. The front contains the Nano, the TFT screen, the 5V/GND connectors (painted red and black, respectively) and the data pin header (painted white for convenience). Labels were glued on the board.

figure 5. Board attached with two nuts onto the lid of a tape cassette box. A spacer keeps the back of the board a few millimeters away from the plastic lid. This protects the wiring from mechanical damage. Tape cassette box boxes can be applied as cheap and handy stands for Arduino projects; they are made of extruded acrylic and can be worked on with tools – carefully.

After the soldering had been completed the board was attached with two bolts on the lid of a tape cassette box. The detail of the attachment is shown in Figure 5.
Once the test bench was ready I had a versatile test device at hand to perform Arduino experiments. In front of to the test bench a breadboard was placed that held a Dallas DS18B20 temperature sensor and a DHT11 temperature / relative humidity sensor. Temperature sensing with a Dallas DS18B20 is more accurate than with a DHT11.


Simulated analog meter
As the analog meter is simulated in software I looked around and found at Instructables.com in the Arduino section a very nice contribution by Bodmer, named “Arduino sketch for a retro analogue meter graphic on a modern TFT display”. The core of Bodmer’s sketch forms a backbone display subroutine of the sketch that powers the TFT.

figure 6. Test bench up and running. Attached to pin 11 is a DHT11 relative humidity sensor, while pin 12 receives data from a Dallas DS18B20 temperature sensor. The temperature is displayed numerically as well as ‘simulated analogous’, while the relative humidity is displayed numerically as well as with a gauge (sensors pinned onto a breadboard placed in front of the bench).



I successfully exchanged the 3.5 inch display with a 3.95 inch 320×480 color TFT display (featuring a ILI9488 controller) and with a 2.8 inch 240×320 color TFT display (ILI9341). These displays have two features in common. First, their pin header layouts are the same as that of the 3.5 inch display  and second, they contain an ILI controller chip that is supported by David Prentice’s mcufriend_kbv library (available at the Arduino forum). The controller in the present 3.5′ TFT display is an ILI9481.

The goals of the present project were successfully achieved: constructing a test bench with an Arduino Nano powered ‘engine’ with a small footprint, displaying the measured values of several sensors in a simulated analog fashion on a color TFT display. The test bench is used to test sensors in various rooms, let’s say a hot water pipe in the attic whose temperature I want to monitor, or simply the air temperature in the shed. In these ‘remote’ locations the test bench is powered by a USB power bank. The analogous readings are pleasant for the eye.


Other projects
(to be found at this web site)

•    Monitoring temperatures in floor heating loops with an Arduino with data display on a 3-5 tft-screen.
•    Construction of a desk display with a 3.5 inch 320×480 tft screen for multi temperature humidity sensing with an Arduino Nano.
•    Multi-temperature humidity sensing with an Arduino Nano displayed on a 3.5 inch color tft screen.

Sketches in ZIP file
The sketch in the zip file is named ‘analog_tft.ino’.

Special thanks to:
Bodmer (contributor to Instructables.com): see Instructables
David Prentice (author of the mcufrend_kbv library)