element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Experts, Learning and Guidance
  • Technologies
  • More
Experts, Learning and Guidance
Ask an Expert Forum How to listen to bluetooth boards?
  • Blog
  • Forum
  • Documents
  • Leaderboard
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Experts, Learning and Guidance to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 4 replies
  • Subscribers 288 subscribers
  • Views 947 views
  • Users 0 members are here
  • bluetooth
  • ble
  • sensor
Related
See a helpful answer?

Be sure to click 'more' and select 'suggest as answer'!

If you're the thread creator, be sure to click 'more' then 'Verify as Answer'!

How to listen to bluetooth boards?

obones
obones over 1 year ago

Hello,

I have quite a few ESP32 based custom devices that are connected to WiFi and this works just fine.

However, I also have sitting on my desk a few boards that are only capable of communicating via Bluetooth (BLE) and I'm not sure how I would connect to them to retrieve whatever data they have to transmit.

For instance, one of them has an accelerometer that I could use to sense vibrations on a water pipe to infer water consumption. It could store a set of values for a given amount of past time and then send that history data to the reading device when it is being asked to do so.

With WiFi, I can write a web server that exposes an endpoint to which the device would connect to post its data. Or even have it directly use the MQTT protocol and be done with it.

But with Bluetooth, I'm not sure what I should come up with. Something that would go BLE --> MQTT would be ideal of course, but if it goes BLE -> WiFi -> MQTT, it's also fine as maybe I could piggyback it on an existing ESP32 based board.

Any ideas are most welcome.

  • Sign in to reply
  • Cancel

Top Replies

  • shabaz
    shabaz over 1 year ago +3
    BLE devices operate in different roles, so you'd need to choose what roles suit your needs. For instance, you might prefer a connectionless approach where some sensors periodically just advertise information…
  • shabaz
    0 shabaz over 1 year ago

    BLE devices operate in different roles, so you'd need to choose what roles suit your needs. For instance, you might prefer a connectionless approach where some sensors periodically just advertise information, and those you could indeed just listen to. Or, for other projects, you might prefer a connection-oriented approach where the sensor is a slave that responds to a master to send the measurements.

    If you're using pre-programmed BLE devices and have no control of the software running on them, then the choices of roles have already been made for you. Otherwise, you can choose the appropriate roles.

    If you're developing the software, then you'll need to examine the API for the device; it will be different depending on which microcontroller you're using, and you'll need to search for an example that matches the role you intend to use.

    If you're using a Linux machine, then things are a bit more standard, and the same API (well, in the form of a library) can be used regardless of machine and Bluetooth adapter, and then the only choice is what programming language you want to use, because there are several libraries so you'll need to pick the one that is available for your language.

    Plus, you'd need to get familiar with how data is formatted in BLE; it's not just a simple unformatted payload like with IP, and instead, the data comes in small bundles with an identifier attached to each value, e.g., a temperature type of identifier. You'd ideally look for pre-defined identifiers if possible, otherwise you can use a custom one.

    During development, you can use free software such as 'LightBlue' on Android devices, or BLE sniffers are available from Cypress, TI, etc.

    I don't know of a good single online resource for BLE, except the one I wrote, so here's the link to it:  Smart Doorbell System - Part 9 - Working with BLE - What it is, and How to Use It!  

    It should provide a fairly good explanation for developers to at least get started. Ignore the Introduction section, because that discusses a particular project. The rest is all general-purpose for any BLE project.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • aswinvenu
    0 aswinvenu over 1 year ago

    What you are looking for is a BLE Gateway. You can build one with one of your ESp32 boards. BLE devices can't communicate directly to an MQTT server.
    BLE Salve devices ( BLE GATT servers - Sensors with BLE ) -> BLE Master device ( BLE GATT client, In this case it's the gateway).-> Internet through WiFi or Ethernet connection.

    Eg: https://github.com/oh2mp/esp32_ble2mqtt

    Note: This just came up in a google search. I haven't tested it by myself.

    My suggested gateway setup:

    • ESP32 as BLE GATT Client
    • Set WiFi STA mode - Configure Static IP Adress
    • Establish a connection between your MQTT Broker and the gateway.
    • Host a webpage for configuring the BLE Profiles and Characteristics, MQTT Topics etc.
    • Read/Notify sensor data ( Through BLE), Format it ( Probably in JSON) and forward it to your MQTT Broker
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • obones
    0 obones over 1 year ago in reply to aswinvenu

    Thanks, that gave a word to search for and in doing so I stumbled on the OpenMQTTGateway project here: https://docs.openmqttgateway.com/

    This looks very promising, especially considering that it could centralize a couple of amateur boards that I created to talk/listen to various 433/868MhZ devices.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • obones
    0 obones over 1 year ago in reply to shabaz

    Thanks for the detailed explanation, especially the article detailing BLE, very instructive.

    The board is the MAX32666FTHR application platform board so I believe I'll be able to select a standard profile to report the values over BLE.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube