fpm

Raspberry Pi

Informàtica1 secció402 enllaçosVeure l'original

General

Maquinari / Hardware

Programari / Software

  • Sistema operatiu / Operating system
    • Raspbian Benchmarking – armel vs armhf
    • Raspbian (armhf)
      • based on Debian (Linux)
      • default user / password: pi / raspberry
    • Debian (armel)
    • Instal·ladors / Installers
      • ...
        ... provider
        rpi-imager Raspberry Pi
        NOOBS
        PINN
    • rpi-imager
      • Instal·lació / Installation
        • from package
        • from source
          • Dependències / Dependencies
            • Mageia
              • sudo dnf install git gcc gcc-c++ make cmake libarchive-devel libcurl-devel openssl-devel lib64qt5base5-devel lib64qt5quickcontrols2-devel lib64qt5svg-devel lib64qt5help-devel
          • git clone --depth 1 https://github.com/raspberrypi/rpi-imager
          • cd rpi-imager
          • mkdir -p build
          • cd build
          • cmake ../src
          • make
          • sudo make install
        • ...
      • Ús / Usage
        • rpi-imager
    • NOOBS (New Out of Box Software) / PINN (PINN is not NOOBS)
      • NOOBS For Raspberry Pi (prepare SD card from Linux)
        1. Create a single primary FAT partition
          1. List all disks and partitions:
            • fdisk -l
              • Disk /dev/mmcblk0 ...
          2. Work with your sd card:
            • fdisk /dev/mmcblk0
          3. Print existing partition list:
            • p
          4. Delete all existing partitions:
            • d
          5. Create a new partition with default values:
            • n
          6. Change partition type to W95 FAT32 (b):
            • t
            • b
          7. Write partitions:
            • w
        2. Format the partition:
          • mkfs.vfat /dev/mmcblk0p1
        3. Download NOOBS:
        4. Eject and instert sd card
        5. Get the mount point:
          • mount | grep -i mmcblk0p1
        6. Move to the mount point:
          • cd /run/media/.../F2AC-9B34
        7. Unzip the downloaded NOOBS zip to it:
          • mv /tmp/NOOBS_latest /tmp/NOOBS_latest.zip
          • unzip /tmp/NOOBS_latest.zip
        8. Remove sd card:
          • cd
          • umount /dev/mmcblk0p1
      • Setting
        1. Insert SD card in RPi
        2. ...
      • Partitions

        • size
          name
          type
          mmcblk0p1
          821MB
          RECOVERY
          W95 FAT16
          mmcblk0p5
          60MB
          boot
          W95 FAT32
          mmcblk0p6
          13GB
          root
          ext4
          mmcblk0p3
          32MB
          SETTINGS
          ext4
  • Admin tools
  • Configuració / Setup
    • sudo raspi-config
      main menu option /boot/config.txt alternative
      1 System Options S1 Wireless LAN

      S2 Audio

      S3 Password
      passwd
      S4 Hostname
      hostnamectl set-hostname ...
      S5 Boot / Auto Login
      • B1 Console
      • B2 Console Autologin
      • B3 Desktop
      • B4 Desktop Autologin


      S6 Network at Boot

      S7 Splash Screen

      S8 Power LED

      2 Display Options D1 Resolution

      D2 Underscan

      D3 Pixel Doubling

      D5 Screen Blanking

      3 Interface Options P1 Camera

      P2 SSH

      P3 VNC

      P4 SPI

      P5 I2C

      P6 Serial Port enable_uart=0|1
      P7 1-Wire

      P8 Remote GPIO

      4 Performance Options P1 Overclock

      P2 GPU Memory

      P3 Overlay File System

      P4 Fan

      5 Localisation Options L1 Locale

      L2 Timezone

      L3 Keyboard

      L4 WLAN Country

      6 Advanced Options A1 Expand Filesystem

      A2 GL Driver

      A3 Compositor

      A4 Network Interface Names

      A5 Network Proxy Settings

      8 Update


      9 About raspi-config



      main menu
      option
      /boot/config.txt alternative
      1 Change User Password


      passwd
      2 Hostname


      hostnamectl set-hostname ...
      3 Boot Options
      B1 Desktop / CLI
      start_x


      B2 Wait for Network at Boot



      B3 Splash Screen


      4 Localisation Options
      I1 Change Locale



      I2 Change Timezone



      I4 Change Wi-fi Country


      5 Interfacing Options
      P1 Camera



      P2 SSH



      P3 VNC



      P4 SPI



      P5 I2C



      P6 Serial



      P7 1-Wire



      P8 Remote GPIO


      6 Overclock

      arm_freq

      7 Advanced Options
      A1 Expand Filesystem



      A2 Overscan
      disable_overscan
      overscan_left
      overscan_right
      overscan_top
      overscan_bottom


      A3 Memory Split



      A4 Audio



      A5 Resolution



      A6 GL Driver


      7 Update



      8 About raspi-config



    • Xarxa / Network
      • Info
      • ...
        /etc/debian_version
        static ip address must be defined in
        7 Wheezy /etc/network/interfaces
        8 Jessie /etc/dhcpcd.conf
        9 Stretch
        10 Buster
        11.4 Bullseye



      • ...

        mitjançant / through ... directament /direct
        ethernet switch regular cable (a crossover cable is not needed any more)
        • Local network between two RPis?
        • Can I connect a laptop and a raspberry pi using a cross over cable?
        • RPi: /etc/dhcpcd.conf
          • # It is possible to fall back to a static IP if DHCP fails:
            # define static profile
            profile static_eth0
            static ip_address=10.0.0.2/24
            #static routers=10.0.0.1
            #static domain_name_servers=10.0.0.1
            # fallback to static profile on eth0
            interface eth0
            fallback static_eth0
        • PC
          • Mageia
            • Centre de Xarxes -> Ethernet -> Configuració manual
              • Adreça IP: 10.0.0.10
              • Submàscara de xarxa: 255.255.255.0
        WiFi access point ad-hoc
      • ZeroConf
      • Setting WiFi up via the command line
        • sudo iwlist wlan0 scan | grep ESSID
        • /etc/wpa_supplicant/wpa_supplicant.conf
          • network={
                ssid="testing"
                psk="testingPassword"
            }
        • wpa_cli -i wlan0 reconfigure
        • ifconfig wlan0
      • modify metric of a route
        • sudo ip route list
        • sudo ip route replace default via 192.168.43.1 dev wlan0  metric 101
        • sudo ip route del default via 192.168.43.1 dev wlan0  metric 303
    • Rellotge / Clock
      • Alternatives
        • systemd-timesyncd
          • systemctl enable systemd-timesyncd
          • systemctl start systemd-timesyncd
        • NTP
  • Ciències / Sciences
  • Digital signage
  • Monitoratge remote / Remote monitoring
  • Video codecs
    • License keys
    • /boot/config.txt
      • decode_MPG2=0x...
    • Check:
      • vcgencmd codec_enabled MPG2
        vcgencmd codec_enabled WVC1
  • Vídeo vigilància / Video surveillance
  • Screen resolution
  • SSH
    • enable ssh server:
      • using config tool:
        • sudo raspi-config
          • 5 Interfacing Options -> P2 SSH -> Enable
      • using command line:
        • ...
    • X11
    • ssh pi@raspberrypi.local
      • default password: raspberry
      • Problemes / Problems
        • No es connecta
          • Pot ser un problema del tallafoc en el vostre PC
          • Solució / Solution:
        • WARNING: POSSIBLE DNS SPOOFING DETECTED!
          • Solució / Solution
            • ssh-keygen -R raspberrypi.local
        • Reset password
          • Change/reset password WITHOUT monitor/keyboard
          • Passos / Steps
            • remove SD card from RPi
            • insert SD card it on a Linux computer and mount root partition. It will be mounted on:
              • /run/media/${USER}/root/
            • option 1
              • sudo -i
              • # create a temporary user on your local machine
                useradd tmpuser
              • # set password
                echo "raspberry" | passwd --stdin tmpuser
              • # get shados of password
                tmpuser_shadow=$(awk -F: '$1 ~ /tmpuser/ {print $2}' /etc/shadow)
              • # replace pi password with new password
                awk -v new_shadow=${tmpuser_shadow} -F: '$1 !~ /pi/ {print} $1 ~ /pi/ {OFS=FS;$2=new_shadow; print}' /run/media/${USER}/root/etc/shadow >
                /run/media/${USER}/root/etc/shadow.new
              • # copy file owner and file mod
                chown --reference=/run/media/${USER}/root/etc/shadow /run/media/${USER}/root/etc/shadow.new
                chmod --reference=/run/media/${USER}/root/etc/shadow /run/media/${USER}/root/etc/shadow.new
              • # switch files
                mv /run/media/${USER}/root/etc/shadow /run/media/${USER}/root/etc/shadow.old
                mv /run/media/${USER}/root/
                etc/shadow.new /run/media/${USER}/root/etc/shadow
            • option 2
              • ...
  • TVD
    • Haupauge
      • wget ...
    • Requisits
      • sudo apt-get install ffmpeg dvb-apps
    • Tune
      • scan es-Collserola > ~/.tzap/channels.conf
      • tzap -r "TV3"
      • ffmpeg ...
  • Àudio / Audio
  • Jocs / Games
  • Càmera / Camera
    • os bits raspicam (legacy) TensorFlow Lite libcamera (new)


      • Python support
        • picamera

      • Python supported as alpha release:
        • picamera2 (alpha, from RPi, high level, on top of python3-libcamera)
        • python3-libcamera (libcamera, low level)
      • OpenCV
      • TensorFlow Lite
      11 Bullseye 32 sudo raspi-config available
      • from package:
        • libcamera-apps (installed by default)
      • from source:
        • ...
      64 cannot be re-enabled not available
      10 ...



    • Raspberry Pi Camera Algorithm and Tuning Guide (pdf)
    • libcamera.org
    • libcamera-apps
      • Compilació / Compilation
        • Building libcamera-apps
        • (cal?) elimineu la versió instal·lada des de paquets / remove version installed from packages:
          • sudo apt remove libcamera-apps
        • sense haver de recompilar libcamera / without rebuilding libcamera
          • sudo apt install -y libcamera-dev libepoxy-dev libjpeg-dev libtiff5-dev
          • també amb Qt (p.ex. quan es visualitza remotament sobre ssh) / also with Qt (e.g. to be used as remote window over ssh)
            • sudo apt install -y qtbase5-dev libqt5core5a libqt5gui5 libqt5widgets5
        • dependències de libcamera-apps
          • sudo apt install -y cmake libboost-program-options-dev libdrm-dev libexif-dev
        • passos / steps
          • cd ~/src
            git clone https://github.com/raspberrypi/libcamera-apps.git
            cd libcamera-apps
            git checkout prod
            mkdir build
            cd build
          • -D options:


            dependencies
            -DENABLE_DRM=1

            -DENABLE_X11=1 X11 libepoxy-dev
            -DENABLE_QT=1 Qt qtbase5-dev libqt5core5a libqt5gui5 libqt5widgets5
            -DENABLE_OPENCV=1 OpenCV libopencv-dev
            -DENABLE_TFLITE=1 TensorFlow TensorFlow Lite
          • amb  TensorFlow Lite instal·lat / with installed TensorFlow Lite
            • 32-bit
              • cmake .. -DENABLE_DRM=1 -DENABLE_X11=1 -DENABLE_QT=1 -DENABLE_OPENCV=0 -DENABLE_TFLITE=1 -DENABLE_COMPILE_FLAGS_FOR_TARGET=armv8-neon
            • 64-bit
              • cmake .. -DENABLE_DRM=1 -DENABLE_X11=1 -DENABLE_QT=1 -DENABLE_OPENCV=0 -DENABLE_TFLITE=1
          • sense TensorFlow / without TensorFlow
            • cmake .. -DENABLE_DRM=1 -DENABLE_X11=1 -DENABLE_QT=1 -DENABLE_OPENCV=0 -DENABLE_TFLITE=0
          • make -j4  # use -j1 on Raspberry Pi 3 or earlier devices
            sudo make install
            sudo ldconfig # this is only necessary on the first build
        • Problemes / Problems
      • Ús / Usage
        • X forwarding (using ssh -X)
          • libcamera-hello --qt-preview
          • ...
      • Post-processing
        • libcamera-hello --qt-preview --post-process-file /home/pi/src/libcamera-apps/assets/negate.json
        • OpenCV
          • requirements
            • sudo apt install opencv-data
            • sudo ln -s /usr/share/opencv4 /usr/local/share/OpenCV
        • TensorFlow Lite
          • ...
        • ...
          compilat amb
          processament libcamera-hello ... requisits addicionals / additional requirements
          - Negatiu --post-process-file negate.json
          HDR libcamera-still -o test.jpg --ev -2 --denoise cdn_off --post-process-file hdr.json
          libcamera-still -o test.jpg --post-process-file drc.json
          OpenCV Sobel
          --post-process-file sobel_cv.json
          Detecció de cares
          --lores-width 128 --lores-height 96 --post-process-file face_detect_cv.json
          Anotacions de text
          --post-process-file annotate_cv.json
          TensorFlow Classificació d'objectes
          --post-process-file object_classify_tf.json --lores-width 224 --lores-height 224
          • mkdir -p ~/models
          • cd ~/models
          • wget https://storage.googleapis.com/download.tensorflow.org/models/mobilenet_v1_2018_08_02/mobilenet_v1_1.0_224_quant.tgz
          • tar xvf mobilenet_v1_1.0_224_quant.tgz
          • wget https://storage.googleapis.com/download.tensorflow.org/models/mobilenet_v1_1.0_224_frozen.tgz
          • tar xvf mobilenet_v1_1.0_224_frozen.tgz
          • ln -s ln -s mobilenet_v1_1.0_224/labels.txt .
          Estimació de posició
          --post-process-file pose_estimation_tf.json --lores-width 258 --lores-height 258
          • cd ~/models
          • git clone https://github.com/Qengineering/TensorFlow_Lite_Pose_RPi_32-bits.git
          • ln -s TensorFlow_Lite_Pose_RPi_32-bits/posenet_mobilenet_v1_100_257x257_multi_kpt_stripped.tflite .
          Detecció d'objectes
          --post-process-file object_detect_tf.json --lores-width 400 --lores-height 300
          • cd ~/models
          • mkdir coco_ssd_mobilenet_v1_1.0_quant_2018_06_29
          • cd coco_ssd_mobilenet_v1_1.0_quant_2018_06_29
          • wget https://storage.googleapis.com/download.tensorflow.org/models/tflite/coco_ssd_mobilenet_v1_1.0_quant_2018_06_29.zip
          • unzip coco_ssd_mobilenet_v1_1.0_quant_2018_06_29.zip
          Segmentació de zones
          --post-process-file segmentation_tf.json --lores-width 258 --lores-height 258 --viewfinder-width 1024 --viewfinder-height 1024
          • cd ~/modes
          • ln -s ~/src/libcamera-apps/assets/segmentation_labels.txt .
          • wget " https://tfhub.dev/tensorflow/lite-model/deeplabv3/1/metadata/2?lite-format=tflite" -O lite-model_deeplabv3_1_metadata_2.tflite
    • picamera2
    • ...

