Everyone Wants Automation With a Big Display!

by Fernando Koyanagi in Circuits > Microcontrollers

856 Views, 2 Favorites, 0 Comments

Everyone Wants Automation With a Big Display!

Porque todo mundo quer automação com display grande!

Yes, another video about DISPLAYS, a subject I really like! Do you know why?

Because with it, it’s possible to improve the user interface.

Automation users need a good visual indication. So I bring to you, an example with a 7 inch display, with capacitive touch and a Raspberry Pi with QT Creator (graphics library).

Everyone Wants Automation With a Big Display!

01.1.png

In this post, I’ll present a QT Creation automation, using new components and an example of servo-motor activation, using the PWM exit of Raspberry Pi. We will also use a 4-relay module in our automation.

Resources Used

7.png

· Raspberry Pi 3 model B+

· 2x Servos Towerpro MG996R

· 4-relay module

· 2x lamps

· Extension Socket

· Fonte 5V

· Arduino Power Adapter

· Jumpers

· Protoboard

· Display 7inch HDMI LCD 7’’ (Touch Screen)

· Fan

Pinout Raspberry Pi 3 Model B

9.png

Mounting

10.png
10.1.png

Raspberry Pi 3 Model B PMW Pins

11.png
11.1.png

The PWM pins in Raspberry Pi 3 are shown in the image above. We use the channel 0 for one servo-motor and channel 1 for other. We must pay attention in the GPIO used by the Wiring Pi (image on the right), so we’ll use the GPIO1 and GPIO24 and not the BCM pins (Broadcom SOC channel) GPIO10 e GPIO19.

https://www.electronicwings.com/raspberry-pi/raspberry-pi-pwm-generation-using-python-and-c

QT Project Interface

12.png
12.1.png

PS. The push button component doesn’t support giffs, so we will use a label (lblFan) to reproduce the giff. Also, we’ll use an invisible push button called imgFan, placed over the label, this way we can work with the click event.

There is another way to make it work, creating a clickable label class, but we opted to simplifly the code, so we are not going to use this way.

Code: Declarations and Variables

declaracoes.jpg

Constructor and Destructor

constructor.jpg

Code: SetPins

setpins.jpg

Code: UpdateStatus

updateStatus.jpg

Slider Events

Slider Events.jpg

Lamps Buttons Events

events of lamp button.jpg

ChangeImageButton

changeImageButton.jpg

Fan Button Event

fan button event.jpg

Checkbox Event That Shows or Hides the Mouse Cursor

event cursor.jpg

Download the Files