Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Bluetooth communication between Gpy & ESP

    Scheduled Pinned Locked Moved GPy
    3 Posts 2 Posters 284 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P Offline
      poesel
      last edited by

      Hi,

      I'd rather post this under Bluetooth but that seems closed.

      I have the following setup: a Gpy is used to send data with LTE & MQTT to a server. The data comes from several (<10) ESP32 clients (also running Micropython). The data is very infrequent (about every 10m) and low volume (temperature, humidity, weight). Everything has to be battery & solar driven. My idea for the communication between the controllers was to use BLE.
      The clients would deep-sleep between the measurements and advertise their data after wakeup & measurements.

      After reading through the documentation that seems doable. :)

      Has someone done something similar and would share some example code? I'm pretty new to BLE and couldn't find a tutorial apart from what is in the pycom documentation.

      Thanks!

      J 1 Reply Last reply Reply Quote 0
      • J Offline
        jcaron @poesel
        last edited by

        @poesel is the GPy also going to be battery-powered? This may be an issue, as the two devices in a communication need to be awake at the same time (ESP32s are, at least currently, not very good at sleeping with BLE advertising/listening for connections).

        This means you will need to either have the GPy awake at all times, or somehow synchronise when the devices send so the GPy is awake at the same time.

        Note that there are two ways for the data to be sent: you could just advertise it, but then there’s no acknowledgment, so you need to make sure you have several advertisements, or you could connect and share the data via a characteristic. In the latter case, you need to decide which of the devices connects to the other. I would probably have the sensors connect to the GPy, but it depends a lot on your setup.

        1 Reply Last reply Reply Quote 0
        • P Offline
          poesel
          last edited by

          Yes, everything is battery powered. I will have to synchronize the wakeup cycles. I guess there won't be much of a time difference after 10 minutes. It will probably be necessary to set and synchronize the time every now and then.

          Would it make sense for the ESPs to advertise the availability of data and provide the data as characteristic? The Gpy could then advertise 'data read' and send the ESPs back to sleep.
          Similar for setting the time on the ESPs. The Gpy advertises its availability and provides the current time as characteristic.

          1 Reply Last reply Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • 1 / 1
          • First post
            Last post

          Pycom on Twitter

          Pycom