Accés remot / Remote access

connection render available from RPi from PC
xarxa / network text console allow ssh
  • ssh pi@raspberry.local
  • ssh ...
graphics single window (X11) allow ssh
  • ssh -Y pi@raspberry.local
    • galculator
    • lxterminal
    • chromium-browser
    • ...
  • ssh -Y pi@raspberry.local "galculator"
desktop Xnest (old)
  • sudo apt install xnest
  • ssh -Y pi@raspberry.local
    • Xnest -geometry 800x600 :11 &
    • DISPLAY=:11 startlxde-pi
Xephyr on Rpi (new)
  • sudo apt install xserver-xephyr
  • ssh -Y pi@raspberry.local
    • Xephyr :11 -screen 1200x720 -resizeable &
    • DISPLAY=:11 startlxde-pi

Xephyr on your local PC (preferred one)
  • Mageia
    • sudo dnf install x11-server-xephyr
  • start ssh server
  • Xephyr :1 -screen 1200x720 -resizeable &
  • DISPLAY=:1 ssh -Y pi@raspberrypi.local "startlxde"
    • config files at RPi:
      • /etc/xdg/lxsession/LXDE/
      • ~/.config/lxsession/LXDE/
  • DISPLAY=:1 ssh -Y pi@raspberrypi.local "startlxde-pi"
    • Problemes
      • /home/pi/.cache/lxsession/LXDE-pi/run.log
        • Xlib:  extension "DPMS" missing on display "localhost:12.0".
        • Solution:
          • ...
