There are 3 types of applications that Room software suits very well and which require none or more or less advanced electronics knowledge (IoT, Raspberry Pi or Arduino):
- Preparation with NOOBS 3.0
- Headless HDMi rezolution
- Static IP address
- Additional USB wifi adpater
- MQTT, PyQt5 and Eric6
- Reboot and relaunch
- Disable Bluetooth
- MQTT treading issue when packet loss
Download NOOBS offline install from https://www.raspberrypi.org/downloads/noobs/ and unzip all files in a clean SD Card (16GB recommended)
-
Let NOOBS boot
-
Check the box Raspbian Full installation
-
Select your language and keyboard
-
Click Install(i) and proceed (for a few minutes)
-
When the installation is finished, reboot
-
Complete the wizard that appeared on the first start:
- set country
- change password
- select WiFi network (if relevant)
- update software
-
Update Raspbian:
$ sudo apt-get update $ sudo apt-get upgrade
-
Add screen
$ sudo apt-get install screen
- Order HDMI dummy plug such as https://www.amazon.com/s?k=hdmi+dummy+plug&ref=nb_sb_noss_2
- Edit /boot/config.txt
$ sudo nano /boot/config.txt -> #framebuffer_width=1280 #framebuffer_height=720 framebuffer_width=1920 framebuffer_height=1080
Edit /etc/dhcpcd.conf
$ sudo nano /etc/dhcpcd.conf
->
interface eth0
static ip_address=192.168.0.10/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1
interface wlan0
static ip_address=192.168.0.200/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1
-
Hotplug a Raspberry comapible Wifi USB apdapter such as https://www.amazon.fr/gp/product/B07D35XB1C/ref=ppx_yo_dt_b_asin_title_o03__o00_s00?ie=UTF8&psc=1
$ lsusb Bus 001 Device 004: ID 0bda:8178 Realtek Semiconductor Corp. RTL8192CU 802.11n WLAN Adapter Bus 001 Device 005: ID 0424:7800 Standard Microsystems Corp. Bus 001 Device 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
-
Connect to wifi network from the desktop
-
Disable onboard wifi then reboot (eventually disable Bluetooth as well):
$ cat /etc/modprobe.d/raspi-blacklist.conf ## disable onboard wifi blacklist brcmfmac blacklist brcmutil ## disable onboard bluetooth blacklist btbcm blacklist hci_uart
Wifi network configuration is editable, order is not relevant if several nerworks are available:
$ cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=FR
#network={
# ssid="free_escape"
# psk="toto00"
# key_mgmt=WPA-PSK
#}
network={
ssid="Linksys_RDC"
psk="toto001"
key_mgmt=WPA-PSK
}
$ sudo apt-get update
$ sudo apt-get install qt5-default pyqt5-dev pyqt5-dev-tools
$ sudo pip3 install paho-mqtt
$ sudo apt-get install eric
Start script.py:
$ screen -d -m python3 ~/Room/Props/script.py -s %BROKER%
Stop script.py:
$ ps aux | grep python | grep -v \"grep python\" | grep script.py | awk \'{print $2}\' | xargs kill -9
Relaunch script.py:
$ ps aux | grep python | grep -v \"grep python\" | grep script.py | awk \'{print $2}\' | xargs kill -9 ";" sleep 3 && screen -d -m python3 ~/Room/Props/script.py -s %BROKER%
Reboot:
$ sudo reboot -f
Start script at boot:
pi@podium:~ $ cat /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
su pi -c "cd ~/Room/Podium ; python3 podium.py > ~/startup.log 2>&1 &"
exit 0
Issues have been reported when using paho-mqtt in multithreaded applications:
- with QoS 2
- facing packet loss
Then code is waiting on a message to be published that is in the state of mqtt_ms_publish but we are already connected, so it will never publish.
It seems to be the issue we have faced with Podium (room Pharao) which get stuck after hours running well.
Solution is to publish messages with QoS 0 or QoS 1. Arduino PubSubClient uses QoS 0 and it works, even with packet loss.
Faure Systems (Oct 9th, 2019)
- company: FAURE SYSTEMS SAS
- mail: dev at faure dot systems
- github: fauresystems
- web: Faure Systems