WiziTouch Smart Home control panel
Wiznet PICO based simple touch controller for smart home.
mp3, and 0.96" IPS display support. Minimum components.
Demo video:
WiziTouch
... is WIFI enabled board for ultra low cost simple interaction with humans.
This project is for inspiration and can be enhanced, more buttons, different labels and some onboard devices like RTC clock, mosfet drivers to direct control in application like termostat or smart switch.
It is designed like touch panel only but I have larger ambition, for small project it can work as complete standalone unit.
Heart is amazing circuitpython which have suport for touch buttons, IPS display and also provide sound output, not only simple beeps but also mp3 playback for true vice prompts.
Display can show true color images in "high resolution" for graphs, icons and simple text with various fonts ...
Touch code example
import touchio
def readKeyboard():
key=-1
if touch_up.value:
key=1
if touch_down.value:
key=2
if touch_left.value:
key=3
if touch_right.value:
key=4
if touch_ok.value:
key=5
if touch_back.value:
key=6
return key
touch_back = touchio.TouchIn(board.GP14)
touch_down = touchio.TouchIn(board.GP3)
touch_left = touchio.TouchIn(board.GP9)
touch_ok = touchio.TouchIn(board.GP2)
touch_up = touchio.TouchIn(board.GP8)
touch_right = touchio.TouchIn(board.GP1)
Display code example
from adafruit_st7789 import ST7789
# Release any resources currently in use for the displays
displayio.release_displays()
tft_cs = board.GP21
tft_dc = board.GP16
spi_mosi = board.GP19
spi_clk = board.GP18
spi = busio.SPI(spi_clk, spi_mosi)
backlight = board.GP22
display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs)
display = ST7789(display_bus, width=160, height=80, rowstart=1, colstart=26, rotation=270, backlight_pin=backlight)
# Make the display context
# splash = displayio.Group()
# display.show(splash)
print("Display test")
Audio code example - simple BEEP
def beep():
audioPin = PWMOut(board.GP0, duty_cycle=0, frequency=440, variable_frequency=True)
audioPin.frequency = 5000
audioPin.duty_cycle = 10000
time.sleep(0.02)
audioPin.duty_cycle = 0
audioPin.deinit()
Audio code example - mp3 playback
import board
import audiomp3
import audiopwmio
audio = audiopwmio.PWMAudioOut(board.GP0)
decoder = audiomp3.MP3Decoder(open("/mp3/new.mp3", "rb"))
audio.play(decoder)
while audio.playing:
pass
print("Done playing!")
WiFi code example (LCD, Beep, Touch, PING)
import time
import board
import busio
import terminalio
import displayio
import analogio
import gc
import os
import touchio
import audiomp3
import audiopwmio
import digitalio
import microcontroller
from digitalio import DigitalInOut
from digitalio import Direction
from adafruit_espatcontrol import adafruit_espatcontrol
from adafruit_simple_text_display import SimpleTextDisplay
from pwmio import PWMOut
from adafruit_st7789 import ST7789
def beep():
audioPin = PWMOut(board.GP0, duty_cycle=0, frequency=440, variable_frequency=True)
audioPin.frequency = 5000
audioPin.duty_cycle = 10000
time.sleep(0.02)
audioPin.duty_cycle = 0
audioPin.deinit()
def readKeyboard():
key=""
if touch_up.value:
key="up"
if touch_down.value:
key="down"
if touch_left.value:
key="left"
if touch_right.value:
key="right"
if touch_ok.value:
key="ok"
if touch_back.value:
key="back"
return key
touch_back = touchio.TouchIn(board.GP14)
touch_down = touchio.TouchIn(board.GP3)
touch_left = touchio.TouchIn(board.GP9)
touch_ok = touchio.TouchIn(board.GP2)
touch_up = touchio.TouchIn(board.GP8)
touch_right = touchio.TouchIn(board.GP1)
LED = digitalio.DigitalInOut(board.GP28)
LED.direction = digitalio.Direction.OUTPUT
VSYS_voltage = analogio.AnalogIn(board.VOLTAGE_MONITOR)
VBUS_status = digitalio.DigitalInOut(board.VBUS_SENSE) # defaults to input
VBUS_status.pull = digitalio.Pull.UP # turn on internal pull-up resistor
SMPSmode = digitalio.DigitalInOut(board.SMPS_MODE)
SMPSmode.direction = digitalio.Direction.OUTPUT
SMPSmode.value = True
displayio.release_displays()
tft_cs = board.GP21
tft_dc = board.GP16
spi_mosi = board.GP19
spi_clk = board.GP18
spi = busio.SPI(spi_clk, spi_mosi)
backlight = board.GP22
display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs)
display = ST7789(display_bus, width=160, height=80, rowstart=1, colstart=26, rotation=270, backlight_pin=backlight)
print("WiziTouch")
# Get wifi details and more from a secrets.py file
try:
from secrets import secrets
except ImportError:
print("WiFi secrets are kept in secrets.py, please add them there!")
raise
# Debug Level
# Change the Debug Flag if you have issues with AT commands
debugflag = False
# Pins setup with WizFi360 through UART connection
RX = board.GP5 #TX pin for WizFi360-EVB-PICO
TX = board.GP4 #RX pin for WizFi360-EVB-PICO
resetpin = DigitalInOut(board.GP20) #Reset pin for WizFi360-EVB-PICO
rtspin = False #RTS pin
uart = busio.UART(TX, RX, baudrate=11520, receiver_buffer_size=2048) #Serial settings
print("ESP AT commands")
# For Boards that do not have an rtspin like WizFi360-EVB-PICO set rtspin to False.
esp = adafruit_espatcontrol.ESP_ATcontrol(
uart, 115200, reset_pin=resetpin, rts_pin=rtspin, debug=debugflag
)
print("Resetting ESP module")
esp.hard_reset()
esp.at_response("at")
print("Scanning for AP's")
for ap in esp.scan_APs():
print(ap)
print("Checking connection...")
# secrets dictionary must contain 'ssid' and 'password' at a minimum
print("Connecting...")
esp.connect(secrets)
print("IP address ", esp.local_ip)
while True:
key=readKeyboard()
if key!="" :
print(key)
LED.value = True
beep()
if key=="ok":
print("Pinging 8.8.8.8...", end="")
print(esp.ping("8.8.8.8")) #Print the ping result
time.sleep(0.05)
LED.value = False
Display:
0.96" HD IPS COLOR display exactly fit in to panel hole
Board front
PCB is esthetical part
Schematic:
PCB board outline:
Project future:
As I write above this is something like inspiration core, adapt to your requirements ...
-
WiziTouch Is a Wi-Fi Touch Panel Powered by WIZnet's Wireless Pico Clone
Hackster Article about WiziTouch
-
PicoTouch HMI Is a Raspberry Pi Pico Carrier for Your Human-Machine Interface Projects
Hackster Article about old project with enhanced keyboard
-
Examples, Gerber, Design files
-
Circuitpython WiFi library
WizFi360-EVB-Pico in Circuitpython (WizFi360 + RP2040)
-
Schematic
Schematic
-
Demo
Code examples and libraries