HDMI to
USB-UVC adapter
graphics desktop
  1. v4l2-ctl --list-devices
  2. ffplay -f v4l2 -framerate 25 -video_size 1280x720 -fflags nobuffer -i /dev/video2

Projectes / Projects

  • Instructables: Raspberry Pi projects
  • OpenGL
  • Domòtica / Home automation
    • PrivateEyePi
    • IR remote
      • Mitsubishi air conditioner
      • Smart Air Conditioner with Raspberry Pi— An Adventure
        • sudo apt-get install lirc
        • /etc/modules
          • lirc_dev
            lirc_rpi gpio_in_pin=23 gpio_out_pin=22
        • /etc/lirc/hardware.conf
          • ...
            LIRCD_ARGS="--uinput"
            ...
            DRIVER="default"
            ...
            DEVICE="/dev/lirc0"
            MODULES="lirc_rpi"
        • /boot/config.txt
          • dtoverlay=lirc-rpi,gpio_in_pin=23,gpio_out_pin=22
        • sudo reboot
        • systemctl status lirc.service
        • get remote info
          • systemctl stop lirc.service
          • mode2 -d /dev/lirc0
        • ...
  • Fotografia / Photography
  • Lego
  • Joguines / Toys
  • Video
  • Machine learning
  • MQTT
    • Instal·lació amb Docker / Installation with Docker

      • compose single



        services: image pre config run post config
        Mosquitto   mosquitto:
            image: pascaldevink/rpi-mosquitto
            container_name: mosquitto
            ports:
             - "9001:9001"
             - "1883:1883"
            restart: always
        docker pull eclipse-mosquitto
        • docker run -d -p 1883:1883 eclipse-mosquitto
        • docker run -it -p 1883:1883 -p 9001:9001 eclipse-mosquitto

        InfluxDB   influxdb:
            image: hypriot/rpi-influxdb
            container_name: influxdb
            restart: always
            environment:
             - INFLUXDB_INIT_PWD="password"
             - PRE_CREATE_DB="iot"
            ports:
             - "8083:8083"
             - "8086:8086"
            volumes:
             - ~/docker/rpi-influxdb/data:/data
        docker pull influxdb
        • docker run -d -p 8086:8086 -v $PWD:/var/lib/influxdb influxdb
        • docker run -d -p 8086:8086 -v influxdb:/var/lib/influxdb --name influxdb influxdb
        • docker exec -it influxdb influx
          • CREATE DATABASE sensors
          • CREATE USER telegraf WITH PASSWORD 'telegraf'
          • GRANT ALL ON sensors TO telegraf
        Telegraf
        docker pull telegraf
        Create a local file telegraf.conf, by calling "telegraf config" using an ephemeral instance from image telegraf and edit it:
        • docker run --rm telegraf telegraf config > telegraf.conf
        • [[inputs.mqtt_consumer]]
            servers = ["tcp://raspberry_pi_ip:1883"]
            topics = [
              "sensors"
            ]
            data_format = "influx"
        • [[outputs.influxdb]]
            urls = ["http://raspberry_pi_ip:8086"]
            database = "sensors"
            skip_database_creation = true
            username = "telegraf"
            password = "telegraf"
        • docker run -v $PWD:/etc/telegraf:ro telegraf

        Grafana   grafana:
            image: fg2it/grafana-armhf:v4.6.3
            container_name: grafana
            restart: always
            ports:
             - "3000:3000"
            volumes:
              - grafana-db:/var/lib/grafana
              - grafana-log:/var/log/grafana
              - grafana-conf:/etc/grafana
        docker pull grafana/grafana
        • docker run -d -p 3000:3000 grafana/grafana
        http://raspberrypi.local:3000/
        • admin / admin
        • Data source: InfluxDB
          • URL: http://raspberry_pi_ip:8086
          • Database: sensors
          • User: ...
          • Password: ...
        • Dashboard
          • Query
            • A
              • ...
          • Visualization
            • ...
      • rtl_433 -> mosquitto -> telegraf -> influxdb -> grafana
        xiaomi mijia -> python paho -> mosquitto -> telegraf -> influxdb -> grafana
        order to config order when running
        image pre config run post config verify / monitor
        2 1 rtl_433 -
        • rtl_433 -f 433.92M -F mqtt
        • rtl_433 -f 433.5M -F mqtt


        2 1 Xiaomi MiJia
        main.py
        • import json
        • MQTT_SERVER = 'localhost'
          MIJIA_BTLE_ADDRESS = '...'
        • def publish_sensor_data(mqttc):
              message = json.dumps({'temperature':float(temperature), 'humidity':float(humidity), 'battery':battery})
              mqttc.publish('home/mijia/events', message, 1, True)
        home-monitoring-grafana/04-mijia_ble_mqtt/main.py
        (logs from main.py)





        • docker network create xarxa1


        1 2 Mosquitto docker pull eclipse-mosquitto
        • docker run --network xarxa1 -d --name mosquitto -p 1883:1883 eclipse-mosquitto
        • if the container already exists:
          • docker start mosquitto

        • mosquitto_sub -v -t '#'
        4 3 Telegraf docker pull telegraf
        • Create new user:
          • sudo useradd -rs /bin/false telegraf
          • telegraf_user_group=$(getent passwd | awk -F: '/^influxdb/ {print $3":"$4}')
        • Create config dir:
          • sudo mkdir -p /etc/telegraf
        • Create /etc/telegraf/telegraf.conf config file:
          • docker run --rm telegraf telegraf config | sudo tee /etc/telegraf/telegraf.conf > /dev/null
        • Set permissions (needed?)
          • sudo chown telegraf:telegraf /etc/telegraf/*
        • Modify telegram config file
          • get influxdb ip address:
            • docker network inspect bridge | grep -A 5 influxdb
          • sudo nano /etc/telegraf/telegraf.conf
            • [[inputs.mqtt_consumer]]
                servers = ["tcp://<mosquitto_ip_address>:1883"]
                topics = [
                  "rtl_433/raspberrypi/events",
                  "home/mijia/events",
                ]
                data_format = "json"

            • [[outputs.influxdb]]
                urls = ["http://<influxdb_ip_address>:8086"]
                database = "sensors"
                skip_database_creation = true
                ## HTTP Basic Auth
                username = "telegraf"
                password = "telegraf123"
        • docker run --network xarxa1 -d --user ${telegraf_user_group} --name=telegraf -v /etc/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro telegraf
        • if the container already exists:
          • docker start telegraf

        • docker container logs -f telegraf
        3 4 InfluxDB docker pull influxdb
        • Create new system user:
          • sudo useradd -rs /bin/false influxdb
          • influxdb_user_group=$(cat /etc/passwd | awk -F: '/^influxdb/ {print $3":"$4}')
        • Create /etc/influxdb/influxdb.conf (owned by root.root):
          • sudo mkdir -p /etc/influxdb
          • docker run --rm influxdb influxd config | sudo tee /etc/influxdb/influxdb.conf > /dev/null
          • ls -l /etc/influxdb/influxdb.conf
        • Create dir /var/lib/influxdb (owned by influxdb.influxdb)
          • sudo mkdir -p /var/lib/influxdb
          • sudo chown influxdb:influxdb -R /var/lib/influxdb
        • Init database with created init file and create a user (--rm option must be specified before --user) (--user option is needed because files in /var/lib/influxdb must be owned by influxdb.influxdb):
          • docker run --rm --user ${influxdb_user_group} \
            -e INFLUXDB_HTTP_AUTH_ENABLED=true \
            -e INFLUXDB_ADMIN_USER=admin \
            -e INFLUXDB_ADMIN_PASSWORD=admin123 \
            -e
            INFLUXDB_DB=sensors \ -e INFLUXDB_USER=telegraf \
            -e INFLUXDB_USER_PASSWORD=telegraf123 \
            -v /var/lib/influxdb:/var/lib/influxdb \
             influxdb /init-influxdb.sh
          • ls -l /var/lib/influxdb
        • docker run --network xarxa1 -d -p 8086:8086 --user ${influxdb_user_group} --name=influxdb \
          -v /etc/influxdb/influxdb.conf:/etc/influxdb/influxdb.conf \
          -v /var/lib/influxdb:/var/lib/influxdb \
          influxdb -config /etc/influxdb/influxdb.conf
        • if the container already exists:
          • docker start influxdb

        • curl -G http://localhost:8086/query --data-urlencode "q=SHOW DATABASES"
        • docker exec -it influxdb influx -precision rfc3339
          • SHOW DATABASES
          • SHOW USERS
          • USE sensors
          • SELECT * FROM mqtt_consumer
        5 5 Grafana docker pull grafana/grafana
        • docker run --network xarxa1 -d -p 3000:3000 --name=grafana grafana/grafana
        • if the container already exists:
          • docker start grafana
        http://raspberrypi.local:3000/
        • admin / admin
        • Add data source
          • InfluxDB
            • HTTP
              • http://<influxdb_ip_address>:8086
            • Auth
            • InfluxDB Details
              • Database: sensors
              • User: telegraf
              • Password: telegraf123
        • Add Query
          • A
            • FROM default mqtt_consumer
            • SELECT field(temperature_C) distinct()
            • GROUP BY time($_interval) fill(null)

  • Desenvolupament / Development

http://www.francescpinyol.cat/raspberry_pi.html
Darrera modificació: 5 de gener de 2025 / Last update: 5th January 2025
Casa / Home