A library to help you connect to wireless networks and manage network connections.
- Overview
- Features
- Getting Started
- Setup Instructions
- Usage
- Time Synchronisation API
- Security Considerations
- Usage Scenarios
- Future Enhancements
- Contributing
- License
- Support
Goat - Pico Network Manager is a Micropython library for the Raspberry Pi Pico W series of microcontrollers. Perfect for all your networking needs, this library comes with a captive portal for initial network setup and can even manage a web server when connected.
With features like access point with captive portal, automatic network reconnection and access point fallback, Pico Network Manager ensures a professional IOT networking experience.
With its open source nature, Pico Network Manager can be adapted to your specific needs. Whether you want to adjust default settings or extend the manager with more advanced functionality, Pico Network Manager provides a good starting point for all your networking needs.
Pico Network Manager comes packed with the following features:
-
Access Point
Used for initial setup to provide the captive portal for network connection. -
Captive Portal
Connect to a network or reconnect if your connection was dropped and could not be re-established. -
DNS Redirection
Automatic DNS redirection in AP mode to redirect to the captive portal. -
Connection Monitoring
Automatic network connection monitoring with reconnection and AP fallback. -
Web Interface
Configure a web interface for your firmware to be used when connected to a network. -
Time Synchronisation
Enable automatic time synchronisation from our own internally hosted time API when connected to wi-fi.
To deploy Goat - Pico Network Manager and use it in your firmware, you will need:
-
Hardware Components:
- Microcontroller (e.g., Raspberry Pi Pico W for wireless connectivity)
-
Software:
- MicroPython or CircuitPython
- Required Python libraries (all native to the Pico Network Manager library distribution)
- Extend your device firmware with the Pico Network Manager library. Instructions are provided.
- Flash the microcontroller with MicroPython/CircuitPython firmware.
- Upload your device firmware along with the Pico Network Manager library and dependencies to the microcontroller.
- Connect to the device's hotspot to access the captive portal.
- Note: The password is "password" by default and can be modified in your code.
- Connect to the captive portal. If not automatically redirected, visit http://192.168.4.1.
- Scan for wireless networks and enter your Wi-Fi credentials to establish network connectivity.
- Use a network scanner to locate the new device on your network and make a note of the IP address.
- If you defined a web interface, access it using the device's IP address to configure and customize settings.
- If you are unable to obtain the IP address, try connecting using the default hostname "PicoW".
The library is easy to integrate into your existing project.
-
Import and Initialize:
from NetworkManager import NetworkManager import uasyncio as asyncio network_manager = NetworkManager() asyncio.create_task(network_manager.run())
-
Customizing Parameters: Customize settings by passing parameters during instantiation:
from WebServer import WebServer web_server = WebServer() network_manager = NetworkManager( ap_ssid="My Access Point", ap_password="MyPassword", ap_dns_server=True, hostname="MyPicoW", time_sync=True, time_server="https://goatbot.org", sta_web_server=web_server )
- Your optional web server must implement
run()
andstop_server()
methods which the Network Manager will use.
- Your optional web server must implement
-
Extended Customisation: Customize settings by passing parameters after instantiation:
from WebServer import WebServer web_server = WebServer() network_manager = NetworkManager( ap_ssid="My Access Point", ap_password="MyPassword", ap_dns_server=True, hostname="MyPicoW", time_sync=True, time_server="https://goatbot.org", sta_web_server=web_server ) # Access point settings network_manager.ap_ssid = "My Access Point" network_manager.ap_password = "MyPassword" network_manager.ap_dns_server = True network_manager.captive_portal_http_port = 80 network_manager.network_connection_timeout = 10 # Access point IP settings network_manager.ap_ip_address = "192.168.4.1" network_manager.ap_subnet = "255.255.255.0" network_manager.ap_gateway = "192.168.4.1" network_manager.ap_dns = "192.168.4.1" # DHCP settings network_manager.hostname = "PicoW" # Time synchronisation settings network_manager.time_sync = True network_manager.time_server = "https://goatbot.org"
- Your optional web server must implement
run()
andstop_server()
methods which the Network Manager will use.
- Your optional web server must implement
You can optionally self-host the Time Synchronisation API in environments where you don't have internet access or you want a fully self-hosted solution.
To host the Time Synchronisation API locally you will need:
- A computer with NodeJS v22.x installed
- A domain name Optional
- Security certificates If using SSL
Before you install and configure the Time Synchronisation API you should ensure all requirements are satisfied.
- Open a command shell and navigate to the "time-api" directory.
- Execute the following commands:
sudo npm -g install pm2
sudo pm2 startup
npm install
sudo pm2 start ./index.js
sudo pm2 save
The Time Synchronisation API will now be running in the background and will automatically start when your computer starts.
- Update Default Passwords: Change the default AP password (
password
) to secure your setup. - Network Safety: Ensure proper network security to prevent unauthorized access.
- Portable Devices: Simplify network reconfiguration for portable IoT devices.
- Home Automation: Ensure reliable network connectivity for home automation projects.
- IoT Devices: Provide a seamless networking experience for IoT devices in various environments.
We welcome contributions! Visit the GitHub Repository to report issues, suggest features, or submit pull requests.
This project is licensed under the MIT License. See the LICENSE file for details.
For questions or support, please create an issue in the GitHub Repository.