By Ron, June 30, 2022
Introduction
This article describes how a Raspberry Pi4 remotely operates a residential dehumidifier located in a crawlspace. The Raspberry Pi4, mounted on the dehumidifier, sends commands to relays that are wired to the printed circuit board (PCB) inside the dehumidifier. The opening and closing of the relay contacts, simulates the pushing of five push buttons located on the dehumidifier control panel. Using a Windows PC running Virtual Network Computing (VNC) viewer software, the Pi4 is accessed remotely over a local computer network. Clicking menu buttons on a Python Tkinter GUI interface with a mouse, provides full operational control of the dehumidifier.
The idea to use a Raspberry Pi4 to control a dehumidifier originated when there was a need to install a dehumidifier in the crawlspace that only had 33 inches (838 mm) of headroom and physical access was limited. The dehumidifier is 24 inches (610 mm) tall and there was not enough clearance to manually view and operate the dehumidifier control panel located on the top of the unit.
Theory of Operation
A Logitech C922 USB camera is mounted on the top of the dehumidifier and a real time video stream of the control panel is displayed in a Python Tkinter GUI menu running on the RB Pi4. The real time video shows the dehumidifier’s humidity settings and the status of the control panel LEDs that indicate “power on”, “fan speed” and “filter reset”. Clicking a GUI button activates a relay that is wired to the actual push buttons located on the control panel circuit board inside the dehumidifier. Each GUI button controls a separate relay. When activated, the relays close for only 0.25 seconds and this simulates the pressing of the actual push button on the dehumidifier control panel by a human finger.
The “Bucket Full” LED was not a concern for this project since the dehumidifier condensation outlet was plumbed to a floor drain located 25 feet away. The condensation bucket will never fill up.
The Timer feature was also not a concern for this project and was not connected to a relay.
This project uses a Frigidaire dehumidifier model FFAD3533W1. Any make of dehumidifier would also work since most dehumidifiers have a similar control PCB using pushbuttons and status LEDs.
USB Camera and Video Stream
The Logitech C922 USB camera is a good choice since it is fully compatible with the Raspberry Pi4. It is auto focusing, works well with short view distances, and is “plug and play” with the Pi.
The video stream captured by the camera is 640×480 which shows more visual information that is needed. A region of interest (ROI) was cropped out of the video stream to present only the pertinent control panel information. The two white curved lines shown in Fig. 6.0 that are reflected near the “Bucket Full” letters are white LEDs on the USB camera that turn “on” to indicate the camera is recording.
6 Relay Board
The relay board interfaces the Raspberry Pi4 to the dehumidifier. The board used on the project was purchased from Amazon for $35.00 CDN. The relay board uses the Raspberry-gpio-python (aka. RPi.GPIO) software module to energize/de-energize the relays which will close/open the normally opened relay contacts. This action simulates the pressing of the dehumidifier control panel push buttons.
For example, when the GUI button “Fan Speed” is clicked with a mouse, the python command GPIO.output(19,False) will energize the relay on GPIO 19 and the normally opened relay contacts will close for 0.25 seconds. The command GPIO.output(19,True) will de-energize the relay and the contacts will open.
Mounting the Raspberry Pi4 to the Dehumidifier
The Raspberry Pi4 and relay board were mounted onto a piece of plywood attached to the backside of the dehumidifier.
Python and Tkinter Software
The key software components in this project are the GUI buttons that are clicked with a mouse to operate the dehumidifier. The GUI menu, including the buttons, were created with Python and the Tkinter module. Tkinter (pronounced Tea-Kay-inter) is the Python interface to a GUI library called Tk.
There are several options for creating graphical user interfaces in Python. They include PyQt, PySide, WxPython, PySimpleGUI and Kivy. Tkinter is a good choice since it is the only GUI toolkit included in the Python standard library and it is easy to learn and work with.
Tkinter creates a GUI with widgets, geometry management and event handling. The widgets used in this program were the frame, the button and the canvas widgets.
The GUI frame and button layout used in the program is illustrated below.
Conclusion
This project is a fine example of the versatility of the Raspberry Pi4. It is a small, inexpensive, and powerful computer that can be used in a variety of physical computing applications.
This project illustrates how a Raspberry Pi4, connected to a USB camera and a relay board, can remotely operate and control a dehumidifier. As an alternative to the Pi4, a Pi3 or a Pi3 B+ could be substituted and they would have the computation power required to achieve the same results.