Zonnestroompanelen in Nederland

duurzaamheid achter de meter

Arduino Nano desk display

Construction of a desk display with a 3.5″ 320×480 TFT screen for multi temperature-humidity sensing with an Arduino Nano

by Floris Wouterlood – Leiden, The Netherlands – July 3, 2016

This paper describes the construction and wiring of a desk display device whose main parts are an acrylic photo frame and a 90×150 mm circuit board. Mounted on the board are an Arduino Nano, a 3.5″ 320×480 pixel color TFT screen, a 10K potentiometer and a d-sub-9 connector. Via an 8-wire d-sub cable the device receives data for display from eight DS18B20 temperature sensors and four DHT11 relative humidity sensors.

In a previous paper in the Arduinohoekje, “Multi temperature-humidity sensing with an Arduino Nano displayed on a 3.5″ color TFT screen”*, I described the electric wiring of an Arduino Nano that displays readings of several Dallas DS18B20 temperature sensors and four DHT11 relative humidity sensors on a 3.5” 320×480 color TFT display. Following this successful prototype project I decided to construct a desk display that contains the Nano and the TFT display in a representative way, and at the same time, to use a 8-wire D-sub connector to get rid of the jungle of jumper wires that comes with a prototype.

figure 1: The final product: board assembled, mounted on photo frame, connected and working

Necessary parts
1x acrylic photostand
1x 90×150 mm circuit board
1x Arduino Nano
1x 3.5″ TFT 320×480 display screen (shield; ILI9341 compatible)
pin headers
1x 10 kΩ potentiometer
1x d-sub-9 male connector
4x 10 kΩ resistor
1x D-sub-9 cable (female-female)
4 spacers to mount the board behind the front of the photo frame

The principal parts of the display unit device are shown in figure 2. The circuit board contains neatly arranged the relevant parts: Arduino Nano, 3.5″ TFT screen and d-sub-9 connector. The spacers on the board’s corners have already been mounted.

figure 2: start of construction: front (left) and back (right) of the display unit layout.

All the wiring was scheduled to be mounted on the back of the board. Because the pin headers on the TFT display (shown in figure 10) do not exactly match the perforations in the circuit board I made rectangular cutouts in the circuit board and placed pin headers on the TFT display pins. The pin headers fit the cutouts in the board and are attached to thee board with glue to increase mechanical support of the TFT display. An advantage of this design is that unmounting or replacement of the TFT screen is easily accomplished.

figure 3: schematic indication of the positions of the pins of the Nano, TFT and D-sub seen from the back of the board. The 10k pot meter was included to fine-tune the pull up resistance of the string of DS18B20 temperature sensors.

As the mounting pins on the d-sub connector also did not match the spacing of the perforations in the circuit board I had to cut out an opening in the board here as well. The d-sub connector was fastened to the board with screws. Finally a hole needed to be drilled in an appropriate spot to accommodate the potentiometer. After this mechanical work the construction could proceed with the electronics part. Based on the arrangement of the principal components on the circuit board I designed the wiring diagram on my pc and then proceeded in three phases to solder all the neccessary wires: power, TFT, D-sub connector.

Phase 1: wring Power and GND

figure 4: Power wiring connecting the components: red (5V), green (3.3V for the TFT), black (GND).

Phase 2: wiring the TFT screen
Apart from power and GND, the TFT screen needs 13 wire connections with the Nano:  digital pins D2 through D9 and analog pins A0 through A4 (figure 5) (see also figure 10 for the TFT display).

figure 5: Phase 2: addition of the wiring required for the 3.5″ TFT screen.

figure 6: Back of the circuit board after completion of phase 2

Phase 3. Requirements for connecting the sensors via a d-sub-9 cable
On the sensors: Dallas DS18B20 temperature sensors can be purchased as individual parts or as ‘ready to use’ wire thermometers. I bought the parts and constructed my own sensors (figure 9B) by soldering a color-coded wire to each pin of the sensor (red: Voo (=5V); black: GND; white: DQ (=data)) and protecting the soldered connections with a crimp sock. DS18B20s operate at 5V.
One big advantage of this advanced temperature sensor is that many sensors can be hooked onto a single data bus. As a consequence the string of 8 temperature sensors served by the device consumes besides 5V and GND only one of the precious data pins on the Nano. I selected pin D13 for this purpose. Pin 9 of the d-sub connector was connected with D13 on the Nano (blue wire in figures 7 and 8) (see also figure 9, with a bridge to the wiper of the 10k potentiometer. Pin 5 of the d-sub connector was connected to GND, and pin 6 of the d-sub connector to the 5V pin on the Nano (figure 9).
The DHT11 temperature/humidity sensor is less advanced than the DS18B20 but it serves its purpose as relative humidity reporter well. Every DHT11 sensor requires its own data pin on the Nano. As there are four of these sensors I selected pins 10,11 and 12, and pin A5 (=digital pin 19) on the Nano for this purpose, and I soldered wires connecting these pins with pins 1 through 4 on the d-sub connector. Finally the pull-up 10kΩ resistors were soldered on and connected with the data wires of the DHT11’s. The wiring scheme is shown in figure 7 and the result of the actual wiring and soldering in figure 8.

figure 7: full schematic wiring

figure 8: wiring and soldering completed

DHT11 ‘pod’
I constructed two ‘pods’. Each pod consists of two DHT11 breakout boards mounted back to back, with an insulating foil in between, in a plastic vial (figure 9C). The pins were soldered on a piece of cut-out prototyping soldering board. Pins 1 (VCC) and 3 (GND) of the pair were connected while the DATA pins (pin 2) remained separated. An assembled pod has four wires: VCC, GND and for each of the DHT11s a separate data wire.

figure 9. A: D-sub 9 connector pin assignment. B: Dallas DS18B20 temperature probe. C: self made ‘pod’ containing two DHT11 humidity sensors back to back.

TFT display

figure 10. Nameless 320×480 3.5″ TFT color display shield. A: back of the shield, B: connectivity scheme with the Nano.

I am very satisfied with the results. A cool display shows the readings of the eight temperature sensors and the two pairs of relative humidity sensors, with a clean and continuous data stream concerning temperatures and humidities on various spots inside and outside the home (one of the temperature sensors and one DHT1 ‘pod’ are mounted outside). The spaghetti of jumper wires connected to the prototype is replaced by a single, neat cable. The 3.5 inch TFT display provides enough space to accommodate more readings. The temperatures currently monitored concern air temperatures outside the home and inside in my office, in the attic, the temperature of the outlet on the solar water heater, and casing  temperatures of several solar tie grid (micro)inverters. It is tempting to add more DS18B20 sensors to the one-wire bus to monitor the temperatures of additional solar inverters. Keeping an eye on casing temperatures of solar tie grid inverters is very convenient because a hard working inverter produces heat and, conversely, if an inverter malfunctions its temperature goes down to the ambient temperature. A temperature sensor thus can be considered a good ‘health’ indicator for a solar inverter. As my solar panels are equipped with a bunch of microinverters there is sufficient incentive to expand. While adding more temperature probes to the current array is easy, cable length may become a limiting factor. The temperature probe located at the moment farthest away from the display device has a cable length of about 15 meters.


Where to get the sketch?

Here! It is a zipped fille called attic_graphic_v_02.zip


*previous paper:
Multi temperature-humidity sensing with an Arduino Nano displayed on a 3.5″ color TFT screen.