Skip to content

How to switch off the Sunfounder 10.1 inch HDMI display via the toggleMonitor function

sohamakl edited this page Feb 1, 2020 · 9 revisions

Introduction

The Sunfounder 10.1 inch HDMI touch display permanently shows "No signal" when the HDMI port is turned off by TeleFrames toggleMonitor function.

To ensure that the display turns off when using the toggleMonitor function, a hardware extension is necessary. Starting with TeleFrame version 2.1 this can be controlled via a screen configuration file.

With an optocoupler and a resistor, switched via a configurable GPIO port of the Raspberry Pi, we simulate the operation of the on/off-switch of the display.

Hardware requirements

The following components are used in this tutorial:

  • An optocoupler KB817 DIL/DIP
  • A metal film resistor 220 Ohm
  • Four jumper wires female 10 cm
  • Some insulating tape

Also a soldering iron and some solder is required.

Software requirements

To control the GPIO port a shell script is used which uses the extension Wiring Pi. Currently a version is delivered with Raspbian Buster which is not yet compatible with the Raspberry Pi 4 B. For a Raspberry Pi 4 B you have to update to version 2.52.

With the command gpio -v you can check which version is installed. Version 2.50 shows the following information on the Raspberry Pi 4:

gpio -v
gpio version: 2.50
Copyright (c) 2012-2018 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

Raspberry Pi Details:
  Type: Unknown17, Revision: 01, Memory: 0MB, Maker: Sony
  * Device tree is enabled.
  *--> Raspberry Pi 4 Model B Rev 1.1
  * This Raspberry Pi supports user-level GPIO access.

The compatibility can be recognized by correct values in the line Type: Unknown17, Revision: 01, Memory: 0MB, Maker: Sony.

To update you should first check if a new package is available in the meantime. The easiest way to do this is to execute the following command sudo apt-get update && apt-get upgrade.

If this is not successful, the package can be updated with the following commands:

cd /tmp
wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb

Now gpio -v shows the following information:

gpio -v
gpio version: 2.52
Copyright (c) 2012-2018 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

Raspberry Pi Details:
  Type: Pi 4B, Revision: 01, Memory: 4096MB, Maker: Sony
  * Device tree is enabled.
  *--> Raspberry Pi 4 Model B Rev 1.1
  * This Raspberry Pi supports user-level GPIO access.

You can use the command gpio readall to view the current configuration of your gpio ports.

+-----+-----+---------+------+---+---Pi 4B--+---+------+---------+-----+-----+
| BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
|     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
|   2 |   8 |   SDA.1 |   IN | 1 |  3 || 4  |   |      | 5v      |     |     |
|   3 |   9 |   SCL.1 |   IN | 1 |  5 || 6  |   |      | 0v      |     |     |
|   4 |   7 | GPIO. 7 |   IN | 1 |  7 || 8  | 1 | IN   | TxD     | 15  | 14  |
|     |     |      0v |      |   |  9 || 10 | 1 | IN   | RxD     | 16  | 15  |
|  17 |   0 | GPIO. 0 |   IN | 0 | 11 || 12 | 0 | IN   | GPIO. 1 | 1   | 18  |
|  27 |   2 | GPIO. 2 |   IN | 0 | 13 || 14 |   |      | 0v      |     |     |
|  22 |   3 | GPIO. 3 |   IN | 0 | 15 || 16 | 0 | IN   | GPIO. 4 | 4   | 23  |
|     |     |    3.3v |      |   | 17 || 18 | 0 | IN   | GPIO. 5 | 5   | 24  |
|  10 |  12 |    MOSI |   IN | 0 | 19 || 20 |   |      | 0v      |     |     |
|   9 |  13 |    MISO |   IN | 0 | 21 || 22 | 0 | IN   | GPIO. 6 | 6   | 25  |
|  11 |  14 |    SCLK |   IN | 0 | 23 || 24 | 1 | IN   | CE0     | 10  | 8   |
|     |     |      0v |      |   | 25 || 26 | 1 | IN   | CE1     | 11  | 7   |
|   0 |  30 |   SDA.0 |   IN | 1 | 27 || 28 | 1 | IN   | SCL.0   | 31  | 1   |
|   5 |  21 | GPIO.21 |   IN | 1 | 29 || 30 |   |      | 0v      |     |     |
|   6 |  22 | GPIO.22 |   IN | 1 | 31 || 32 | 0 | IN   | GPIO.26 | 26  | 12  |
|  13 |  23 | GPIO.23 |   IN | 0 | 33 || 34 |   |      | 0v      |     |     |
|  19 |  24 | GPIO.24 |   IN | 0 | 35 || 36 | 0 | IN   | GPIO.27 | 27  | 16  |
|  26 |  25 | GPIO.25 |   IN | 0 | 37 || 38 | 0 | IN   | GPIO.28 | 28  | 20  |
|     |     |      0v |      |   | 39 || 40 | 0 | OUT  | GPIO.29 | 29  | 21  |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
| BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
+-----+-----+---------+------+---+---Pi 4B--+---+------+---------+-----+-----+

This is especially helpful because Wiring Pi does not number the GPIO pins in BCM format. In the later definition of the GPIO pin to be used it is necessary to specify the wPi number. In this turorial we will use wpi 29.

If the TeleFrame Application is installed via the installer script, Wiring Pi will be installed automatically in the future, so this section will lose relevance.

Building instruction

... pcb ... Sunfounder PCB

Optocoupler

Raspberry Pi PCB ...

Functional test

...

TeleFrame configuration

...