Troubleshooting Guide¶
This guide covers common issues you might encounter while working with Raspberry Pi Pico, Thonny, and the Number Transmitter project.
Table of Contents¶
- Thonny Issues
- Raspberry Pi Pico Connection Issues
- Flashing and Firmware Issues
- WiFi Connection Issues
- API and Networking Issues
- Code Execution Issues
- Web Application Issues
- Performance Issues
Thonny Issues¶
Thonny Won't Start¶
Symptoms: - Double-clicking Thonny does nothing - Application crashes on startup - Error messages on launch
Solutions:
Windows:
# Try running as administrator
# Right-click Thonny → Run as administrator
# Check if Python is accessible
python --version
# Reinstall Thonny
# Uninstall via Control Panel, then reinstall from thonny.org
macOS:
# Check if Thonny is in quarantine
xattr -d com.apple.quarantine /Applications/Thonny.app
# Or remove and reinstall
brew uninstall thonny
brew install --cask thonny
# Check permissions
ls -la /Applications/Thonny.app
Linux:
# Run from terminal to see error messages
thonny
# Reinstall dependencies
sudo apt install python3-tk python3-pip
pip3 install --upgrade thonny
# Check file permissions
chmod +x $(which thonny)
Thonny Interface Issues¶
Symptoms: - Missing panels (Shell, Files, Variables) - UI elements not displaying correctly - Buttons not working
Solutions:
- Reset View to Defaults
View→Reset view-
Restart Thonny
-
Check Theme Settings
Tools→Options→Theme-
Try different themes
-
Clear Configuration
Raspberry Pi Pico Connection Issues¶
Pico Not Detected¶
Symptoms: - No device shown in Thonny - "No device found" error - RPI-RP2 drive doesn't appear
Solutions:
- Check USB Cable
- Use a data cable, not charge-only cable
- Try different USB cable
-
Test cable with another device
-
Try Different USB Port
- Use USB 2.0 port (avoid USB 3.0 hubs initially)
- Try direct connection, not through hub
-
Test both front and back ports on desktop
-
Verify BOOTSEL Mode
- Disconnect Pico
- Hold BOOTSEL button
- Connect USB while holding
- Release after 2 seconds
-
Check for RPI-RP2 drive
-
Check Device Manager (Windows)
-
Check System Info (macOS)
-
Check Devices (Linux)
Permission Denied (Linux/macOS)¶
Symptoms: - "Permission denied: '/dev/ttyACM0'" - Can't access serial port - Upload fails with permission error
Solutions:
Linux:
# Add user to dialout group
sudo usermod -a -G dialout $USER
sudo usermod -a -G tty $USER
# Create udev rule
sudo nano /etc/udev/rules.d/99-pico.rules
# Add this line:
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2e8a", MODE:="0666", GROUP="dialout"
# Reload udev
sudo udevadm control --reload-rules
sudo udevadm trigger
# Log out and back in (or reboot)
macOS:
# Check permissions
ls -la /dev/cu.usbmodem*
# If needed, grant access
sudo chmod 666 /dev/cu.usbmodem*
# For permanent fix, add user to dialout equivalent
# (macOS doesn't have dialout, but check group memberships)
groups
Flashing and Firmware Issues¶
Flashing Fails¶
Symptoms: - "Failed to write firmware" - Process hangs during flash - Pico doesn't reboot after flash
Solutions:
- Verify BOOTSEL Mode
- Must be in BOOTSEL mode (RPI-RP2 visible)
-
Try entering BOOTSEL mode again
-
Try Manual Flashing
- Download .uf2 file from micropython.org
- Drag and drop to RPI-RP2 drive
-
Wait for automatic reboot
-
Check Disk Space
-
Re-download Firmware
- Corrupt download might cause issues
-
Download fresh .uf2 file
-
Try Different Computer
- Rule out computer-specific issues
Wrong Firmware Version¶
Symptoms:
- Imports fail for Pico W features
- network module not available
- Unexpected module errors
Solutions:
-
Check Current Version
-
Reflash Correct Firmware
- Pico W requires Pico W firmware (with WiFi support)
- Regular Pico uses standard firmware
- Download correct version from micropython.org
WiFi Connection Issues¶
Can't Connect to WiFi¶
Symptoms:
- wlan.isconnected() returns False
- Connection timeout
- "Failed to connect" errors
Solutions:
-
Verify Pico W Hardware
-
Check WiFi Credentials
-
Check WiFi Network
- Pico W supports 2.4 GHz only (not 5 GHz)
- Check router is broadcasting 2.4 GHz
- Some enterprise/WPA-Enterprise networks not supported
-
Try personal hotspot for testing
-
Check Signal Strength
- Move Pico closer to router
- Remove obstacles between Pico and router
-
Check for interference
-
Debug Connection
import network import time wlan = network.WLAN(network.STA_IF) wlan.active(True) print("Connecting...") wlan.connect("SSID", "PASSWORD") # Wait and show status timeout = 10 while timeout > 0: if wlan.isconnected(): print("Connected!") print(wlan.ifconfig()) break print(f"Status: {wlan.status()}") time.sleep(1) timeout -= 1 if not wlan.isconnected(): print("Failed to connect") print(f"Final status: {wlan.status()}") -
Status Code Reference
# wlan.status() return values: # 0 = STAT_IDLE -- no connection and no activity # 1 = STAT_CONNECTING -- connecting in progress # 2 = STAT_WRONG_PASSWORD -- failed due to incorrect password # 3 = STAT_NO_AP_FOUND -- failed because no access point replied # 4 = STAT_CONNECT_FAIL -- failed due to other problems # 5 = STAT_GOT_IP -- connection successful
Weak WiFi Signal¶
Symptoms: - Intermittent connection - Slow data transfer - Frequent disconnections
Solutions:
-
Check RSSI
-
Improve Signal
- Move Pico closer to router
- Use external antenna (if supported)
- Remove metal objects nearby
- Change WiFi channel on router
API and Networking Issues¶
API Not Accessible¶
Symptoms: - "Connection refused" - "No route to host" - Timeout errors
Solutions:
-
Check API Server Running
-
Check Firewall
-
Check Network Connectivity
-
Verify Same Network
- Pico and API server must be on same network
-
Check IP addresses in same subnet
-
Use Correct IP Address
CORS Errors (Web Application)¶
Symptoms: - Browser console shows CORS errors - "Access-Control-Allow-Origin" errors - API works in curl but not browser
Solutions:
-
Enable CORS in Flask
-
Specific Origin
Code Execution Issues¶
ImportError: No Module¶
Symptoms:
- ImportError: no module named 'requests'
- ImportError: no module named 'flask'
Solutions:
- MicroPython vs Python
- MicroPython has limited libraries
- Use
urequestsinstead ofrequests - Some modules not available
# MicroPython (on Pico)
import urequests # Not 'requests'
import ujson # Not 'json'
# Regular Python (on computer)
import requests
import json
- Install Missing Packages (Computer)
Memory Errors on Pico¶
Symptoms:
- MemoryError
- Pico crashes or resets
- Code runs once then fails
Solutions:
-
Check Memory Usage
-
Optimize Code
-
Simplify Code
- Remove debug print statements
- Use shorter variable names
- Split large files into modules
Infinite Loops/Hangs¶
Symptoms: - Code doesn't respond - Can't stop program - Thonny frozen
Solutions:
- Interrupt with Ctrl+C
- In Thonny Shell, press Ctrl+C
-
May need to press multiple times
-
Disconnect/Reconnect
- Unplug Pico USB
- Wait 2 seconds
-
Reconnect
-
Reset Pico
- Press RUN button on Pico (if available)
-
Or disconnect power
-
Add Safety Timeouts
Web Application Issues¶
Flask App Won't Start¶
Symptoms: - "Address already in use" - "Permission denied" - Import errors
Solutions:
-
Port Already in Use
-
Permission Denied (Port < 1024)
-
Module Import Errors
Page Not Loading¶
Symptoms: - "This site can't be reached" - "Connection refused" - Blank page
Solutions:
-
Check Flask is Running
-
Use Correct URL
-
Check Browser Console
- Press F12 to open developer tools
- Check Console tab for JavaScript errors
- Check Network tab for failed requests
Performance Issues¶
Slow Response Times¶
Symptoms: - API responses take too long - Web page loads slowly - Pico responses delayed
Solutions:
-
Check Network Latency
-
Optimize API Queries
- Reduce query frequency
- Cache responses
-
Use smaller data payloads
-
Reduce Print Statements
High CPU Usage¶
Symptoms: - Computer fan running high - Flask using lots of CPU - System slowdown
Solutions:
- Check for Infinite Loops
- Review code for tight loops
-
Add delays in loops
-
Disable Debug Mode
-
Limit Concurrent Requests
- Flask development server is single-threaded
- For production, use gunicorn or similar
Getting Additional Help¶
If your issue isn't covered here:
- Check Project Documentation
- Read the relevant guide
-
Review example code
-
Community Resources
- Raspberry Pi Forums
- MicroPython Forum
-
Debug Systematically
- Isolate the problem
- Test components individually
- Add debug print statements
-
Check logs and error messages
-
Report Issues
- Include error messages
- Specify OS and versions
- Describe steps to reproduce
- Include minimal code example
Quick Reference: Common Commands¶
Thonny Debug Commands¶
# Check MicroPython version
import sys
print(sys.version)
# Check memory
import gc
gc.collect()
print(f"Free: {gc.mem_free()}")
# List files
import os
print(os.listdir())
# Check WiFi (Pico W)
import network
wlan = network.WLAN(network.STA_IF)
print(f"Connected: {wlan.isconnected()}")
if wlan.isconnected():
print(f"IP: {wlan.ifconfig()[0]}")
System Commands¶
# Check USB devices (Linux)
lsusb
# Check serial ports (Linux)
ls /dev/ttyACM*
# Check serial ports (macOS)
ls /dev/cu.*
# Check COM ports (Windows)
mode
# Test API
curl http://localhost:5001/api/status
Need more help? See the Installation Guide or Flashing Guide.