The communication between the WiFi module and your microcontroller is performed by means of a standard asynchronous serial protocol. Almost all microcontrollers are equipped with at least one Universal Asynchronous Receiver Transmitter interface (UART), thus, the establishment of the communication is usually straightforward.
The serial protocol is asynchronous and the bus consists of just three wires, the receiver line, RX, the transmitter line, TX, and the reference GND, as depicted in the following picture:
The serial protocol is usually configurable, thus, it is important to make sure that both devices on the serial bus are configured to use the exact same settings. In particular, to communicate with WiFi module the micro-controller’s UART has to be set as follow:
The default baud rate of the Wi-Fi module is 57600 baud, but it can be changed both from APP or through a serial command.
Depending on the employed WiFi module, the power supply, and the electrical voltage on the bus, must be as follow:
Please note that the power supply must be able to provide at least 300 mA
When you receive the WiFi module, you have to activate the product and enable your mobile phone to talk with the module. When the module is powered-up for the first time, the µPanel firmware will run and create a WiFi access point whose name is miuPanel. This access point represents the primary method for setting-up your module. In order to proceed with the following instructions you will have to install and launch the µPanel App on your mobile device.
The screen reported in the following picture should appear, indicating that you are ready to add your new module!
First of all, enable the WiFi of your mobile device and select the miuPanel from the list. Since the WiFi connection is protected, you will be asked for the password. The initial module’s password is uPanel11 (please note that the P is upper case). When connected, press on the Add New Module button. You will see the following message confirming that the App is actually trying to connect to your module
After a while your module should appear in your device’s screen as shown by the following picture. The header of the new product box shows the serial number that identifies your product. If you wish, you can assign a user friendly name to your module simply by clicking on its serial number and entering the name you like.
You are just a step away from your Panel! To activate your module, make sure your mobile device is actually connected to the Internet (disconnect your device from the miuPanel WiFi and connect to another WiFi or mobile data network which give an internet access) and click on your product box. The following message will appear:
In a while you should see your product with the message “click to connect“, as shown in the following picture, indicating that your product has been correctly registered and activated. In the bottom part of your product box the App also shows both the module local and public IP. You can find more information about these IP in the Router and Module configuration sections. Now press on your product box to connect to your module! (Remember that since you have not yet enabled the WiFi module to connect to any router, before press on “click to connect” you have to connect your mobile device directly to the miuPanel WiFi).
NOTE: if the app shows the message “your product can not be regitered!” this simply means that your miupanel vendor has not yet activated the module registration after the sales, so the registration fail. Usually the vendor activates the registration of your wi-fi module whithin 24 hours the sale. In this case, you can contact your vendor to request the activation.
You should obtain the screen reported in the following picture that shows the module has replied indicating that there is not yet a panel to show you. Congratulations! You are now ready to start with your µPanel!
Please note that the first LED (on the left) in the tool bar will stay steady ON, indicating that your mobile device is connected and communicating with the module. The second LED (on the right), instead will flash only when data and commands are successfully transmitted from your mobile device to your module.
Please go to the next section to know how to configure your module
The module can be configured using either the graphical interface on your mobile device or the module serial port. In this section we will present the former method. By clicking on the menu button, located on the right side of the tool bar, the following menu will appear.
The first menu item (Configure Module) allows you to access the page with the module configuration:
The presented form includes the following basic fields:
Please Note that, if you enable the connection to a WiFi network but the network can not be joined, the direct communication with the module through its WiFi access point will result intermittent. Therefore, it is strongly recommended disabling the Connection to a WiFi network if such a connection can not be established.
In order to be able to communicate with your module from the Internet (i.e. from everywhere in the world) you have to configure your router to allow incoming TCP connections to reach the module port 80 and 81. The µPanel firmware is able to automatically configure most of the routers so that they will accept and forward these incoming connections. The currently supported protocols are the NAT-PMP and UPnP. The former is adopted by Apple products, the latter by many home routers. The following three entries of the configuration module permit to set and enable the router auto-configurator function:
When you want to connect to your module through the Internet but your app does not know the public IP address of your router, you can use the IP discovery mechanism based on our cloud server, which is accessible with the button “locate in cloud” in the product folder. Please note that, the module checks for its public IP every 15 minutes and, if necessary, communicates it to our server. This means that if your router changes IP (for instance, due to a router reboot or ADSL problems), you need to wait up to 15 minutes to be able to reconnect to your module again.
The last module entries permit to configure and access the following features:
Some of the above discussed parameters and functions might be protected and locked by a controller connected to the serial port. Please refer to the serial section to know more about the protected commands.
The following step-by-step instructions will guide you through the creation of a simple panel containing a LED indicator.
Step 2 – Configure the microcontroller UART to work asynchronously at 57600 baud, 8 data bit, 1 stop bit, parity none, flux control none.
Step 3 – Insert a delay of at least 3 s at start-up to let the WiFi module boot
Step 4 – Discharge any previous message by sending to the WiFi module a return carriage (\n or ascii code 10)
Step 5 – Define the panel by sending the following HCTML message to the WiFi module: $P:L1G:0:Test Led;
Step 6 – Turn the LED on by sending the following HCTML message to the WiFi module: #L11
Connect the APP to the module during any of the previous steps to see the result.