Difference between revisions of "13.3inch Magic Mirror"
m (Text replacement - "{{#urlget:amazon|default}}=display" to "{{#ifeq: {{#urlget:amazon|0}}|{{#urlget:Amazon|0}}| default|}}=display") |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | <div class="wiki-pages black-color"> | ||
{{Infobox item | {{Infobox item | ||
|img=[[File:13.3inch-Magic-Mirror-1.jpg|300px|{{Amazon_nolink|default={{#ifeq: {{#urlget:amazon|0}}|{{#urlget:Amazon|0}}| default|}}|url=link=https://www.waveshare.com/13.3inch-magic-mirror.htm}}|13.3inch Magic Mirror]] | |img=[[File:13.3inch-Magic-Mirror-1.jpg|300px|{{Amazon_nolink|default={{#ifeq: {{#urlget:amazon|0}}|{{#urlget:Amazon|0}}| default|}}|url=link=https://www.waveshare.com/13.3inch-magic-mirror.htm}}|13.3inch Magic Mirror]] | ||
Line 19: | Line 20: | ||
{{Service00}} | {{Service00}} | ||
[[Category:OLEDs / LCDs|OLEDs / LCDs]] [[Category:Raspberry Pi|Raspberry Pi]] [[Category:Raspberry Pi LCD|Raspberry Pi LCD]] | [[Category:OLEDs / LCDs|OLEDs / LCDs]] [[Category:Raspberry Pi|Raspberry Pi]] [[Category:Raspberry Pi LCD|Raspberry Pi LCD]] | ||
+ | </div> |
Revision as of 02:15, 16 May 2022
| ||
Introduction
13.3inch Magic Mirror, Voice Assistant, Touch Control, Raspberry Pi 3A+ Inside
Features
- 13.3inch IPS screen,1920x1080 high resolution
- Embed Raspberry Pi 3A+ as controller
- 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
- 75x75mm spacing mounting holes (M4 screw hole) for general wall mount
- Comes with 75° tilt angle stand
Writing Image
- Write Image for Compute Module Boards eMMC version
- Write Image for Compute Module Boards Lite version
USB2.0
The USB port is disabled by default on the CM4 to save power. If you need to start, you need to add the following demo to the config.txt file:
dtoverlay=dwc2,dr_mode=host
After restarting
If you use the latest Raspberry Pi OS (image after October 30, 2021) USB2.0 is OTG mode by default, 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).
Method 1. Pre-configured image
- 1. Download the pre-configured image and write it to your TF card
- 2. Add the following lines to wpa_supplicat.conf files in the BOOT directory. (if you didn't find the files, create it)
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 country=US network={ ssid="your_real_wifi_ssid" psk="your_real_password" }
Note: you need to change your_real_wifi_ssid and your_real_password" to the real ssid and password
- 3. Inset the card to Raspberry Pi and power on it
Method 2. Configure image manually
- 1. Write Raspbian image
- Download the lasted Raspbian 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 micro SD card and name it as SSH.
- Modify config.txt file which is located at BOOT directory, add the following lines to config.txt file
hdmi_group=2 hdmi_mode=82 hdmi_cvt 1920 1080 60 6 0 0 0
- Save and insert the micro SD card to Raspberry Pi.
- Connect the Magic mirror to network and power on Raspberry Pi.
- After booting, you can access Raspberry Pi via SSH, or directly connect keyboard and mouse.
- 2. Install WM8960 sound card driver
- Open the terminal and use the following commands to install
git clone https://github.com/waveshare/WM8960-Audio-HAT cd WM8960-Audio-HAT sudo ./install.sh
- Modify config.txt file, remove the following line from the file or comment it.
#dtparam=audio=on
- Then reboot Raspberry Pi
sudo reboot
- After rebooting, check the driver by the following command
sudo dkms status
- If you can get the information as below, it means that the driver was installed successfully.
wm8960-soundcard, 1.0, 4.19.58-v7l+, armv7l: installed
- Test the sound card
- Test playing: aplay -l
[email protected]:~ $ aplay -l **** List of PLAYBACK Hardware Devices **** card 0: wm8960soundcard [wm8960-soundcard], device 0: bcm2835-i2s-wm8960-hifi wm8960-hifi-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0
- Test recording: arecord -l
[email protected]:~ $ arecord -l **** List of CAPTURE Hardware Devices **** card 0: wm8960soundcard [wm8960-soundcard], device 0: bcm2835-i2s-wm8960-hifi wm8960-hifi-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0
- 3. Install Magic Mirror driver
- Open terminal and type 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
cd ~/MagicMirror/modules git clone https://github.com/waveshare/MMM-VoiceAssistant.git cd MMM-VoiceAssistant cp config/config.js.en ~/MagicMirror/config/config.js #显示英文 #cp config/config.js.cn ~/MagicMirror/config/config.js #显示中文 cd ~/MagicMirror DISPLAY=:0 npm star
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 take in the virtual environment, if you close the terminal and restart it, you should use the command below to enter the environment again firstly
source ~/env/bin/activate
- 5. Install snowboy
- Install 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 make 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 snowboy, you will hear ding and the information below are printed on the mirror
INFO:snowboy:Keyword 1 detected at time: 2019-12-03 11:30:16
- 6. 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" } }
- Accoding to the official guide to install Google Assistant Service
- Please follow the third step of the official guide to configure and create 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 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 model
(env) $ python -m pip install --upgrade google-auth-oauthlib[tool]
- Genegrate credential
(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 browser of your PC.
Please visit this URL to authorize this application: https://...
- Go to the URL, you are asked to log in your Google Account and get the authorization code by following 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 commandto 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 Actions Console porject you created. You need to find the project ID in Actions Console. my-model is the device model name you create
- Press Enter, and try to ask something.
- 7. Set auto-run
- Install PM2
sudo npm install -g pm2
- Setup pm2
pm2 startup
- You will get informatin below, please copy the command and run it on 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 sevices, you can aslo use the following command
pm2 stop mm pm2 stop snowboy
- 8. kepp display lighting all the time
- Modify lightdm.conf
sudo nano /etc/lightdm/lightdm.conf
- Find the line "Xserver-command" below [SeatDefaults] section and change it from
#xserver-command=X
to
xserver-command=X -s 0 -dpms
- Then save and reboot
sudo reboot
Note
- 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 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 direcotory.
- Modify snowboy.sh file
nano snowboy.sh
- Modify the name to the the one you download, for English, you need to modify the snowboy.umdl to the 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<br\>
Follow the previous 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. Arrow keys
3. Enter
4. Menu and Return function
Resource
Drawing
Software
Authentication Information
Support
Support
If you require technical support, please go to the Support page and open a tickets.