bluetooth on esp32
Re: bluetooth on esp32
Hi @jimmo, thanks for that; I have read the github contributions, but the technical descriptions are way above my head. I can see that it has been a huge effort to produce the BLE capability, so we're very grateful for all that hard, hard work.
It seems you have successfully implemented it for the ESP32, so I'm wondering if there is a download somewhere we can try?
I'm also wondering if this will be a special BLE version of MicroPython we would download, or if it is a separate library that can be called?
Our needs are pretty simple; just a few BLE temperature sensors we want to occasionally monitor.
Regards, AB
It seems you have successfully implemented it for the ESP32, so I'm wondering if there is a download somewhere we can try?
I'm also wondering if this will be a special BLE version of MicroPython we would download, or if it is a separate library that can be called?
Our needs are pretty simple; just a few BLE temperature sensors we want to occasionally monitor.
Regards, AB
Re: bluetooth on esp32
Hi,
I recently added support for board-specific firmware, which is mainly to support things like pin naming. But I guess we could have BLE and non-BLE variants of each board too.
Sorry there's not currently a download available for ESP32... it's just a very work-in-progress bit of code that was the minimum possible to demonstrate it working. If you feel like building the firmware from source though, you can build it from that branch, and I can possibly look at making some pre-built firmware images available in a few days time when I've had a chance to make some example code and documentation. (Just trying to get the STM32 version merged first!).
That's a good question... my preference is for simplicity, in which case all ESP32 firmware includes BLE. At this stage there's not really any reason not to do that because there's enough code space. Maybe in the future we could make a trimmed down ESP32 firmware with some features disabled (including BLE).
I recently added support for board-specific firmware, which is mainly to support things like pin naming. But I guess we could have BLE and non-BLE variants of each board too.
Cool, so it sounds like you're looking to use the "central role". I'll try and remember to include temperature sensors as one of the example code / documentation. (I'm currently using a heart rate monitor example).
Re: bluetooth on esp32
Hi @jimmo, ok, I'm ready whenever you are to test the new BLE component on an ESP32.
I'm not by any means an expert programmer, but I have produced several successful ESP32 products, so I can provide feedback from a very practical application point of view. The BLE sensors we use are relatively simple, monitoring environmental conditions like temperature, humidity, and light level, and we love the fact that they run on button batteries for about a year.
The problem we're having with them is that the range is not great, so we want to make a powered ESP32 device that will convert the data to a WiFi signal that can be uploaded to cloud platforms, such as Blynk (via MQTT).
I would expect this to be a relatively easy thing to do (famous last words?), and something that many users might ultimately want to do.
Cheers, AB
I'm not by any means an expert programmer, but I have produced several successful ESP32 products, so I can provide feedback from a very practical application point of view. The BLE sensors we use are relatively simple, monitoring environmental conditions like temperature, humidity, and light level, and we love the fact that they run on button batteries for about a year.
The problem we're having with them is that the range is not great, so we want to make a powered ESP32 device that will convert the data to a WiFi signal that can be uploaded to cloud platforms, such as Blynk (via MQTT).
I would expect this to be a relatively easy thing to do (famous last words?), and something that many users might ultimately want to do.
Cheers, AB
Re: bluetooth on esp32
Thanks!
The PR was just merged. One important caveat is that it requires the newer version of the IDF which is currently in beta. So the default "stable" firmware won't have BLE enabled for now. However, I've asked Damien to add an additional firmware build target for IDF 4.x, so it should show up on the downloads page soon.
I'm working on documentation and samples now.
Re: bluetooth on esp32
Just downloaded and built the latest, and just to clarify, is it possible to enable bluetooth on this build or not ??
I can pull the latest IDF beta if necessary ??
I can pull the latest IDF beta if necessary ??
Re: bluetooth on esp32
From GitHub? Yes, as long as you're building with IDF 4.x (i.e. IDF commit 310beae373446ceb9a4ad9b36b5428d7fdf2705f )
Re: bluetooth on esp32
No go on my DEBIAN 10, I am using python 3...
.
Using previous IDF building is not a problem and no issue with pyparsing.
Code: Select all
make -j6 PYTHON2=python3
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
Building with ESP IDF v4
** ERROR **
EDP IDF requires pyparsing version less than 2.4
You will need to set up a Python virtual environment with pyparsing 2.3.1
Please see README.md for more information
Makefile:92: *** Incorrect pyparsing version. Stop
Using previous IDF building is not a problem and no issue with pyparsing.
Re: bluetooth on esp32
I just compiled it on my debian 10 machine. Here, python defaults to python3. I had to look into README.md and had to call:
pip install pyserial 'pyparsing<2.4'
Then it worked.
pip install pyserial 'pyparsing<2.4'
Then it worked.
Re: bluetooth on esp32
For some reason, the IDF 4.x needs this older version of pyparsing, whereas IDF 3.3 happily worked on newer versions. You will need to set up a Python virtual environment with pyparsing 2.3.1.
(My best theory for this is that it actually always used the older version but in 4.x they started using features that aren't available in pyparsing 2.4).
Anyway, you'll need a virtual environment.
(My best theory for this is that it actually always used the older version but in 4.x they started using features that aren't available in pyparsing 2.4).
Anyway, you'll need a virtual environment.
Code: Select all
cd ports/esp32
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install pip install -r /path/to/espressif/esp-idf/requirements.txt
make BOARD=GENERIC -j 16 deploy
Re: bluetooth on esp32
Thanks @Roberthh @jimmo;
pip install pyserial 'pyparsing<2.4' works for me
pip install pyserial 'pyparsing<2.4' works for me
Code: Select all
MicroPython v1.11-412-g2863dcdf4-dirty on 2019-10-08; ESP32 module with ESP32
Type "help()" for more information.
>>> import bluetooth as bt
>>> dir(bt)
['__class__', '__name__', 'BLE', 'FLAG_NOTIFY', 'FLAG_READ', 'FLAG_WRITE', 'UUID']
>>> dir(bt.BLE())
['__class__', 'active', 'config', 'gap_advertise', 'gap_connect', 'gap_disconnect', 'gap_scan', 'gattc_discover_characteristics', 'gattc_discover_descriptors', 'gattc_discover_services', 'gattc_read', 'gattc_write', 'gatts_notify', 'gatts_read', 'gatts_register_services', 'gatts_write', 'irq']
>>>