bluetooth on esp32

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
asaf
Posts: 16
Joined: Sat Dec 29, 2018 4:32 pm

bluetooth on esp32

Post by asaf » Wed Jun 12, 2019 12:37 pm

i try to show the esp32 on my android bluetooth list.
someone has example code for reading and writing to esp32 with python.
i success to do this with c on arduino :
#include "BluetoothSerial.h" //Header File for Serial Bluetooth, will be added by default into Arduino
BluetoothSerial ESP_BT; //Object for Bluetooth

void setup() {
Serial.begin(115200); //Start Serial monitor in 9600
ESP_BT.begin("ESP32_LED_Control"); //Name of your Bluetooth Signal
Serial.println("Bluetooth Device is Ready to Pair");

}

void loop() {
// put your main code here, to run repeatedly:

}

but how can i do it with python ?
Thanks

User avatar
jimmo
Posts: 664
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia

Re: bluetooth on esp32

Post by jimmo » Wed Jun 12, 2019 10:16 pm

Unfortunately there is not currently any support for Bluetooth Low Energy, but it is being actively worked on. See https://github.com/micropython/micropython/pull/4589 for more info

asaf
Posts: 16
Joined: Sat Dec 29, 2018 4:32 pm

Re: bluetooth on esp32

Post by asaf » Thu Jun 13, 2019 9:44 am

but i got :ImportError: no module named 'bluetooth'
where can i find bluetooth class ?
Thanks

User avatar
jimmo
Posts: 664
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia

Re: bluetooth on esp32

Post by jimmo » Thu Jun 13, 2019 9:51 am

Are you running a build from that branch?

This work hasn't been finished yet - it's still in development, and potentially might make into MicroPython v2.0

asaf
Posts: 16
Joined: Sat Dec 29, 2018 4:32 pm

Re: bluetooth on esp32

Post by asaf » Thu Jun 13, 2019 10:35 am

what do u mean build ?
i use v1.11 from here http://docs.micropython.org/en/latest/e ... ckref.html
Thanks

User avatar
jimmo
Posts: 664
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia

Re: bluetooth on esp32

Post by jimmo » Thu Jun 13, 2019 1:42 pm

v1.11 does not include this.

By "build" I mean that you would have compiled the firmware from source (including the changes from that PR). You can also access an older version of this from http://micropython.org/download (esp32--bluetooth.bin) but you're going to have a hard time because it's different to what's in the PR and not documented anywhere.

mikronauts
Posts: 5
Joined: Thu Nov 03, 2016 10:12 pm

Re: bluetooth on esp32

Post by mikronauts » Thu Sep 12, 2019 6:56 pm

Any idea when BLE will be in the main line?

User avatar
jimmo
Posts: 664
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia

Re: bluetooth on esp32

Post by jimmo » Thu Sep 12, 2019 9:42 pm

https://github.com/micropython/micropython/pull/5051 -- PYBD any day now. ESP32 soon (although we might wait to move to ESP-IDF 4.0).

User avatar
iotman
Posts: 41
Joined: Sat Feb 02, 2019 4:06 pm
Location: Nanoose Bay, Canada
Contact:

Re: bluetooth on esp32

Post by iotman » Fri Sep 27, 2019 5:40 pm

Hi, we are working on a BLE project and we're wondering when we will be able to write code for BLE on ESP32 boards.

Is there some way of being notified when it is ready? Will it be a separate library, or will it be built into the main download?

Tks, AB

User avatar
jimmo
Posts: 664
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia

Re: bluetooth on esp32

Post by jimmo » Sat Sep 28, 2019 3:32 am

See the updates on that PR. I'll address the review comments from yesterday this weekend, and then you can see the comment from me this morning about the esp32 branch.

Post Reply