Jump to content
Electronics-Lab.com Community

Use BLE to configure Dual-band WiFi Microcontroller


Recommended Posts

Here we introduce another way to download firmware to your microcontroller board.

With a BLE5.0 & Dual-band WiFi microcontroller, you will never have to worry about re-compiling the code just to change the WiFi SSID and password. Write an introduction for your project

How does it work?

The working principle of BLE5.0 is working as follows:

  1. the Ameba RTL8722DM board will send BLE information to your phone;

  2. the phone will send the corresponding WiFi configuration including SSID and password to the RTL8722DM board;

  3. the board is able to connect to the WiFi with the same SSID as your phone;

  4. #include "BLEDevice.h" 
    #include "BLEWifiConfigService.h"  
    BLEWifiConfigService configService;  
    void setup() {     
        Serial.begin(115200);      
        BLE.init();     
        BLE.configServer(1);     
        configService.addService();     
        configService.begin();      // Wifi config service requires a specific     advertisement format to be recognised by the app 
    // The advertisement needs the local BT address, which can only be obtained after starting peripheral mode 
    // Thus, we stop advertising to update the advert data, wait for advertising to stop, then restart advertising with new data     
        BLE.beginPeripheral();     
        BLE.configAdvert()->stopAdv();     
        BLE.configAdvert()->setAdvData(configService.advData());     
        BLE.configAdvert()->updateAdvertParams();     
        delay(100);     
        BLE.configAdvert()->startAdv();  
    }  
    
    void loop() {     
        delay(1000); 
    }

     

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
  • Create New...