Everyone Wants Automation With a Big Display!
by Fernando Koyanagi in Circuits > Microcontrollers
870 Views, 2 Favorites, 0 Comments
Everyone Wants Automation With a Big Display!

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!

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

· 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

Mounting


Raspberry Pi 3 Model B PMW Pins


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


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

Constructor and Destructor

Code: SetPins

Code: UpdateStatus

Slider Events

Lamps Buttons Events

ChangeImageButton

Fan Button Event

Checkbox Event That Shows or Hides the Mouse Cursor
