13.3inch Magic Mirror C4

From Waveshare Wiki
Jump to: navigation, search
13.3inch Magic Mirror C4
13.3inch Magic Mirror C4

13.3inch CM4 Magic Mirror, Mini-Computer, Speech Assistant, Touch Control





This is a 13.3-inch magic mirror, a Mini-Computer that is powered by the Raspberry Pi CM4. This display uses a 13.3-inch IPS display panel and a 10-point capacitive touch panel. This magic mirror can show news, weather, and more user-defined content.


  • Embedded Raspberry Pi CM4, 64-bit 1.5GHz Quad-core, dual-band WIFI, Bluetooth5.0.
  • IPS display, 1920 x 1080 HD resolution.
  • One-way mirror, can display news, weather, and time.
  • Toughened glass capacitive touch panel, 6H hardness, supports up to 10-points touch.
  • Embedded ferrite Hi-Fi speaker.
  • Embedded microphone and speaker, adopts Snowboy Hotword detection engine.
  • 75 x 75mm spacing mounting holes (M4 screw hole) for wall mounting.
  • Comes with a 75° tilt angle stand.


The USB port is disabled by default on the CM4 to save power. If you need to start, you need to add the following to the config.txt file:


After restarting:

If you use the latest Raspberry Pi OS (image after October 30, 2021) USB2.0 is OTG mode by default, and CM4 will report an error:

 config failed, hub doesn't have any ports! (err -19)

However, USB can still be used. If you want to remove this error, remove otg_mode=1 in [cm4] of config.txt, and add dtoverlay=dwc2, dr_mode=host (USB cannot be recognized without adding it).
CM4 Burn EMMC 12.png

Write Raspberry Pi OS

  • Download the lasted Raspberry Pi OS image from the Rasberry Pi website and write it to an empty micro SD card.
  • Create a new Txt file under the BOOT directory of the micro SD card and name it SSH.
  • Modify the config.txt file which is located in the BOOT directory, and add the following lines to the config.txt file:
hdmi_cvt 1920 1080 60 6 0 0 0
  • Save and insert the micro SD card into Raspberry Pi.
  • Connect the Magic mirror to the network and power on Raspberry Pi.
  • After booting, you can access Raspberry Pi via SSH, or directly connect the keyboard and mouse.

Check the USB Audio Card

  • Test the sound output device:
aplay -l
  • Test the sound input device:
arecord -l

Install Magic Mirror driver

  • Open the terminal and run the following commands.
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt install -y nodejs
git clone https://github.com/MichMich/MagicMirror
cd MagicMirror/
npm install
  • After installing, run the command to display.
DISPLAY=:0 npm start
  • Install the MMM-VoiceAssistant model and display.
cd ~/MagicMirror/modules
git clone https://github.com/waveshare/MMM-VoiceAssistant.git
cd MMM-VoiceAssistant
cp config/config.js.en ~/MagicMirror/config/config.js
cd ~/MagicMirror
DISPLAY=:0 npm star

Install Python3 Virtual Environment

sudo apt-get update
sudo apt-get install python3-dev python3-venv
python3 -m venv env
env/bin/python -m pip install --upgrade pip setuptools wheel
source env/bin/activate

Note: The following steps should be taken in the virtual environment, if you close the terminal and restart it, you should use the command below to enter the environment again first.

source ~/env/bin/activate

Install Snowboy

  • Install independency libraries.
sudo apt-get install swig
sudo apt-get install libatlas-base-dev
sudo apt-get install portaudio19-dev
sudo apt-get install flac
pip3 install PyAudio
pip3 install SpeechRecognition
  • Download snowboy.
git clone https://github.com/Kitt-AI/snowboy.git
cd snowboy/swig/Python3
cd ../../examples/Python3
  • Modify snowbiydecoder.py file. Change from.import snowboydetect to import snowboydetect. Save and enable Snowboy.
cd ~/snowboy/examples/Python3
python3 demo.py resources/models/smart_mirror.umdl
  • Try to say smart mirror, you will hear ding and the information below is printed on the mirror.
INFO:snowboy:Keyword 1 detected at time: 2019-12-03 11:30:16

Install Google Assistant Service

  • Create .asoundrc file in /home/pi directory (the user directory).
nano .asoundrc
  • Add the following lines to the .asoundrc file.
