How to use the Bluetooth module with MicroPython?

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
User avatar
ozigzagor
Posts: 4
Joined: Wed Jul 08, 2020 5:12 am

How to use the Bluetooth module with MicroPython?

Post by ozigzagor » Thu Jul 09, 2020 10:48 am

I'm currently using the HC-05 (ZS-040) module and have very little idea on how to work it. How do I set up this Bluetooth module so that I can connect to it via my computer and send my chip commands? I know this won't get many replies, but bear with me. I'm not looking for a thorough explanation: I just need a quick idea as to where to look at for learning this stuff. Any reply is welcome. (◕‿◕)♡

I've tried making a serial connection, but couldn't get beyond that as this serial connection gets in the way between me, the REPL and the chip itself. If somehow I could still maintain the USB's REPL connection while still receiving from and transmitting to the Bluetooth module, everything would be super easy. So, again, any reply regarding that is very welcome as well. Thanks! (≧◡≦)

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

Re: How to use the Bluetooth module with MicroPython?

Post by jimmo » Thu Jul 09, 2020 12:43 pm

This module provides a BT (2.0, not BLE) RFComm UART (i.e. a serial port). It's been several years since I last used one of these and the experience was quite frustrating, but it can be done.

The idea is that you configure it by putting it into the AT command mode, then there's a bunch of different commands you send it (from MicroPython) to configure it. Then your computer will be able to find it as a Bluetooth device, and create a virtual serial port.

I think the default settings mean that it works "out of the box" though, so you might be able to use it directly without any configuration. Here's an example https://github.com/KipCrossing/PyBoard-HC05-Android

This is a pretty good guide -- https://core-electronics.com.au/tutoria ... dules.html

Post Reply