I'm assembling two magic mirrors for me and my girlfriend. Based on this video tutorial: https://www.youtube.com/watch?v=fkVBAcvbrjU.
However with a slight twist. I'm also installing a webcam and microphone so we can use both mirrors for video conferences.
And finally I'm going to add voice control support using google assistant.
- see-through foil which is put on a petg holder
- Benq Monitor 20" Monitor
- Raspberry PI 3 Model B V1.2
- 16BG Micro SD
- HDMI Cable
- Webcam
- Soundcard
- USB Microphone
- Rasberian
- nodejs
sudo apt-get update
change user and remove default user http://raspi.tv/2012/how-to-create-a-new-user-on-raspberry-pi
sudo adduser username
sudo visudo
john ALL=(ALL) ALL
logout
login
sudo deluser pi
sudo deluser -remove-home pi
ssh-keygen -t rsa -C user@host
then enable ssh on start using
raspi-config
configuration
it can also be started and stopped using
sudo service ssh start
and sudo service ssh stop
check status with
sudo service ssh status
check open ssh sessions
who -a
kill ssh dameon
sudo pkill -9 sshd
linux brew http://linuxbrew.sh/
see available space left
df -BM
monitoring http://elinux.org/RPi-Monitor
install https://rpi-experiences.blogspot.de/p/rpi-monitor-installation.html
To use this repository follow the instruction bellow:
Execute the following command to add RPi-Monitor into your list of repository:
sudo wget http://goo.gl/vewCLL -O /etc/apt/sources.list.d/rpimonitor.list
Install my public key to trust RPi-Monitor repository:
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 2C0D3C0F
To install RPi-Monitor, execute the following command:
sudo apt-get update
sudo apt-get install rpimonitor
To upgrade RPi-Monitor, execute the following command:
sudo apt-get update
sudo apt-get upgrade
After installation you should excute the following command to update information about upgradable packages:
sudo /etc/init.d/rpimonitor update
access monitor with http://ip:8888
share folder with mac http://www.instructables.com/id/How-to-share-files-between-Mac-OSX-and-Raspberry-P/
sudo apt-get install netatalk
share folder with win http://raspberrypihq.com/how-to-share-a-folder-with-a-windows-computer-from-a-raspberry-pi/
- install samba
sudo apt-get install samba samba-common-bin
- add win support to config
sudo nano /etc/samba/smb.conf
workgroup = WORKGROUP
wins support = yes
and edit path
[PiShare]
comment=Raspberry Pi Share
path=/home/pi/share
browseable=Yes
writeable=Yes
only guest=no
create mask=0777
directory mask=0777
public=no
- enable user as network user
sudo smbpasswd -a pi
-
restart samba
sudo /etc/init.d/samba restart
install google drive https://github.com/prasmussen/gdrive also see https://github.com/pageauc/pi-timolo/wiki/Instructions-to-Re-Purpose-sync.sh
sudo crontabs -e
* * * * * su pi -c "/usr/local/bin/gdrive pull -no-prompt -ignore-conflict -ignore-name-clashes /home/pi/googledrive > /dev/null"
* * * * * su pi -c "/usr/local/bin/gdrive push -no-prompt -ignore-conflict -ignore-name-clashes /home/pi/googledrive > /dev/null"
applying bashrc
source ~/.bashrc
raspstill -o image.jpg
raspivid -o vid.h264 -t 10000
if webcam doesn't show up in chrome
# sudo modprobe bcm2835-v4l2Sent on:12:51 pm
sudo modprobe bcm2835-v4l2 gst_v4l2src_is_broken=1
HDMI Monitor Speaker worked for me out of the box as well as my JBL Bluetooth
Speaker test
speaker-test -f 440 -t sine
/usr/bin/chromium-browser --display=:0 https://web.skype.com
aplay -l
record sample, note: i changed plughw:0,0 to 1. first colum: card number, 2nd column device number
arecord --device=plughw:1,0 --format S16_LE --rate 44100 -c1 test.wav
change default record but keep hdmi audio https://raspberrypi.stackexchange.com/a/39942
aplay -l
it prints the following as result, where the 2nd device is the usb micro
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
Subdevices: 1/1
Subdevice #0: subdevice #0
now we set the default micro by editing https://raspberrypi.stackexchange.com/a/63101
create ~/.asoundrc
pcm.!default {
type asym
playback.pcm "plughw:0"
capture.pcm "plughw:1"
}
arecord --device=plughw:0,0 --format S16_LE --rate 44100 -c1 test.wav
aplay --device=plughw:0,0 test.wav
google assistant https://www.youtube.com/watch?v=tt-gOQSYbcQ / https://www.novaspirit.com/2017/05/02/google-assistant-raspberry-pi/
github: https://github.com/googlesamples/assistant-sdk-python/tree/master/google-assistant-sdk
google assistant sdk documentation https://developers.google.com/assistant/sdk/prototype/getting-started-pi-python/run-sample
enable api and get credentials json for google assistant https://console.cloud.google.com/
sudo apt-get install python3-dev python3-venv
sudo apt-get install portaudio19-dev libffi-dev libssl-dev
python3 -m venv env
env/bin/pip install pip setuptools --upgrade
source env/bin/activate
python -m pip install google-assistant-sdk[samples]
pip install --upgrade google-auth-oauthlib[tool]
google-oauthlib-tool --client-secrets /home/pi/ga/client_secret_magicmirrorone.apps.googleusercontent.com.json --scope https://www.googleapis.com/auth/assistant-sdk-prototype --save --headless
http://www.instructables.com/id/WhatsApp-on-Raspberry-Pi/
- Noobs (Currently 2.4.0)
- SD Formatter 4.0
https://www.youtube.com/watch?v=EfUpOpXDdLk&t=0s
some use cases:
- http://www.pocket-lint.com/news/139202-google-assistant-tips-and-tricks-master-your-android-assistant
- https://www.cnet.com/how-to/google-home-complete-list-of-commands/ alsamixer
port forwarding using windows https://stackoverflow.com/a/11535395
adding
netsh interface portproxy add v4tov4 listenport=4422 listenaddress=192.168.1.111 connectport=80 connectaddress=192.168.0.33
and removal
netsh interface portproxy delete v4tov4 listenport=4422 listenaddress=192.168.1.111
sudo nano /boot/config.txt
change values based on following:
display_rotate=0 Normal
display_rotate=1 90 degrees
display_rotate=2 180 degrees
NOTE: You can rotate both the image and touch interface 180º by entering lcd_rotate=2 instead
display_rotate=3 270 degrees
display_rotate=0x10000 horizontal flip
display_rotate=0x20000 vertical flip
Run DISPLAY=:0 npm start from the ~/MagicMirror directory to start your MagicMirror.
cd ~/MagicMirror
DISPLAY=:0 npm start
Start and Daemonize any application:
$ pm2 start app.js
Load Balance 4 instances of api.js:
$ pm2 start api.js -i 4
Monitor in production:
$ pm2 monitor
Make pm2 auto-boot at server restart:
$ pm2 startup
To go further checkout:
http://pm2.io/
sudo chown -R $USER /usr/local
sudo chown -R $USER /usr/lib/node_modules/