Skip to main content

Product Overview

PiSugar Whisplay HAT is a multifunctional expansion board for Raspberry Pi Zero, integrating a display, microphones, speakers, and more to turn it into a portable interactive device.

Product Features

  • Power supply voltage: 5V
  • Logic voltage: 3.3V
  • Audio codec chip: WM8960
  • Audio control interface: I2C
  • Audio data interface: I2S
  • Speaker power: 8Ω1W
  • Screen size: 1.69 inches (30mm*37mm)
  • Screen resolution: 240*280RGB
  • Screen controller chip: ST7789
  • Screen interface: 4-SPI

Hardware Resources

Pin Function and Raspberry Pi Pin (Physical Pin Number) Correspondence

Pin FunctionPin NumberPin FunctionPin NumberPin FunctionPin NumberPin FunctionPin Number
5VP2, P4LED1P22LCDCTRLP15I2SWSP35
GNDGNDLED2P18SPI_RSTP7I2SDINP38
I2CDATP3LED3P16SPI_DCP13I2SDOUTP40
I2CCLKP5SPI_MOSIP19
KEYP11SPI_CLKP23
SPI_CSP24

External Speaker Support

Whisplay allows for enhanced audio flexibility. Easily switch to an external speaker using the dedicated control.

Note: Compatible speakers must be single-channel (mono) and utilize an XH2.0 connector.

Raspberry Pi Usage Instructions

Refer to the github link: https://github.com/PiSugar/Whisplay

For now, Whisplay driver only support the latest official Raspberry Pi OS (not including the Lite version).

Audio Function

Installation

After cloning the github project, navigate to the Driver directory and use the script to install.

git clone https://github.com/PiSugar/Whisplay.git
cd Whisplay/Driver
sudo bash install_wm8960_drive.sh
sudo reboot

Sound Card Detection

Check playback: aplay -l

pi@PI0WH:~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: vc4hdmi [vc4-hdmi], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: wm8960soundcard [wm8960-soundcard], device 0: bcm2835-i2s-wm8960-hifi wm8960-hifi-0 [bcm2835-i2s-wm8960-hifi wm8960-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0

Check recording: arecord -l

pi@PI0WH:~ $ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: wm8960soundcard [wm8960-soundcard], device 0: bcm2835-i2s-wm8960-hifi wm8960-hifi-0 [bcm2835-i2s-wm8960-hifi wm8960-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0

Note that the sound card number may vary on different systems and hardware. In the example, the sound card number is 1, and this number should be used in subsequent commands.

Recording and Playback Test

Recording

sudo arecord -D hw:1,0 -f S32_LE -r 16000 -c 2 test.wav

Playback

sudo aplay -Dhw:1 test.wav

Graphical smplayer

The system provides a graphical interface to set more complex functions. You need to press F6 to select the sound card device, and the sound card name is wm8960.

sudo alsamixer

The default volume is relatively low; it can be adjusted up to around 70, beyond which it will cause distortion.

Display and Other Functions

The LCD, RGB LED, and buttons are all controlled by Python, with all functionalities integrated into the Driver.

Please note that the audio component has been installed as a system sound card and is not included in the Driver. You should use the audio functionality as a standard system sound card.

Test Program 1

Navigate to the example directory and run the test program.

cd Whisplay/example
sudo python test.py
#sudo python test.py --image test.jpg --sound test.mp3

Test Program 2

The test code completes a function that receives text via socket and displays it, and also notifies the status of the buttons. It can be used as a display interface for an AI chatbot.

  • Start the server

cd example
python chatbot-ui.py

The program will continuously listen on port 12345. After a client connects, it can send display information and receive button status.

  • Test UI

python sockettest.py

After running sockettest.py, click the button, and the content displayed on the LCD will change randomly.

Technical Information

Documents

Contact Information

For more technical support, please contact: pisugar.zero@gmail.com