### Install Dummy Display Driver Source: https://docs.arduino.cc/tutorials/uno-q/remote-access Install the xserver dummy driver to enable headless desktop access. ```bash sudo apt install xserver-xorg-video-dummy sudo mkdir -p /etc/X11/xorg.conf.d ``` -------------------------------- ### Verify Udev Rule Installation Source: https://docs.arduino.cc/tutorials/uno-q/user-manual Displays the contents of the installed udev rule file. ```bash 1cat /etc/udev/rules.d/60-Arduino-UNO-Q.rules ``` -------------------------------- ### Install RustDesk Source: https://docs.arduino.cc/tutorials/uno-q/remote-access Download and install the RustDesk package for aarch64 architectures. ```bash wget sudo dpkg -i rustdesk-*-aarch64.deb sudo apt -f install ``` -------------------------------- ### Install Tailscale on UNO Q Source: https://docs.arduino.cc/tutorials/uno-q/remote-access Install Tailscale by running this command in the UNO Q terminal. This enables secure VPN connectivity. ```bash curl -fsSL https://tailscale.com/install.sh | sh ``` -------------------------------- ### Install ADB on Windows Source: https://docs.arduino.cc/tutorials/uno-q/adb Use the Windows Package Manager (winget) to install Google Platform Tools. ```bash winget install Google.PlatformTools ``` -------------------------------- ### Install and Launch Cheese Camera App Source: https://docs.arduino.cc/tutorials/uno-q/debian-guide Installs and runs the Cheese application for testing USB cameras. ```bash sudo apt install cheese ``` ```bash cheese ``` -------------------------------- ### Verify Udev Rules Installation Source: https://docs.arduino.cc/tutorials/uno-q/update-image Command to display the contents of the created udev rules file. ```bash 1cat /etc/udev/rules.d/60-Arduino-UNO-Q.rules ``` -------------------------------- ### Install Cheese App on Arduino UNO Q Source: https://docs.arduino.cc/tutorials/uno-q/single-board-computer Run this command in the terminal to install the Cheese application, which provides a graphical interface for taking snapshots and recording video with a USB camera. ```bash sudo apt install cheese ``` -------------------------------- ### Install software packages with apt Source: https://docs.arduino.cc/tutorials/uno-q/debian-guide Use these commands to install single or multiple software packages via the apt package manager. ```bash sudo apt install package-name ``` ```bash sudo apt install python3-pip git curl ``` ```bash sudo apt install vim ``` -------------------------------- ### Install MessagePack Library Source: https://docs.arduino.cc/tutorials/uno-q/routerbridge-multilanguage Install the MessagePack library for Python. Use --break-system-packages with caution. ```bash 1pip3 install msgpack --break-system-packages ``` -------------------------------- ### Install and Verify Monit Source: https://docs.arduino.cc/tutorials/uno-q/security-hardening-guide Commands to install the Monit package and check its service status. ```bash 1sudo apt update && sudo apt install monit ``` ```bash 1sudo systemctl status monit ``` -------------------------------- ### Verify udev rules installation Source: https://docs.arduino.cc/tutorials/uno-q/update-image Checks the content of the generated udev rules file to confirm installation. ```bash cat /etc/udev/rules.d/60-arduino-zephyr.rules ``` -------------------------------- ### Install Python Dependencies Source: https://docs.arduino.cc/tutorials/uno-q/user-manual Installs the required msgpack library on a Linux system. ```bash 1sudo apt install python3-msgpack ``` -------------------------------- ### Setup Private Encrypted Directory Source: https://docs.arduino.cc/tutorials/uno-q/security-hardening-guide Initialize the encrypted private directory for the current user. ```bash ecryptfs-setup-private ``` -------------------------------- ### Install MessagePack C++ Library Source: https://docs.arduino.cc/tutorials/uno-q/routerbridge-multilanguage Command to install the MessagePack C++ development library on the UNO Q. This library is header-only and does not require separate linking. ```bash sudo apt install libmsgpack-cxx-dev ``` -------------------------------- ### Compile and Run Sensor Example Source: https://docs.arduino.cc/tutorials/uno-q/routerbridge-multilanguage Compile the C++ code using g++ and then run the executable. ```bash g++ -std=c++17 sensor_example.cpp -pthread -o sensor_example ``` ```bash ./sensor_example ``` -------------------------------- ### Verify Mkcert Installation Source: https://docs.arduino.cc/tutorials/uno-q/security-hardening-guide Check if mkcert has been installed correctly by verifying its version. ```bash mkcert -version ``` -------------------------------- ### Install OpenCV Python Library Source: https://docs.arduino.cc/tutorials/uno-q/debian-guide Installs the OpenCV library for camera control and image processing. ```bash sudo apt install python3-opencv ``` -------------------------------- ### Verify udev Rules Installation Source: https://docs.arduino.cc/tutorials/uno-q/user-manual Check the content of the generated udev rules file to confirm successful installation. This command displays the rules applied to Arduino UNO Q. ```bash 1cat /etc/udev/rules.d/60-arduino-zephyr.rules ``` -------------------------------- ### Install ADB on Linux Source: https://docs.arduino.cc/tutorials/uno-q/adb Use the apt package manager to install platform tools on Debian or Ubuntu distributions. ```bash sudo apt-get install android-sdk-platform-tools ``` -------------------------------- ### Install udev rules via repository clone Source: https://docs.arduino.cc/tutorials/uno-q/update-image Clones the repository and runs the post-install script from the local source. ```bash cd ~/Downloads ``` ```bash git clone https://github.com/arduino/ArduinoCore-zephyr.git ``` ```bash cd ArduinoCore-zephyr ``` ```bash chmod +x post_install.sh ``` ```bash sudo ./post_install.sh ``` -------------------------------- ### Install udev rules via wget Source: https://docs.arduino.cc/tutorials/uno-q/update-image Downloads and executes the post-install script using wget to configure device permissions. ```bash cd ~/Downloads ``` ```bash wget https://raw.githubusercontent.com/arduino/ArduinoCore-zephyr/main/post_install.sh ``` ```bash chmod +x post_install.sh ``` ```bash sudo ./post_install.sh ``` -------------------------------- ### Install VLC Media Player on Arduino UNO Q Source: https://docs.arduino.cc/tutorials/uno-q/single-board-computer Use this command in the terminal to install the VLC media player on your Arduino UNO Q. ```bash sudo apt install vlc ``` -------------------------------- ### Install Xrdp and Dependencies on UNO Q Source: https://docs.arduino.cc/tutorials/uno-q/remote-access Install xrdp and its dependencies on the UNO Q via SSH or ADB shell. This enables RDP server functionality for remote desktop access. ```bash sudo apt update sudo apt install xrdp dbus-x11 sudo systemctl enable xrdp sudo systemctl start xrdp ``` -------------------------------- ### Install ADB on MacOS Source: https://docs.arduino.cc/tutorials/uno-q/adb Use Homebrew to install the Android platform tools on macOS. ```bash brew install android-platform-tools ``` -------------------------------- ### Check and Install Rsyslog Source: https://docs.arduino.cc/tutorials/uno-q/security-hardening-guide Commands to verify the installation status of rsyslog and install it if missing. ```bash 1dpkg -l | grep rsyslog ``` ```bash 1sudo apt update && sudo apt install rsyslog ``` -------------------------------- ### Install Encryption Utilities Source: https://docs.arduino.cc/tutorials/uno-q/security-hardening-guide Update package lists and install the ecryptfs-utils package for directory encryption. ```bash sudo apt update ``` ```bash sudo apt install ecryptfs-utils ``` -------------------------------- ### Install and Apply Udev Rules Source: https://docs.arduino.cc/tutorials/uno-q/user-manual This command sequence writes the rules to the system directory and triggers a reload to apply changes immediately. ```bash 1echo \ 2'# Operating mode 3SUBSYSTEMS=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0078", MODE="0660", TAG+="uaccess" 4# EDL mode 5SUBSYSTEMS=="usb", ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="9008", MODE="0660", TAG+="uaccess"' \ 6| \ 7 sudo \ 8 tee \ 9 "/etc/udev/rules.d/60-Arduino-UNO-Q.rules" \ 10&& \ 11sudo \ 12 udevadm control \ 13 --reload-rules \ 14&& \ 15sudo \ 16 udevadm trigger ``` -------------------------------- ### Verify ADB Installation Source: https://docs.arduino.cc/tutorials/uno-q/adb Check that the ADB tool is correctly installed and accessible in your terminal. ```bash adb version ``` -------------------------------- ### Perform Full System Upgrade Source: https://docs.arduino.cc/tutorials/uno-q/debian-guide Upgrades installed packages, handling dependency changes and potentially installing new packages. More comprehensive than 'apt upgrade'. ```bash sudo apt full-upgrade ``` -------------------------------- ### Verify MessagePack Installation Source: https://docs.arduino.cc/tutorials/uno-q/routerbridge-multilanguage Verify the MessagePack library installation by checking its version. ```bash 1python3 -c "import msgpack; print(msgpack.version)" ``` -------------------------------- ### Install udev rules via curl Source: https://docs.arduino.cc/tutorials/uno-q/update-image Downloads and executes the post-install script using curl when wget is unavailable. ```bash cd ~/Downloads ``` ```bash curl -O https://raw.githubusercontent.com/arduino/ArduinoCore-zephyr/main/post_install.sh ``` ```bash chmod +x post_install.sh ``` ```bash sudo ./post_install.sh ``` -------------------------------- ### Install Remmina on Linux Source: https://docs.arduino.cc/tutorials/uno-q/remote-access Install the Remmina RDP client on Linux systems. This client is used to connect to the UNO Q's xrdp server. ```bash sudo apt install remmina ``` -------------------------------- ### Install Udev Rules on Linux Source: https://docs.arduino.cc/tutorials/uno-q/update-image Command to create the udev rules file and reload system rules to apply permissions. ```bash 1echo \ 2'# Operating mode 3SUBSYSTEMS=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0078", MODE="0660", TAG+="uaccess" 4# EDL mode 5SUBSYSTEMS=="usb", ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="9008", MODE="0660", TAG+="uaccess"' \ 6| \ 7 sudo \ 8 tee \ 9 "/etc/udev/rules.d/60-Arduino-UNO-Q.rules" \ 10&& \ 11sudo \ 12 udevadm control \ 13 --reload-rules \ 14&& \ 15sudo \ 16 udevadm trigger ``` -------------------------------- ### Create HTTPS Certificate and Key Source: https://docs.arduino.cc/tutorials/uno-q/security-hardening-guide Generate a new certificate and private key for your application using mkcert. This example creates certificates for multiple domains and localhost. ```bash mkcert example.com "*.example.com" example.test localhost 127.0.0.1 ::1 ``` -------------------------------- ### Initialize I2C Communication Source: https://docs.arduino.cc/tutorials/uno-q/user-manual Initialize the I2C bus in the setup function using either the standard headers or the Qwiic connector. ```cpp 1// Initialize the I2C communication 2Wire.begin(); // I2C in UNO-style headers (D20, D21) 3// or 4Wire1.begin(); // I2C in Qwiic connector ``` -------------------------------- ### Install Mkcert Root CA Source: https://docs.arduino.cc/tutorials/uno-q/security-hardening-guide Install the mkcert-generated Certificate Authority into your system's trust store. This is optional but recommended for trusting self-signed certificates. ```bash mkcert -install ``` -------------------------------- ### Display Manual Page for a Command Source: https://docs.arduino.cc/tutorials/uno-q/debian-guide Opens the detailed manual page for any command, providing explanations of options, usage examples, and related commands. Use 'man '. ```bash man ``` -------------------------------- ### Install SSH Client on Linux (Ubuntu) Source: https://docs.arduino.cc/tutorials/uno-q/ssh If SSH is not found on an outdated or custom Linux system, use this command to install OpenSSH client and server. This requires sudo privileges. ```bash sudo apt install openssh-client openssh-server libressl-dev ``` -------------------------------- ### Initialize SPI Configuration Source: https://docs.arduino.cc/tutorials/uno-q/user-manual Configures the chip select pin and initializes the SPI bus in the setup function. ```cpp 1#define SS D10 2 3void setup() { 4 // Set the chip select pin as output 5 pinMode(SS, OUTPUT); 6 7 // Pull the SS pin HIGH to unselect the device 8 digitalWrite(SS, HIGH); 9 10 // Initialize the SPI communication 11 SPI.begin(); 12} ``` -------------------------------- ### Start and Stop Arduino Apps Source: https://docs.arduino.cc/tutorials/uno-q/debian-guide Commands to control the execution of Arduino App Lab applications. ```bash arduino-app-cli app start user:my-app ``` ```bash arduino-app-cli app start examples:blink ``` ```bash arduino-app-cli app stop user:my-app ``` ```bash arduino-app-cli app stop examples:blink ``` -------------------------------- ### Transmit Data via SPI Source: https://docs.arduino.cc/tutorials/uno-q/user-manual Full example for selecting an SPI device and transferring bytes. Ensure the SS pin is correctly defined for your hardware setup. ```cpp 1#include 2 3#define SS D10 4 5void setup() { 6 // Set the chip select pin as output 7 pinMode(SS, OUTPUT); 8 9 // Pull the SS pin HIGH to unselect the device 10 digitalWrite(SS, HIGH); 11 12 // Initialize the SPI communication 13 SPI.begin(); 14} 15 16void loop() { 17 // Replace with the target device’s address 18 byte address = 0x35; 19 // Replace with the value to send 20 byte value = 0xFA; 21 // Pull the SS pin LOW to select the device 22 digitalWrite(SS, LOW); 23 // Send the address 24 SPI.transfer(address); 25 // Send the value 26 SPI.transfer(value); 27 // Pull the SS pin HIGH to unselect the device 28 digitalWrite(SS, HIGH); 29 30 delay(2000); 31} ``` -------------------------------- ### Draw Arduino Logo on LED Matrix Source: https://docs.arduino.cc/tutorials/uno-q/user-manual This example draws a custom frame, the Arduino logo, on the 8x13 LED matrix. Ensure the Arduino_LED_Matrix library is installed. ```c++ #include uint8_t logo[104] = { 0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,1,1,1,0,0,0,1,1,1,0,0, 0,1,0,0,0,1,0,1,0,0,0,1,0, 1,0,0,0,0,0,1,0,0,1,0,0,1, 1,0,1,1,1,0,1,0,1,1,1,0,1, 1,0,0,0,0,0,1,0,0,1,0,0,1, 0,1,0,0,0,1,0,1,0,0,0,1,0, 0,0,1,1,1,0,0,0,1,1,1,0,0 }; Arduino_LED_Matrix matrix; void setup() { matrix.begin(); // display the image matrix.setGrayscaleBits(1); matrix.draw(logo); } void loop() { } ``` -------------------------------- ### Enter Certificate Directory Source: https://docs.arduino.cc/tutorials/uno-q/security-hardening-guide Navigate into the newly created 'certs' directory. ```bash cd certs ``` -------------------------------- ### Set Linux Login Credentials Source: https://docs.arduino.cc/tutorials/uno-q/single-board-computer Configure your Linux login credentials during the initial setup of the UNO Q. You can reuse the password set during the initial login or define a new one. ```bash arduino ``` ```bash new-password ``` -------------------------------- ### Get UTC Time using TCP Socket Source: https://docs.arduino.cc/tutorials/uno-q/user-manual This Arduino sketch connects to time.nist.gov via TCP to retrieve and print the current UTC time to the Serial Monitor. Ensure the Arduino_RouterBridge library is installed. ```cpp #include BridgeTCPClient<> client(Bridge); void setup() { if (!Bridge.begin()) { while (true) {} } if (!Monitor.begin()) { while (true) {} } Monitor.println("TCP Daytime Demo started"); } void loop() { Monitor.println("\nConnecting to time.nist.gov ..."); if (client.connect("time.nist.gov", 13) < 0) { Monitor.println("Connection failed!"); delay(5000); return; } Monitor.println("Connected, reading response..."); String line; while (client.connected() || client.available()) { if (client.available()) { char c = client.read(); if (c == '\n') break; // daytime sends one line if (c != '\r') line += c; } } Monitor.print("Server says: "); Monitor.println(line); client.stop(); delay(10000); } ``` -------------------------------- ### Setup MCU Bridge and Register RPC Service Source: https://docs.arduino.cc/tutorials/uno-q/user-manual Arduino sketch for the STM32 that initializes the Bridge and registers a local function to be callable via RPC. ```cpp 1#include "Arduino_RouterBridge.h" 2 3void setup() { 4 pinMode(LED_BUILTIN, OUTPUT); 5 6 Bridge.begin(); 7 Bridge.provide("set_led_state", set_led_state); 8} 9 10void loop() { 11} 12 13void set_led_state(bool state) { 14 // LOW state means LED is ON 15 digitalWrite(LED_BUILTIN, state ? LOW : HIGH); 16} ``` -------------------------------- ### Create Monit Disk Check Configuration Source: https://docs.arduino.cc/tutorials/uno-q/security-hardening-guide Create a new configuration file in /etc/monit/conf.d/ to define monitoring rules. This example checks the root filesystem for disk and inode usage. ```bash sudo nano /etc/monit/conf.d/disk-check ``` -------------------------------- ### Upgrade Installed Packages Source: https://docs.arduino.cc/tutorials/uno-q/debian-guide Installs the newest versions of all currently installed packages. This command is conservative with dependencies. ```bash sudo apt upgrade ``` -------------------------------- ### Execute local post-install script Source: https://docs.arduino.cc/tutorials/uno-q/update-image Runs the post-install script directly from the package directory. ```bash sudo ~/.arduino15/packages/arduino/hardware/zephyr//post_install.sh ``` -------------------------------- ### Updated Arduino Router Service File with Verbose Logging Source: https://docs.arduino.cc/tutorials/uno-q/user-manual This is an example of an updated service file configuration for the arduino-router, including the '--verbose' flag for detailed logging. Ensure the ExecStart line is correctly modified. ```ini [Unit] Description=Arduino Router Service After=network-online.target Wants=network-online.target Requires= [Service] # Put the micro in a ready state. ExecStartPre=-/usr/bin/gpioset -c /dev/gpiochip1 -t0 37=0 ExecStart=/usr/bin/arduino-router --unix-port /var/run/arduino-router.sock --serial-port /dev/ttyHS1 --serial-baudrate 115200 --verbose # <--- ADD THIS # End the boot animation after the router is started. ExecStartPost=/usr/bin/gpioset -c /dev/gpiochip1 -t0 70=1 StandardOutput=journal StandardError=journal Restart=always RestartSec=3 [Install] WantedBy=multi-user.target ``` -------------------------------- ### Install Arduino UNO Q Zephyr Core Source: https://docs.arduino.cc/tutorials/uno-q/user-manual Add the Arduino UNO Q Zephyr Core package to your Arduino IDE. This is required to use the UNO Q board. ```text https://downloads.arduino.cc/packages/package_zephyr_index.json ``` -------------------------------- ### Combined Update and Upgrade Source: https://docs.arduino.cc/tutorials/uno-q/debian-guide A common practice to first update package lists and then upgrade installed packages in a single command sequence. ```bash sudo apt update && sudo apt upgrade ``` -------------------------------- ### Configure Dummy Display Source: https://docs.arduino.cc/tutorials/uno-q/remote-access Create the X11 configuration file for the dummy display driver. ```bash sudo tee /etc/X11/xorg.conf.d/10-dummy.conf << 'EOF' Section "Device" Identifier "DummyDevice" Driver "dummy" VideoRam 256000 Option "IgnoreEDID" "true" EndSection Section "Monitor" Identifier "DummyMonitor" HorizSync 28.0-80.0 VertRefresh 48.0-75.0 Modeline "1920x1080" 148.50 1920 2008 2052 2200 1080 1084 1089 1125 EndSection Section "Screen" Identifier "DummyScreen" Device "DummyDevice" Monitor "DummyMonitor" DefaultDepth 24 SubSection "Display" Depth 24 Modes "1920x1080" EndSubSection EndSection EOF ``` -------------------------------- ### Run post-install Script from Cloned Repository Source: https://docs.arduino.cc/tutorials/uno-q/user-manual Clone the ArduinoCore-zephyr repository and run the post_install.sh script from the cloned directory to set up udev rules. This method is useful if you need to access other repository files. ```bash 1cd ~/Downloads ``` ```bash 1git clone https://github.com/arduino/ArduinoCore-zephyr.git ``` ```bash 1cd ArduinoCore-zephyr ``` ```bash 1chmod +x post_install.sh ``` ```bash 1sudo ./post_install.sh ``` -------------------------------- ### Navigate to WebUI Application Directory Source: https://docs.arduino.cc/tutorials/uno-q/security-hardening-guide Commands to access the application directory and prepare the certificates folder. ```bash cd ~/ArduinoApps/APPLICATION_NAME ``` ```bash mkdir certs ``` ```bash cd certs ``` -------------------------------- ### List Connected ADB Devices Source: https://docs.arduino.cc/tutorials/uno-q/adb Verify that the UNO Q board is recognized by the host computer. ```bash adb devices ``` -------------------------------- ### Verify SSH Client Installation on macOS Source: https://docs.arduino.cc/tutorials/uno-q/ssh Check if the built-in SSH client is installed and working on macOS. This command should be run in a terminal. ```bash ssh -V ``` -------------------------------- ### Navigate to Home Directory Source: https://docs.arduino.cc/tutorials/uno-q/debian-guide Use `cd ~` to quickly return to your home directory from any location in the file system. ```bash cd ~ ``` -------------------------------- ### Enable RustDesk Service Source: https://docs.arduino.cc/tutorials/uno-q/remote-access Enable the RustDesk service and reboot the system. ```bash sudo systemctl enable rustdesk sudo reboot ``` -------------------------------- ### Check Arduino CLI Version Source: https://docs.arduino.cc/tutorials/uno-q/debian-guide Verify the installed version of the Arduino CLI and check its availability. This command is useful for ensuring you have the correct tools for core management and library installation. ```bash 1arduino-cli version ``` -------------------------------- ### Run post_install.sh with Specific Version Path Source: https://docs.arduino.cc/tutorials/uno-q/user-manual Execute the post_install.sh script located within a specific version directory of the Arduino hardware packages. This is an alternative way to run the script if the default path is not accessible. ```bash 1sudo ~/.arduino15/packages/arduino/hardware/zephyr//post_install.sh ``` -------------------------------- ### Manage Rsyslog Service Source: https://docs.arduino.cc/tutorials/uno-q/security-hardening-guide Commands to check, enable, and start the rsyslog service. ```bash 1sudo systemctl status rsyslog ``` ```bash 1sudo systemctl enable rsyslog ``` ```bash 1sudo systemctl start rsyslog ``` -------------------------------- ### Debug Traffic with socat Source: https://docs.arduino.cc/tutorials/uno-q/routerbridge-multilanguage Commands to install and use socat to monitor socket traffic. ```bash 1sudo apt install socat ``` ```bash 1socat -v UNIX-LISTEN:/tmp/debug.sock,fork UNIX-CONNECT:/var/run/arduino-router.sock ``` -------------------------------- ### Create a New Directory Source: https://docs.arduino.cc/tutorials/uno-q/debian-guide Use `mkdir directory_name` to create a new, empty directory in your current location. ```bash mkdir my_project ``` -------------------------------- ### Manage arduino-router Service Source: https://docs.arduino.cc/tutorials/uno-q/routerbridge-multilanguage Commands for checking status, starting, and restarting the arduino-router service. ```bash 1systemctl status arduino-router ``` ```bash 1sudo systemctl start arduino-router ``` ```bash 1sudo systemctl restart arduino-router ``` -------------------------------- ### Compile and Run Temperature Monitor Source: https://docs.arduino.cc/tutorials/uno-q/routerbridge-multilanguage Compile the C++ temperature monitor code and then run the executable. ```bash g++ -std=c++17 temp_monitor.cpp -pthread -o temp_monitor ``` ```bash ./temp_monitor ``` -------------------------------- ### Create Display Toggle Script Source: https://docs.arduino.cc/tutorials/uno-q/remote-access Creates a bash script to switch between dummy display and physical HDMI output by renaming the X11 configuration file and restarting the display manager. ```bash sudo tee /usr/local/bin/toggle-display << 'EOF' #!/bin/bash CONF="/etc/X11/xorg.conf.d/10-dummy.conf" BAK="${CONF}.bak" if [ -f "$CONF" ]; then mv "$CONF" "$BAK" echo "Switched to HDMI (physical display)" else mv "$BAK" "$CONF" echo "Switched to dummy (headless/RustDesk)" fi systemctl restart lightdm EOF sudo chmod +x /usr/local/bin/toggle-display ``` -------------------------------- ### Execute Arduino Flasher CLI on Linux Source: https://docs.arduino.cc/tutorials/uno-q/update-image Run the CLI tool from the unzipped directory. ```bash 1./arduino-flasher-cli ``` -------------------------------- ### Start ADB Daemon Source: https://docs.arduino.cc/tutorials/uno-q/security-hardening-guide Use this command to restart the Android Debug Bridge daemon service. ```bash sudo systemctl start adbd ``` -------------------------------- ### Navigate to download directory Source: https://docs.arduino.cc/tutorials/uno-q/update-image Change directory to the location where the CLI tool was unzipped. ```bash cd /Downloads ``` -------------------------------- ### File System Structure Source: https://docs.arduino.cc/tutorials/uno-q/debian-guide This diagram illustrates the basic file system hierarchy of the UNO Q. Most user work will be done within the /home/arduino/ directory. ```text / ├── home/ │ └── arduino/          # Your working directory │       └── ArduinoApps/  # Your Arduino App Lab projects ├── tmp/                  # Temporary files (cleared on reboot) └── mnt/                  # Mount points for USB drives ``` -------------------------------- ### SSH Connection Error Source: https://docs.arduino.cc/tutorials/uno-q/ssh Example of the error message encountered when mDNS fails to resolve the board hostname. ```bash ssh: connect to host .local port 22: Connection refused ``` -------------------------------- ### Navigate and List Arduino Apps Source: https://docs.arduino.cc/tutorials/uno-q/debian-guide Commands to navigate to the apps directory and list available projects. ```bash cd ~/ArduinoApps/ ``` ```bash ls ``` ```bash arduino-app-cli app list ``` -------------------------------- ### UART Transmit Test Example Source: https://docs.arduino.cc/tutorials/uno-q/user-manual A complete sketch to test UART transmission by sending a message every second. ```cpp 1void setup() { 2 // Initialize the hardware UART at 115200 bps 3 Serial.begin(115200); 4} 5 6void loop() { 7 // Transmit the string "Hello UNO Q" followed by a newline character 8 Serial.println("Hello UNO Q"); 9 delay(1000); 10} ``` -------------------------------- ### Transmit Data via I2C Source: https://docs.arduino.cc/tutorials/uno-q/user-manual Example sketch for transmitting data to an I2C device using the Wire library. ```cpp 1#include 2 3void setup() { 4 // Initialize the I2C communication 5 Wire.begin(); 6} 7 8void loop() { 9 // Replace with the target device’s I2C address 10 byte deviceAddress = 0x35; 11 // Replace with the appropriate instruction byte 12 byte instruction = 0x00; 13 // Replace with the value to send 14 byte value = 0xFA; 15 // Begin transmission to the target device 16 Wire.beginTransmission(deviceAddress); 17 // Send the instruction byte 18 Wire.write(instruction); 19 // Send the value 20 Wire.write(value); 21 // End transmission 22 Wire.endTransmission(); 23 24 delay(2000); 25} ``` -------------------------------- ### Make Mkcert Executable Source: https://docs.arduino.cc/tutorials/uno-q/security-hardening-guide Grant execute permissions to the downloaded mkcert binary. ```bash chmod +x mkcert-v1.4.4-linux-arm64 ``` -------------------------------- ### Update Package Lists Source: https://docs.arduino.cc/tutorials/uno-q/routerbridge-multilanguage Command to update the package lists on the UNO Q system. This is a prerequisite for installing new packages. ```bash sudo apt update ``` -------------------------------- ### Display Help Summary for a Command Source: https://docs.arduino.cc/tutorials/uno-q/debian-guide Displays a summary of options for a command directly in the terminal. Use the '--help' flag with the command. ```bash ls --help ``` -------------------------------- ### Control MPU LEDs via Command Line Source: https://docs.arduino.cc/tutorials/uno-q/user-manual Directly manipulate LED brightness by writing to the sysfs interface. ```bash 1echo 1 | tee /sys/class/leds/red:user/brightness # set HIGH/ON 2echo 0 | tee /sys/class/leds/red:user/brightness # set LOW/OFF ``` -------------------------------- ### Connect via SSH using Hostname Source: https://docs.arduino.cc/tutorials/uno-q/debian-guide Use this command to establish an SSH connection to your board over the local network. Replace with your board's actual name. You will be prompted to verify the connection and enter your board's password. ```bash ssh arduino@.local ``` ```bash ssh arduino@unoqtestbench.local ``` -------------------------------- ### Set Default App via CLI Source: https://docs.arduino.cc/tutorials/uno-q/user-manual Configure a specific application to launch automatically on startup using the Arduino CLI. Replace with the actual name of your application. ```bash 1arduino-app-cli properties set default user: ``` -------------------------------- ### List All Files Including Hidden Source: https://docs.arduino.cc/tutorials/uno-q/debian-guide Use `ls -a` to show all files, including hidden ones that start with a dot (.). ```bash ls -a ``` -------------------------------- ### Search for software packages Source: https://docs.arduino.cc/tutorials/uno-q/debian-guide Find available packages by keyword or list all packages related to a specific topic. ```bash apt search keyword ``` ```bash apt search python3 ``` -------------------------------- ### Connect to Wi-Fi via Terminal Source: https://docs.arduino.cc/tutorials/uno-q/single-board-computer Manually connect your UNO Q to a Wi-Fi network using the nmcli command in the terminal. Replace and with your network's credentials. ```bash sudo nmcli d wifi connect password ``` -------------------------------- ### Initialize Bridge and Serial Transport Source: https://docs.arduino.cc/tutorials/uno-q/user-manual Initializes the bridge and the internal serial transport. This is a required setup step before using other Bridge functionalities. ```c++ Bridge.begin() ``` -------------------------------- ### Configure Digital Pin Mode Source: https://docs.arduino.cc/tutorials/uno-q/user-manual Use pinMode() in setup() to configure a digital pin as an input, output, or input with an internal pull-up resistor. ```arduino pinMode(pin, INPUT); // Pin configured as an input pinMode(pin, OUTPUT); // Pin configured as an output pinMode(pin, INPUT_PULLUP); // Pin configured as an input, internal pull-up resistor enabled ``` -------------------------------- ### Create variable duty-cycle PWM signal Source: https://docs.arduino.cc/tutorials/uno-q/user-manual Example sketch demonstrating how to map analog input from a potentiometer to a PWM output with 10-bit resolution. ```cpp const int analogInPin = A0; // Analog input pin that the potentiometer is attached to const int pwmOutPin = D3; // PWM output pin int sensorValue = 0; // value read from the pot int outputValue = 0; // value output to the PWM (analog out) void setup() { // Define the PWM output resolution analogWriteResolution(10); // 0 - 1023 -> 0 - 100% duty-cycle analogReadResolution(14); // 0 - 16383 } void loop() { // read the analog in value: sensorValue = analogRead(analogInPin); // map it to the range of the analog out: outputValue = map(sensorValue, 0, 16383, 0, 1024); // change the analog out value: analogWrite(pwmOutPin, outputValue); // wait 2 milliseconds before the next loop for the ADC // to settle after the last reading: delay(2); } ``` -------------------------------- ### Create Certificate Directory Source: https://docs.arduino.cc/tutorials/uno-q/security-hardening-guide Create a 'certs' directory within your application's directory to store SSL/TLS certificates and keys. ```bash mkdir certs ``` -------------------------------- ### Implement Python RPC Client Source: https://docs.arduino.cc/tutorials/uno-q/user-manual Connects to the Unix socket and sends a MessagePack-encoded RPC request. Requires the msgpack library installed on the host system. ```python 1import socket 2import msgpack 3import sys 4 5# 1. Define the connection to the Router's Unix Socket 6SOCKET_PATH = "/var/run/arduino-router.sock" 7 8# 2. Parse command line arguments 9# Default to turning LED ON (True) if no argument is provided 10led_state = True 11 12if len(sys.argv) > 1: 13 arg = sys.argv[1] 14 if arg == "1": 15 led_state = True 16 elif arg == "0": 17 led_state = False 18 else: 19 print("Usage: python3 msgpack_test.py [1|0]") 20 sys.exit(1) 21 22print(f"Sending request to set LED: {led_state}") 23 24# 3. Create the MessagePack RPC Request 25# Format: [type=0 (Request), msgid=1, method="set_led_state", params=[led_state]] 26request = [0, 1, "set_led_state", [led_state]] 27packed_req = msgpack.packb(request) 28 29# 4. Send the request 30try: 31 with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as client: 32 client.connect(SOCKET_PATH) 33 client.sendall(packed_req) 34 35 # 5. Receive the response 36 response_data = client.recv(1024) 37 response = msgpack.unpackb(response_data) 38 39 # Response Format: [type=1 (Response), msgid=1, error=None, result=None] 40 print(f"Router Response: {response}") 41 42except Exception as e: 43 print(f"Connection failed: {e}") ``` -------------------------------- ### Download Mkcert Binary for Linux ARM64 Source: https://docs.arduino.cc/tutorials/uno-q/security-hardening-guide Download the mkcert binary for Linux ARM64 architecture. Ensure you are in a temporary directory before downloading. ```bash cd /tmp wget https://github.com/FiloSottile/mkcert/releases/download/v1.4.4/mkcert-v1.4.4-linux-arm64 ``` -------------------------------- ### Connect UNO Q to Tailscale Network Source: https://docs.arduino.cc/tutorials/uno-q/remote-access Authenticate and connect the UNO Q board to your Tailscale network. You will be prompted to follow a link to authenticate with your Tailscale account. ```bash sudo tailscale up ``` -------------------------------- ### Display Grayscale Shades on LED Matrix Source: https://docs.arduino.cc/tutorials/uno-q/user-manual Demonstrates the supported grayscale levels on the LED matrix by displaying different shades. Ensure the Arduino_LED_Matrix library is installed. ```c++ #include uint8_t shades[104] = { 0,0,0,0,0,0,0,0,0,0,0,0,0, 1,1,1,1,1,1,1,1,1,1,1,1,1, 2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3, 4,4,4,4,4,4,4,4,4,4,4,4,4, 5,5,5,5,5,5,5,5,5,5,5,5,5, 6,6,6,6,6,6,6,6,6,6,6,6,6, 7,7,7,7,7,7,7,7,7,7,7,7,7 }; Arduino_LED_Matrix matrix; void setup() { matrix.begin(); // display the image matrix.setGrayscaleBits(3); matrix.draw(shades); } void loop() { } ``` -------------------------------- ### List Directory Contents Source: https://docs.arduino.cc/tutorials/uno-q/debian-guide Run `ls` to display a basic list of files and directories in the current location. ```bash ls ``` -------------------------------- ### Get UNO Q Local IP Address Source: https://docs.arduino.cc/tutorials/uno-q/remote-access Find the local IP address of the UNO Q on your network. This is used for direct RDP connections over LAN. ```bash hostname -I ``` -------------------------------- ### Create blacklist configuration file Source: https://docs.arduino.cc/tutorials/uno-q/update-image Open the modprobe configuration file to disable the qcserial module. ```bash 1sudo nano /etc/modprobe.d/blacklist-modem.conf ``` -------------------------------- ### View File Head and Tail Source: https://docs.arduino.cc/tutorials/uno-q/debian-guide Use 'head' to view the beginning of a file (default 10 lines) and 'tail' for the end. Customize line count with '-n'. ```bash head file.txt ``` ```bash tail file.txt ``` ```bash head -n 20 file.txt ``` -------------------------------- ### Display Manual Page for 'ls' Command Source: https://docs.arduino.cc/tutorials/uno-q/debian-guide Shows detailed information about the 'ls' command, including all its options and usage. ```bash man ls ``` -------------------------------- ### Return to Previous Directory Source: https://docs.arduino.cc/tutorials/uno-q/debian-guide Use `cd -` to switch back to the directory you were in previously. ```bash cd - ``` -------------------------------- ### Print Working Directory Source: https://docs.arduino.cc/tutorials/uno-q/debian-guide Use `pwd` to display the full path of your current directory. ```bash pwd ``` -------------------------------- ### Control LED with Button Source: https://docs.arduino.cc/tutorials/uno-q/user-manual This example demonstrates reading a button connected to D4 and controlling an LED connected to D5. It requires the Arduino_RouterBridge library. The button state is read, and the LED is turned on or off accordingly, with status messages printed to the Serial Monitor. ```arduino #include // Define button and LED pin int buttonPin = D4; int ledPin = D5; // Variable to store the button state int buttonState = 0; void setup() { // Configure button and LED pins pinMode(buttonPin, INPUT_PULLUP); pinMode(ledPin, OUTPUT); // Initialize Serial communication Monitor.begin(); } void loop() { // Read the state of the button buttonState = digitalRead(buttonPin); // If the button is pressed, turn on the LED and print its state to the Serial Monitor if (buttonState == LOW) { digitalWrite(ledPin, HIGH); Monitor.println("- Button is pressed. LED is on."); } else { // If the button is not pressed, turn off the LED and print to the Serial Monitor digitalWrite(ledPin, LOW); Monitor.println("- Button is not pressed. LED is off."); } // Wait for 1000 milliseconds delay(1000); } ``` -------------------------------- ### Temperature Monitor with Arduino Bridge Source: https://docs.arduino.cc/tutorials/uno-q/routerbridge-multilanguage Monitors temperature, logs data to a CSV file, and controls an LED based on temperature thresholds. Uses both call() to get readings and notify() to control the LED. Ensure data is written immediately using flush(). ```cpp #include "arduino_bridge.hpp" #include #include #include #include #include #include std::string get_timestamp() { auto now = std::time(nullptr); auto tm = *std::localtime(&now); std::ostringstream oss; oss << std::put_time(&tm, "%Y-%m-%d %H:%M:%S"); return oss.str(); } int main() { ArduinoBridge bridge; if (!bridge.connect()) { std::cerr << "Failed to connect" << std::endl; return 1; } std::cout << "Temperature Monitor Started" << std::endl; std::ofstream logfile("temperature_log.csv"); logfile << "Timestamp,Temperature_C" << std::endl; while (true) { auto response = bridge.call("read_temperature"); if (response.success) { float temp = response.result.get().as(); std::string timestamp = get_timestamp(); std::cout << timestamp << " - " << temp << "°C" << std::endl; logfile << timestamp << "," << temp << std::endl; logfile.flush(); if (temp > 50.0) { bridge.notify("set_led_state", true); std::cout << "WARNING: High temperature!" << std::endl; } else { bridge.notify("set_led_state", false); } } else { std::cerr << "Error: " << response.error << std::endl; } std::this_thread::sleep_for(std::chrono::seconds(5)); } return 0; } ``` ```c++ #include "Arduino_RouterBridge.h" const int TEMP_PIN = A0; void setup() { pinMode(LED_BUILTIN, OUTPUT); Bridge.begin(); Bridge.provide("read_temperature", read_temperature); Bridge.provide("set_led_state", set_led_state); Monitor.begin(); Monitor.println("Temperature sensor ready"); } void loop() {} float read_temperature() { int raw = analogRead(TEMP_PIN); float voltage = (raw / 16383.0) * 3.3; float temp_c = (voltage - 0.5) * 100.0; Monitor.print("Temperature: "); Monitor.println(temp_c); return temp_c; } void set_led_state(bool state) { digitalWrite(LED_BUILTIN, state ? LOW : HIGH); } ``` -------------------------------- ### Create Python Script File Source: https://docs.arduino.cc/tutorials/uno-q/user-manual Creates the file for the custom Python client. ```bash 1nano msgpack_test.py ``` -------------------------------- ### Verify ADB connectivity Source: https://docs.arduino.cc/tutorials/uno-q/update-image Commands to list connected devices or open a shell to the UNO Q board. ```bash adb devices ``` ```bash adb shell ``` -------------------------------- ### View App Configuration Source: https://docs.arduino.cc/tutorials/uno-q/debian-guide Display the contents of the app.yaml file, which contains the configuration settings for your Arduino application. This is useful for understanding how your app is set up. ```bash 1cat app.yaml ``` -------------------------------- ### Configure LightDM Auto-Login Source: https://docs.arduino.cc/tutorials/uno-q/remote-access Enable automatic login for the desktop session. ```bash sudo tee -a /etc/lightdm/lightdm.conf << 'EOF' [Seat:*] autologin-user=arduino EOF ``` -------------------------------- ### Manage Applications with CLI Source: https://docs.arduino.cc/tutorials/uno-q/ssh Use the arduino-app-cli tool to control applications on the board. ```bash arduino-app-cli ``` ```bash arduino-app-cli app start ```