Skip to content
PSUT / IoTEngineering learning studio
WORKSPACE
Offline-first portalDr. Mohammad Alja’afreh
Distributed Ledger StudioBlockchain for IoTExperimentsWorkspaces
ENGINEERING WORKSPACE
Home/Engineering Workspaces/Troubleshooting
PSUT IoT Engineering StudioPrincess Sumaya University for Technology · Dr. Mohammad Alja’afreh
Support / checkpoints
Supporting engineering workspace

Diagnose before changing settings

Find the failed layer, run the check, then retry only the affected step.

python: command not found

Activate the venv in WSL; use python3 for base Python.

WSL · Bash
source ~/psut-wsl/activate.sh
which python
✓ Expected: The interpreter path ends in /psut-wsl/.venv/bin/python when the toolkit is active.
Expected result for each action (2)
  1. source ~/psut-wsl/activate.shThe toolkit virtual environment is selected in this terminal, usually with (.venv) in the prompt. Verify which python points into ~/psut-wsl/.venv.
  2. which pythonThe interpreter path ends in /psut-wsl/.venv/bin/python when the toolkit is active.

ModuleNotFoundError

Use the toolkit venv, not Windows Python. Reinstall requirements if needed.

WSL · Bash
source ~/psut-wsl/activate.sh
python -m pip install -r ~/psut-wsl/requirements.txt
✓ Expected: Installation completes or reports requirements already satisfied; verify imports in the selected interpreter.
Expected result for each action (2)
  1. source ~/psut-wsl/activate.shThe toolkit virtual environment is selected in this terminal, usually with (.venv) in the prompt. Verify which python points into ~/psut-wsl/.venv.
  2. python -m pip install -r ~/psut-wsl/requirements.txtInstallation completes or reports requirements already satisfied; verify imports in the selected interpreter.

No module named labs

Practical commands must be run from the pi-practical parent folder.

WSL · Bash
cd ~/psut-wsl/labs/pi-practical
ls labs
✓ Expected: The requested files/directories are listed; compare names and permissions with the guide. An empty directory can produce no output.
Expected result for each action (2)
  1. cd ~/psut-wsl/labs/pi-practicalNormally no output. pwd should show the requested directory. A missing path produces an error; do not continue until corrected.
  2. ls labsThe requested files/directories are listed; compare names and permissions with the guide. An empty directory can produce no output.

SyntaxError from shell commands

Bash commands go in the WSL terminal; Python statements go in a .py file or Python REPL. Type exit() to leave >>>.

GPIO pin factory error

Activate fakepi; never use sudo python (loses PYTHONPATH).

WSL · Bash
source ~/psut-wsl/activate.sh
python -c "import RPi.GPIO; print(RPi.GPIO.__file__)"
✓ Expected: The printed module path should point to the toolkit fakepi implementation in WSL, not a physical GPIO driver.
Expected result for each action (2)
  1. source ~/psut-wsl/activate.shThe toolkit virtual environment is selected in this terminal, usually with (.venv) in the prompt. Verify which python points into ~/psut-wsl/.venv.
  2. python -c "import RPi.GPIO; print(RPi.GPIO.__file__)"The printed module path should point to the toolkit fakepi implementation in WSL, not a physical GPIO driver.

MQTT connection refused

Start and inspect local broker. Confirm Windows forwarding for Wokwi.

WSL · Bash
sudo systemctl start mosquitto
systemctl is-active mosquitto
ss -ltn | grep 1884
✓ Expected: A listening TCP socket for port 1884 should appear if the local MQTT broker is running.
Expected result for each action (3)
  1. sudo systemctl start mosquittoNormally no output on success. Run systemctl is-active for the named service and confirm active; inspect logs if it fails.
  2. systemctl is-active mosquittoAn active line is expected for each required running service; inactive/failed requires investigation.
  3. ss -ltn | grep 1884A listening TCP socket for port 1884 should appear if the local MQTT broker is running.

Database access denied / user exists

Run repeatable setup then source the generated environment file.

WSL · Bash
bash ~/psut-wsl/tools/setup_db.sh
source ~/.config/psut-wsl/db.env
✓ Expected: Database and limited-privilege user preparation completes. No password should appear in shared output; verify authorized queries.
Expected result for each action (2)
  1. bash ~/psut-wsl/tools/setup_db.shDatabase and limited-privilege user preparation completes. No password should appear in shared output; verify authorized queries.
  2. source ~/.config/psut-wsl/db.envDatabase environment variables load without displaying credentials. The next authorized database query must succeed.

