BLE connection issues

Home Forums esp32 BLE connection issues

Tagged: 

Viewing 5 reply threads
  • Author
    Posts
    • #23783
      TLes537
      Participant

        I’m having a lot of issues getting BLE to connect to anything using a WeMos Lolin32. Sometimes it will connect great and reconnect automatically when the ESP is reset. Other times it takes many multiple tries to get the initial connection established then it will not reconnect and I have to connect as a new device which usually takes multiple tries.
        I’m using a lot of different sample code packages and they all act the same. Same code on other ESP devices works flawlessly so I’m pretty sure it is something to do with the Lolin..
        I prefer to use the Lolin32 because of the features but struggling.
        Any help would be appreciated.

      • #23787
        Renzo Mischianti
        Keymaster

          Hi TLes,
          It’s possible that you don’t give so much power to the microcontroller to do the operations, try to add an external power supply.
          Bye Renzo

        • #23793
          TLes537
          Participant

            Thanks for the info but it appears that this is an issue with Android 12.
            I went back to my old Android 6 tablet and it works as is should.

          • #23801
            Renzo Mischianti
            Keymaster

              Ahh perfect! This is important information.
              Probably the version of Bluetooth changed and also changed the management.
              Bye Renzo

            • #23826
              TLes537
              Participant

                I have been able to test on andriod versions 6, 9 and 13 succesfully. 10, 11 1nd 12 all seem to be a problem.
                I am seeing mentions of having to grant permissions in my code?? Not sure if the example code I am trying to use does everything needed. Can someone show me code that code that does work??

              • #23851
                Renzo Mischianti
                Keymaster

                  Hi,
                  for the upper version of Android you must specify in the file AndroidManifest.xml these grant

                  
                  <manifest>
                      <!-- Request legacy Bluetooth permissions on older devices. -->
                      <uses-permission android:name="android.permission.BLUETOOTH"
                                       android:maxSdkVersion="30" />
                      <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"
                                       android:maxSdkVersion="30" />
                  
                      <!-- Needed only if your app looks for Bluetooth devices.
                           If your app doesn't use Bluetooth scan results to derive physical
                           location information, you can strongly assert that your app
                           doesn't derive physical location. -->
                      <uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
                  
                      <!-- Needed only if your app makes the device discoverable to Bluetooth
                           devices. -->
                      <uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
                  
                      <!-- Needed only if your app communicates with already-paired Bluetooth
                           devices. -->
                      <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
                  
                      <!-- Needed only if your app uses Bluetooth scan results to derive physical location. -->
                      <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
                      ...
                  </manifest>
                  

                  But if It’s works with version 13 It’s very strange.

                  Bye Renzo

              Viewing 5 reply threads
              • You must be logged in to reply to this topic.
              Exit mobile version