Playing with Raspberry Pi
Helpful facts about Rspberry Pi.
Contents
Helpful facts about Rapberry Pi
What I used:
- Grove Pi+
- Several different sensors
- Raspberry Pi 3
What I tried:
- GrovePi + Pi 3
- Using GrovePi sensors/actuators
- Using microphone
- Using Alexa
- Using a bluetooth speaker
- Media center with Volumio
- Using Telegram
GrovePi + Pi 3
- Remote desktop: sudo apt-get install xrdp
- Used: Advanced: Using a PC and Win32 Disk Imager
- sudo raspi-config
- Check the pi password (not the one in the booklet but on a separate website) and change it!
Sources
- https://tutorials-raspberrypi.de/raspberry-pi-einstieg-wie-starte-ich/
- Raspberry Pi quick start: https://www.raspberrypi.org/learning/hardware-guide/quickstart/
- https://www.dexterindustries.com/howto/install-raspbian-for-robots-image-on-an-sd-card/
- https://www.raspberrypi.org/downloads/raspbian/
- WinDisk-Image: https://www.heise.de/download/product/win32-disk-imager-92033/download
- https://www.dexterindustries.com/howto/install-raspbian-for-robots-image-on-an-sd-card/
- https://tutorials-raspberrypi.de/raspberry-pi-ssh-windows-zugriff-putty/
- Expand Filesystem + update OS
- SSH - https://tutorials-raspberrypi.de/raspberry-pi-ssh-windows-zugriff-putty/
Using GrovePi sensors/actuators
- sudo python /home/pi/Dexter/GrovePi/Software/Python/grove_firmware_version_check.py
It's going to help us a lot by providing screenshots with what the console outputs. cd Desktop/GrovePi/Script sudo bash install.sh sudo reboot After you reboot, please enter the following commands in the terminal: cd ~/Desktop/GrovePi/Firmware sudo bash firmware_update.sh Again we would like to see a screenshot for these last 2 commands too.
Funktioniert:
- sudo python /home/pi/Desktop/GrovePi/Software/Python/grove_led_blink.py
- sudo python /home/pi/Desktop/GrovePi/Projects/LED_Fade/led_fade.py
- sudo python /home/pi/Desktop/GrovePi/Projects/Button_And_Buzzer/Button_And_Buzzer.py <= Button D3 Buzzer D2
- sudo python /home/pi/Desktop/GrovePi/Projects/Ultrasonic_And_Relay/Ultrasonic_And_Relay_v2.py <= Ultra D7, Relay D8
- sudo python /home/pi/Desktop/GrovePi/Projects/Home_Weather_Display/Home_Weather_Display.py
Home Weather Display
First did not work.
Had to copy library into folder.
http://forum.dexterindustries.com/t/solved-no-module-named-grove-rgb-lcd/1057/10
Also, the display would not work, see http://forum.dexterindustries.com/t/solved-home-weather-display-problem-to-readout-text/3173/2
I had to change the code accordingly (frequency reduced).
Using microphone
Using Webcam for microphone.
lsusb
Test:
arecord -l
arecord -D plughw:1,0 test.wav
aplay test.wav
Source
- http://www.raspberrypi-tutorials.de/hardware/mikrofon_einrichten.html
- https://blog.mutsuda.com/raspberry-pi-into-an-audio-spying-device-7a56e7a9090e
- https://computers.tutsplus.com/articles/using-a-usb-audio-device-with-a-raspberry-pi--mac-55876
Using Alexa
- Amazon Developer Account
- Alexa Autostart
- To make German skills work, I had to change the country setting to Germany in the amazon.com account
Alexa Help
- Alexa app git issues: https://github.com/alexa/alexa-avs-sample-app/issues?utf8=%E2%9C%93&q=
- Alexa Blog: https://developer.amazon.com/de/blogs/tag/alexa
- GrovePi Forum: http://forum.dexterindustries.com/t/running-the-amazon-alexa-controlled-robot-updated-ifttt-error/3255
- Alexa API: https://developer.amazon.com/public/solutions/alexa/alexa-voice-service/content/avs-api-overview
- Alexa Account: https://alexa.amazon.de/spa/index.html#player/queue
Alexa Medical Skills
- Medizin-Skills:
- DocCheck Flexikon
- mcx:relax - Alexa starte Entspannung
- mylife - Tipp des Tages
- Länger Leben - Todesursachen, Tipps
- Life Companion - Emotionales Vermächtnis, Christliche Redaktion von LifeCompanion
- mcx:Krankenakte - Was für Termine habe ich?
- mcx:opCheck - Alexa frage O P Check Bereich Anästhesie (Unterstützung bei Ausführung von Safety Surgical Checklists laut WHO)
- Patientensicherheit in Kliniken - Fragen Sie Infos über Gesundheitseinrichtung ab.
- Fitness Fakten
Alexa Commands
- Alexa Commands:
Mehr:
DocCheck Flexikon "Alexa öffne DocCheck Flexikon" "Alexa, frage DocCheck Flexikon was Insulin ist" "Erkläre mir Herzinsuffizienz" Radio.de "Alexa, starte radio.de" "Alexa suche House Sender" "Alexa, spiele Radio 105 HITS" Wiki Deutschland "Alexa starte Wiki Deutschland"
Sources
- https://tutorials-raspberrypi.de/raspberry-pi-amazon-alexa-deutsch-installieren/
- http://lifehacker.com/how-to-build-your-own-amazon-echo-with-a-raspberry-pi-1787726931
Bluetooth Speaker
Fazit: I did not succeed. I got pretty far, e.g., I was able to play music via bluetooth from the mobile phone. However, the on-board bluetooth chip of pi3 makes a lot of problems.
Some sources I used an how the helped:
To start and use bluetooth I had to:
- Install bluez, pulseaudio, bluetooth, bluetooth module
- In "sudo raspi-config" I had to disable "serial" [1]
- Then, in "/boot/config.txt" I had to comment out:
dtoverlay=pi3-disable-bt dtoverlay=pi3-miniuart-bt
Then I had to:
sudo systemctl status hciuart.service sudo systemctl start hciuart.service sudo systemctl status bluetooth sudo systemctl start bluetooth sudo hciconfig sudo hciconfig hci0 up rfkill list rfkill unblock bluetooth
Also possible:
sudo bluetoothctl power on agent on default-agent scan on pair XX:XX... trust XX.XX... connect XX.XX... pacmd list-sinks pacmd set-default-sink bluez_sink.08_EB_ED_36_99_9D pactl set-default-sink bluez_sink.08_EB_ED_36_99_9D
See [2].
What also possible helped: start-pulseaudio-x11
Increase volume via [3]
alsamixer
alsa store (or similar, to store the changes)
To change sound:
pactl list cards short <= did show the mobile phone
Jabra did not work (as neither did the Anker SoundCore 2):
See aplay -l should show bluetooth [4]
More info about mpd, have switched to pulseaudio:
https://wiki.ubuntuusers.de/MPD/Server/
Worked partly, to play some sound:
aplay /usr/share/sounds/alsa/Front_Center.wav
Did not help:
pacmd set-default-sink bluez_sink.08_EB_ED_36_99_9D pactl set-default-sink bluez_sink.08_EB_ED_36_99_9D
pulseaudio --start
Sound volume: alsamixer -Dhw [5]
All about PulseAudio: https://wiki.ubuntuusers.de/PulseAudio/
pactl only exposes a subset of the available operations. For the full set use the pacmd(1). pactl - Control a running PulseAudio sound server pacmd - Reconfigure a PulseAudio sound server during runtime
As said before, HSP profile is supported with PulseAudio 6 and newer."
A2DP, Advanced Audio Distribution Profile, for high audio quality, as normal speakers. E.g. Music streaming HSP, Headset Profile, the device exchanges in/out audio and some basic AT commands. E.g. VoIP call HFP, Hands-Free Profile, the device acts as a phone, so it exchanges audio in/out and telephony commands. E.g. Hands-Free mode in car
Phone and Ipad do only work as a source, not a sink. pacmd list-sinks
sudo apt-get purge pulseaudio
Installed newer version of pulseaudio [6]
Finally, the reason for breaking with the on board bluetooth:
Onboard-Bluetooth-Dongle is not working properly (!!): http://youness.net/raspberry-pi/bluetooth-headset-raspberry-pi-3-ad2p-hsp
Sources:
- https://www.raspberrypi.org/magpi/bluetooth-audio-raspberry-pi-3/
- https://askubuntu.com/questions/70560/why-am-i-getting-this-connection-to-pulseaudio-failed-error
- https://wiki.fhem.de/wiki/Raspberry_Pi_3:_GPIO-Port_Module_und_Bluetooth
- https://raspberrypi.stackexchange.com/questions/51548/raspberry-pi-3-bluetooth-pairing-issue-with-tablet
- http://www.forum-raspberrypi.de/Thread-raspbian-mpd-mit-bluetoothlautsprecher-hilfe-bitte
- https://www.raspberrypi.org/forums/viewtopic.php?t=68779
- http://youness.net/raspberry-pi/bluetooth-headset-raspberry-pi
- New: http://youness.net/raspberry-pi/bluetooth-headset-raspberry-pi-3-ad2p-only
- Make a source to a sink? https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=124876
- Reset pulseaudio: https://askubuntu.com/questions/225444/how-to-make-pulseaudio-work-again
Media center with Volumio
http://typingoutloud.org/raspberry-pi-installing-volumio-pibang/
sudo service apache2 stop
https://askubuntu.com/questions/764222/nginx-installation-error-in-ubuntu-16-04
Mount USB drive:
sudo fdsik -l
nano /etc/fstab
/dev/sda1 /mnt/music_usb vfat defaults 0 0 <= FAT32
http://simonthepiman.com/how_to_setup_windows_file_server.php
MPC works: https://stmllr.net/blog/streaming-audio-with-mpd-and-icecast2-on-raspberry-pi/
MPDroid works
Volumio would not work
Volumio with Alexa was then not possible either [7], [8].
Sources:
- https://www.computerhilfen.de/info/mpd-und-mpc-auf-dem-raspberry-pi-installieren.html
- https://strobelstefan.org/?p=4244
- https://play.google.com/store/apps/details?id=com.namelessdev.mpdroid
Using Telegram
First howto: https://tutorials-raspberrypi.de/telegram-messenger-auf-dem-raspberrypi/
Second howto: https://tutorials-raspberrypi.de/ueber-telegram-messenger-raspberry-pi-steuern/
Telegram messenger CLI: https://github.com/vysheng/tg
Had to comment line 101 according to [9].
Would not accept our landline so I instead I use my mobile phone number on both the mobile phone and the pi, and chat with myself (did not help: https://forum.fhem.de/index.php?topic=38328.405).
When setting up the "bot" I had to consider not to run into endless loops when sending "Befehl nicht verstanden".