bluetooth on esp32

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
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

Online
User avatar
jimmo
Posts: 526
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

Online
User avatar
jimmo
Posts: 526
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

Online
User avatar
jimmo
Posts: 526
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?

Online
User avatar
jimmo
Posts: 526
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).

Post Reply