ThingSpeak entry ID 0

Check Write API key, channel fields and update interval; wait at least 20 seconds. Never print the key.

WSL · Bash
test -n "$THINGSPEAK_WRITE_KEY" && echo "Key set"
✓ Expected: The success message prints only if the variable is nonempty. This does not establish that the credential is valid.

InfluxDB unauthorized

Set the token in every new terminal; check bucket access.

WSL · Bash
source ~/.config/psut-wsl/influx.env
curl -fsS http://localhost:8086/health
✓ Expected: InfluxDB health JSON includes status pass when the service is healthy; this does not verify bucket permissions or stored data.
Expected result for each action (2)
  1. source ~/.config/psut-wsl/influx.envThe token becomes available to child processes without being printed. Check only whether it is set, then test authorized access.
  2. curl -fsS http://localhost:8086/healthInfluxDB health JSON includes status pass when the service is healthy; this does not verify bucket permissions or stored data.

No Telegraf data

Check subscriber topic and Telegraf logs; publish from Python first.

WSL · Bash
mosquitto_sub -h 127.0.0.1 -p 1884 -t "psut/iot/lab-local/greenhouse/+/telemetry" -v
✓ Expected: The subscriber remains open. Once a matching publisher sends data, topic and JSON payload appear; an initially blank screen is normal.

Port already in use

Stop only your own old server with Ctrl+C; use ss to identify sockets.

WSL · Bash
ss -ltnp
ss -lunp
✓ Expected: Socket table appears; check the required protocol, port and connection state. Empty results may be normal without active connections.
Expected result for each action (2)
  1. ss -ltnpSocket table appears; check the required protocol, port and connection state. Empty results may be normal without active connections.
  2. ss -lunpSocket table appears; check the required protocol, port and connection state. Empty results may be normal without active connections.

Wokwi firmware missing

Open individual project root, PlatformIO Build first. Confirm firmware paths from wokwi.toml. Install required libraries through PlatformIO.

Wokwi serial timeout

Keep simulator visible, use one serial client; Windows PowerShell checks port 4000. If WSL cannot reach Windows use fallback from Lab 35/36.

Dashboard empty

Choose correct time range and node, confirm InfluxDB points. For Node-RED check Debug and Dashboard 2.0 installation.

WSL · Bash
curl -fsS http://localhost:3000/api/health
✓ Expected: Grafana health JSON reports database ok when healthy; datasource queries still require independent verification.

OLED image blank

Use corrected fakepi; run non-console OLED example; open last nonblank PNG.

Browser Copy button unavailable

Select the code manually and copy using Ctrl+C. Browser permissions may block clipboard on file://.

Dual-broker diagnostics

First verify the selected profile. Never test a local broker using port 1883.

WSL · Bash
source ~/.config/psut-wsl/mqtt-local.env
printf "%s:%s\n%s\n" "$MQTT_HOST" "$MQTT_PORT" "$MQTT_TOPIC"
sudo systemctl status mosquitto --no-pager
sudo journalctl -u mosquitto -n 30 --no-pager
ss -ltn | grep :1884
✓ Expected: A listening TCP socket for port 1884 should appear if the local MQTT broker is running.
Expected result for each action (5)
  1. source ~/.config/psut-wsl/mqtt-local.envThe local MQTT profile is loaded silently. Verify host 127.0.0.1, port 1884 and the matching topic in this shell.
  2. printf "%s:%s\n%s\n" "$MQTT_HOST" "$MQTT_PORT" "$MQTT_TOPIC"The selected broker address, port and topic are printed. They must match the chosen profile, without revealing credentials.
  3. sudo systemctl status mosquitto --no-pagerThe service status and recent log lines appear. Look for Active: active (running) for a running service.
  4. sudo journalctl -u mosquitto -n 30 --no-pagerRecent service log entries appear. Check errors and timestamps; redact credentials before sharing.
  5. ss -ltn | grep :1884A listening TCP socket for port 1884 should appear if the local MQTT broker is running.

For HiveMQ switch to mqtt-hive.env; verify internet and exact session, not local systemctl. Dashboard empty? Check MQTT node connection and Rejected telemetry debug output. Old duplicate path? Delete old imported flow and unused UI config nodes before reimport. Full dashboard guide.