logo elektroda
logo elektroda
X
logo elektroda

ESP32 WROOM simultaneous support for WiFi , BLE and client http json

MAJSTER XXL 921 6
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 19706933
    MAJSTER XXL
    Level 29  
    Hello,
    I'm not too familiar with ESP32, but I've managed to embrace ArduinoIDE to compile and load the batch to this WROOM board.
    The project is quite laudable, as it already includes working code with BLE support that reads the continuous glucose monitoring system.
    I, on the other hand, wanted to try my hand at having this read data additionally uploaded as blood glucose measurements via wifi from the ESP32
    e.g. to my test site from another project:
    https://testowycgm.herokuapp.com/
    so far the big surprise for me was that just adding a few inclusions generates a batch that doesn't fit in the ESP32 memory, please give me some advice on what to do about this, I'm probably approaching the subject wrong but the project is quite important for many users of this CGM system. Is this simultaneous BLE and wifi support so resource intensive for the ESP32?
    ESP32 WROOM simultaneous support for WiFi , BLE and client http json .
    I've read that the ESP32 needs to share a radio for handling both transmissions, so it would be good if the BLE picked up its packet and went to sleep for another 4 minutes, and let's say immediately after the BLE sleeps the wifi would send a packet to the site and could also sleep until the next sequence.
    Do you have a problem with Arduino? Ask question. Visit our forum Arduino.
  • ADVERTISEMENT
  • #2 19707004
    khoam
    Level 42  
    Select a partition scheme in the Arduino IDE where a larger partition is allocated for the application code e.g. Huge APP or Minimal SPIFFS instead of the default scheme.

    ESP32 WROOM simultaneous support for WiFi , BLE and client http json .

    MAJSTER XXL wrote:
    Is this simultaneous BLE and wifi support so resource intensive for the ESP32?
    .
    If using the Arduino Core, then yes.

    Added after 2 [minutes]:

    MAJSTER XXL wrote:
    so it would be good if the BLE picked up its packet and went to sleep for another 4 minutes, and let's say right after the BLE sleeps the wifi would send the packet to the site and it too could sleep until the next sequence.
    .
    And it's up to you ;) .
  • ADVERTISEMENT
  • #3 19707235
    MAJSTER XXL
    Level 29  
    Great, thanks for the hint, this solves just the beginning of the further step of getting into project preparation. Would a colleague suggest which library to use to handle uploading measurements to the http site should be chosen from the rich set of libraries?
    https://github.com/espressif/arduino-esp32/tree/master/libraries
    The data will be sent as json to a database. In theory it would work like this:
    - when the program starts, it runs a BLE scan and waits for the right transmitter of the blood glucose monitoring system to be captured,
    - the BLE transmitter from the blood glucose monitoring system only broadcasts for a short time exactly every 5 minutes,
    - read out the captured measurement and terminate the BLE connection and put it to sleep for say 4m30s
    - after ending the BLE connection, start the wifi connection (question in which mode, access point / client?)
    - the wifi connection sends the json to the correct server and you can then terminate the connection?
    - wifi and BLE remain dormant until about 30s before the next connection to the glucose tracker is expected,
    - the BLE module starts scanning and so on in a loop.
    Does this above scenario look sensible?
    ESP32 WROOM simultaneous support for WiFi , BLE and client http json .
  • Helpful post
    #4 19707295
    khoam
    Level 42  
    MAJSTER XXL wrote:
    Data will be sent as json to database.

    Tutorial: Link .

    The homepage ( Link ) also lists tutorials for BLE.
  • ADVERTISEMENT
  • #5 19709355
    MAJSTER XXL
    Level 29  
    I'm currently trying to produce a proper json to be uploaded to the test page, but despite sending some form of json with data, this data doesn't show up on the page.
    The wifi connection on the ESP is working, with the POST method I would like to put some data, but I don't know where to look for the error. Maybe this library is not working properly? What to do with it to make it work to send this json? On the test site
    https://httpbin.org/anything
    next to the json I only have the record null

    ESP32 WROOM simultaneous support for WiFi , BLE and client http json .

    ESP32 WROOM simultaneous support for WiFi , BLE and client http json

    Below is a snapshot of the sketch:
    Code: C / C++
    Log in, to see the code
    .
  • ADVERTISEMENT
  • #6 19713052
    khoam
    Level 42  
    Since you want to connect via HTTPS, the client must be configured to support the secure protocol and verify the certificate of the server it is connecting to.
    Example: Link .

    Or disable such verification. Example: Link .
  • #7 19721524
    MAJSTER XXL
    Level 29  
    Thanks for the help so far. Regarding my topic, I have managed to grasp a program that as a standalone when uploaded to the ESP32 allows to correctly locate JSON to the database to the server and I have it tested. It works like this:
    - when power is applied, the module connects to the wifi network,
    - downloads the epoch time from the time server
    - uploads a json to the server
    - based on this json, the website generates a constant sugar result for me in a test loop every 1 minute for the time being.
    On the other hand, when I add support for this json loading to the code with BT reading working and I want to load this measurement value (also fixed for now) to the server it unfortunately rejects my connection to my test page. please any further advice. I suspect I don't have support to disable BT as it mixes with WiFi, which I guess you can tell from the serial logs:
    Code: Text
    Log in, to see the code
    .

    Below a screen shot of the terminal while loading the json from the checked code
    ESP32 WROOM simultaneous support for WiFi , BLE and client http json [/syntax].


    edit. i think i've managed to grasp,
    i gave BT stop in the right place with the function:
    btStop();

Topic summary

The discussion revolves around the challenges of using the ESP32 WROOM module to simultaneously support WiFi and BLE for uploading blood glucose measurements as JSON data. The user initially faced memory issues when trying to integrate BLE functionality with WiFi data transmission. Suggestions included selecting a suitable partition scheme in the Arduino IDE to allocate more memory for the application. The user also sought advice on libraries for handling HTTP POST requests to send JSON data to a server. After successfully establishing WiFi connectivity and sending JSON data independently, the user encountered connection issues when integrating BLE reading with WiFi uploading, likely due to resource conflicts between BLE and WiFi operations.
Summary generated by the language model.
ADVERTISEMENT