WiFi Configuration Access Point with JSON
Overview
This NetBurner application configures the WiFi interface as an access point to provide users with a convenient way to connect to local wireless networks. The application creates a web-based configuration interface that allows users to scan for and connect to available WiFi networks.
- Note
- The difference from the previous ConfigAP example is that the list of networks is generated using JavaScript to parse a JSON object sent by the NetBurner which contains the access point scan results.
For the user's convenience, the device's SSID and WiFi Interface IP address are printed out the serial port. These can be used to access the device's webpage, which allows the user to connect to a local network.
Key Features
- Automatic Access Point Creation: If no network SSID is configured, the device automatically starts as a WiFi Access Point
- Network Scanning: Scan for and display available local wireless networks
- Web-based Configuration: User-friendly webpage for network selection and connection
- JSON-based Communication: JavaScript parsing of JSON objects containing scan results
- Custom Branding Support: Configurable SSID prefix for custom product branding
- Serial Interface: Command-line interface for manual WiFi operations
How It Works
Initial Startup
- On boot, the application checks for a stored network SSID
- If no SSID is found, it creates a WiFi Access Point
- The access point SSID follows the format:
NB_<last 6 bytes of MAC>
- The device's SSID and IP address are printed to the serial port
Configuration Process
- Users connect to the NetBurner's access point using a WiFi-enabled device
- Navigate to the device's webpage using the provided IP address
- The webpage displays a list of available networks (generated via JavaScript)
- Users select their desired network and enter credentials
- The device connects to the selected network and stores the configuration
Custom Branding
To customize the access point SSID prefix, uncomment and modify this line in main.cpp:
extern const NB::SSID_t default_SSID_Prefix = { 4, "FOO_" };
Serial Commands
The application provides several serial commands for manual WiFi management:
- C - Connect to WiFi network
- D - Disconnect from current network
- R - Reset stored WiFi SSID
- S - Perform network scan
- W - Display WiFi status and configuration
- X - Reset WiFi module
- Z - System reboot
Technical Details
WiFi Security Support
The application supports multiple security protocols:
- Open (no security)
- WEP
- WPA
- WPA2
- WPS
Cipher Support
- None
- TKIP
- AES
- Mixed (TKIP/AES)
Network Information Display
When connected, the application displays:
- SSID (network name)
- BSSID (access point MAC address)
- Signal strength (RSSI)
- Channel
- Security type
- Cipher method
- IP configuration (address, mask, gateway, DNS)
Configuration Options
The application allows customization of default settings by uncommenting and modifying these variables:
Usage Instructions
- First Time Setup:
- Power on the NetBurner device
- Connect to the
NB_XXXXXX access point
- Open a web browser and navigate to the device's IP address
- Select your WiFi network and enter credentials
- Subsequent Startups:
- The device will automatically connect to the stored network
- If connection fails, it will revert to access point mode
- Manual Configuration:
- Use serial commands for direct control
- Monitor connection status and network information
Development Notes
- The application uses SPI communication for WiFi operations
- Web server runs on default port 80
- System diagnostics are enabled (should be disabled for production)
- Configuration mirroring is enabled for debugging
- The application includes comprehensive error handling and status reporting