pcm.!default {
  type asym
  capture.pcm "mic"
  playback.pcm "speaker"
pcm.mic {
  type plug
  slave {
    pcm "hw:0,0"
pcm.speaker {
  type plug
  slave {
    pcm "hw:0,0"
  • According to the official guide to installing Google Assistant Service.
  • Please follow the third step of the official guide to configure and create an OAuth Client ID JSON file. Don't forget to copy the JSON file to your Raspberry Pi.
  • Following the fourth step of the guide to register the device model.
  • Install Google Assistant SDK
(env) $ sudo apt-get install portaudio19-dev libffi-dev libssl-dev
(env) $ python -m pip install --upgrade google-assistant-sdk[samples]
  • Authorize the model.
(env) $ python -m pip install --upgrade google-auth-oauthlib[tool]
  • Generate credentials to be able to run the sample code and tools. Reference the JSON file you downloaded in the previous step; you may need to copy it to the device. Do not rename the file.
(env) $ google-oauthlib-tool --scope https://www.googleapis.com/auth/assistant-sdk-prototype \
      --save --headless --client-secrets /path/to/client_secret_ client-id .json
  • Then you will get an URL, please copy it and open it on the browser of your PC.
Please visit this URL to authorize this application: https://...
  • Go to the URL, you are asked to log in to your Google Account and get the authorization code by following the guides, Copy the code to the terminal
Please go to this URL: https://...
Enter the authorization code:
  • If the authorization process is done successfully, you will get the information as below.
credentials saved: /path/to/.config/google-oauthlib-tool/credentials.json
  • Use the following command to test.
googlesamples-assistant-pushtotalk --project-id my-dev-project --device-model-id my-model
  • Note: my-dev-project is the Google Could Platform ID of the Actions Console project you created. You need to find the project ID in the Actions Console. my-model is the device model name you create.
  • Press Enter, and try to ask something.

Set auto-run

  • Install PM2.
sudo npm install -g pm2
  • Setup pm2.
pm2 startup
  • You will get the information below, please copy the command and run it on the terminal.
[PM2] To setup the Startup Script, copy/paste the following command:
sudo env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u pi --hp /home/pi
  • Run Magic Mirror by PM2.
cd MagicMirror/modules/MMM-VoiceAssistant/pi
pm2 start mm.sh
  • Run snowbiy by PM2.
cd MagicMirror/modules/MMM-VoiceAssistant/pi
pm2 start snowboy.sh
  • Set auto-run.
pm2 save
  • If you want to disable the services, you can also use the following command.
pm2 stop mm
pm2 stop snowboy

Set the Display Always On

  • Modify lightdm.conf.
sudo nano /etc/lightdm/lightdm.conf
  • Find the line "Xserver-command" below [SeatDefaults] section and change it from


xserver-command=X -s 0 -dpms
  • -s # – set screen saver not enabled.
  • dpms turn off power saving management.
  • Then save and reboot.
sudo reboot


In /boot/config.txt, add dtoverlay=uart3.

sudo nano  /boot/config.txt
#device name /dev/ttyAMA1


Open the Raspberry Pi terminal and enter the following command to access the configuration screen.

sudo raspi-config
#Select Interfacing Options -> Serial, disable shell visit, and enable hardware UART port.  
#Device name: /dev/ttyS0
L76X GPS Module rpi serial.png


1. If the wakeup word is unworkable for you, please log in Snowboy website
https://snowboy.kitt.ai, And add the new wakeup word.
Click the recording icon to record voice and test if the voice model is workable.
Download the model file and copy it to ~/MagicMirror/modules/MMM-VoiceAssistant/pi directory.
Modify snowboy.sh file.
nano snowboy.sh
Modify the name to the one you download, for English, you need to modify the snowboy.umdl to yours.
cd ~/MagicMirror/modules/MMM-VoiceAssistant/pi
~/env/bin/python3 demo.py smart_mirror.umdl snowboy.umdl
2. Google Assistant Service can only support 500 requests every day.

Open ~/MagicMirror/modules/MMM-VoiceAssistant/pi/audiofileinput.py. You can enter the following code
13.3inch mmirror.png

Follow the previous 6. Google Assistant Service installation section to register an account, device model, and install authorization.
Finally, replace DEVICE_ID and DEVICE_MODEL_ID in the program with the corresponding values.

About the Buttons

1. Turn on or off the LCD display. If the LCD is not used for a long time, it can be turned off through this button to reduce power consumption.

2. Direction keys.

3. Enter.

4. Menu and Return.


3D Drawings




First unscrew the screws of the back cover of the screen, and then use a card, some hard material, to cut along the back cover of the screen from top to bottom, and open the back cover of the screen
13.3inch Magic Mirror C4 FAQ.png
13.3inch Magic Mirror C4 FAQ2.png
And then install the CM4 on the back of the board as shown below:
13.3inch Magic Mirror C4 FAQ3.png



12V 1A outer diameter 3.5 and inner diameter 1.35. If you want to use other power supplies, you need to ensure that the power supply ripple is within ±5%


Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)