added hardware

This commit is contained in:
cpu
2025-07-22 01:12:34 +02:00
parent e8ebb23678
commit 980549c36c
6 changed files with 269 additions and 39 deletions

View File

@@ -4,8 +4,8 @@
1. [HID Smart Buttons](#hid-smart-buttons)
2. [MQTT Remote Control](#mqtt-remote-control)
- [Mosquitto Installation Guide](#mosquitto-installation-guide)
- [Mosquitto MQTT Broker on Android 16's Native Linux VM](#mosquitto-mqtt-broker-on-android-16s-native-linux-vm)
- [Mosquitto MQTT Broker on older versions of Android then 16](#mosquitto-mqtt-broker-on-older-versions-of-android-then-16)
- [Mosquitto MQTT Broker using `Termux` app](#mosquitto-mqtt-broker-using-termux-app)
- [Mosquitto MQTT Broker with VPN on Android 16's Native Linux VM](#mosquitto-mqtt-broker-with-vpn-on-android-16s-native-linux-vm)
- [Android Shortcut Setup](#android-shortcut-setup)
- [Configure `Quick Tap` gesture to trigger the shortcut](#configure-quick-tap-gesture-to-trigger-the-shortcut)
- [Testing with `mosquitto_pub` (via Termux)](#testing-with-mosquitto_pub-via-termux)
@@ -15,7 +15,7 @@
## HID Smart Buttons
For an enhanced tactile experience, Nexus Timer supports Smart Buttons based on Bluetooth-connected microcontroller (e.g., XIAO nRF52840) implementing HID (Human Interface Device) protocol emulating a keyboard.
* **Buttons:** Connect 3 physical buttons, potentially extended (e.g., via 1.5m wires) for easy player access.
* **Buttons:** Connect 3 physical buttons, potentially extended e.g., via 1.5m wires for easy player access.
* **Configuration:**
* **Player 1's Button:** Single Click: Emulates a key press (e.g., 'a'). Configure this as Player 1's "Pass Turn / My Pause" hotkey in the app.
* **Player 2's Button:** Single Click: Emulates a key press (e.g., 'b'). Configure as Player 2's "Pass Turn / My Pause" hotkey.
@@ -23,15 +23,50 @@ For an enhanced tactile experience, Nexus Timer supports Smart Buttons based on
* **If Player 3 is Game Admin:**
* **Player 3's Button:** Long Press: Emulates a key press (e.g., 's'). Configure as the "Global Stop/Pause All" hotkey in the app.
* **Player 3's Button:** Double Click: Emulates a key press (e.g., 'x'). Configure as the "Global Run All Timers" hotkey in the app.
The code for the XIAO nRF52840 module with a 3D printing files can be found in the [arduino](/arduino) subdirectory.
## MQTT Remote Control
Players can use their smartphones to send commands to Nexus Timer via MQTT. This requires an MQTT broker (like Mosquitto) on the same network.
Alternatively to a dedicated smart buttons, players can use their smartphones to send commands to Nexus Timer via MQTT. This requires an MQTT broker (like Mosquitto) on the same network.
### Mosquitto Installation Guide
#### Mosquitto MQTT Broker on Android 16's Native Linux VM
#### Mosquitto MQTT Broker using `Termux` app
This guide details how to install and configure the Mosquitto MQTT broker within the native `Linux Virtual Machine environment` introduced in Android 16. For older versions proceed to [Mosquitto MQTT Broker on older versions of Android then 16](#mosquitto-mqtt-broker-on-older-versions-of-android-then-16).
1. **Install Termux** from the [Play Store](https://play.google.com/store/apps/details?id=com.termux) and run.
2. **Update packages and install Mosquitto in Termux:**
```bash
pkg update && pkg upgrade
pkg install mosquitto
```
3. **Configure the MQTT Broker:**
```bash
nano $PREFIX/etc/mosquitto/mosquitto.conf
```
Add the following configuration, then save and exit:
```ini
# MQTT listener on port 1883
# MQTT connection from the HTTP Shortcut app
listener 1883 0.0.0.0
protocol mqtt
# WebSocket listener on port 9001
# MQTT over WebSocket connection from the PWA (Web App)
listener 9001 0.0.0.0
protocol websockets
# Allow clients to connect without username/password
allow_anonymous true
```
4. **Run Mosquitto with the configuration:**
```bash
mosquitto -c $PREFIX/etc/mosquitto/mosquitto.conf
```
---
#### Mosquitto MQTT Broker with VPN on Android 16's Native Linux VM
This guide details how to install and configure the Mosquitto MQTT broker within the native `Linux Virtual Machine environment` introduced in Android 16. Note that ports exposed by the Mosquitto cannot be reached from LAN. The workarround is using a VPN (wireguard).
1. **Enable the Linux Development Environment**
@@ -113,39 +148,6 @@ Your Mosquitto MQTT broker is now successfully configured and running on your An
---
#### Mosquitto MQTT Broker on older versions of Android then 16
1. **Install Termux** from the [Play Store](https://play.google.com/store/apps/details?id=com.termux) and run.
2. **Update packages and install Mosquitto in Termux:**
```bash
pkg update && pkg upgrade
pkg install mosquitto
```
3. **Configure the MQTT Broker:**
```bash
nano $PREFIX/etc/mosquitto/mosquitto.conf
```
Add the following configuration, then save and exit:
```ini
# MQTT listener on port 1883
# MQTT connection from the HTTP Shortcut app
listener 1883 0.0.0.0
protocol mqtt
# WebSocket listener on port 9001
# MQTT over WebSocket connection from the PWA (Web App)
listener 9001 0.0.0.0
protocol websockets
# Allow clients to connect without username/password
allow_anonymous true
```
4. **Run Mosquitto with the configuration:**
```bash
mosquitto -c $PREFIX/etc/mosquitto/mosquitto.conf
```
---
### Android Shortcut Setup
* Install the `HTTP Shortcuts` app from the [Play Store](https://play.google.com/store/apps/details?id=ch.rmy.android.http_shortcuts).
* Create a new shortcut.