UART BLE Module?

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
Nelsyv
Posts: 4
Joined: Wed Jan 27, 2016 2:26 am

UART BLE Module?

Post by Nelsyv » Wed Jan 27, 2016 2:53 am

Has anyone tried using one of these Bluetooth LE modules with a PyBoard?

https://www.adafruit.com/products/2479

It looks like it would be an excellent way to add some sort of wireless connectivity to a PyBoard, as it's a very small form factor and it connects using UART; and BLE uses such low power that it would last much longer on a battery than many other wireless protocols.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: UART BLE Module?

Post by pythoncoder » Wed Jan 27, 2016 7:16 am

If I might suggest an alternative, you could use the officially supported nRF24L01 module. There's a driver in the source tree (under drivers). I've posted code aimed at making a very simple point-to-point link with a pair of these https://github.com/peterhinch/micropython-radio.git. By only powering up the radio when required I have an application designed to run for at least a year on 3 AA cells.
Peter Hinch
Index to my micropython libraries.

Nelsyv
Posts: 4
Joined: Wed Jan 27, 2016 2:26 am

Re: UART BLE Module?

Post by Nelsyv » Thu Jan 28, 2016 3:37 am

pythoncoder wrote:If I might suggest an alternative, you could use the officially supported nRF24L01 module. There's a driver in the source tree (under drivers). I've posted code aimed at making a very simple point-to-point link with a pair of these https://github.com/peterhinch/micropython-radio.git. By only powering up the radio when required I have an application designed to run for at least a year on 3 AA cells.
I really like the library you have there. For my project, I want to try to use bluetooth to connect a pyboard to my android phone, which would then send/fetch data from the internet over my data connection (I'm sure I could figure out how to write up a very simple android app to facilitate this on the phone's end). Since my phone is backwards compatible with earlier versions of bluetooth, I could use a non-BLE module (like the nRF24L01) to connect. I guess I'll have to take a deeper look into how bluetooth works to see if simply turning the blueooth radio off in between connections would be effective for my situation.

One question: when you quote your project as having a year's-worth of power from 3 AAA's (~3000mAh according to google), how often do you have the radio on? Once a day? Once an hour?

Either way, thanks for the tip! :)

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: UART BLE Module?

Post by pythoncoder » Thu Jan 28, 2016 5:54 am

The nRF24L01+ is incompatible with any version of Bluetooth. Bluetooth uses frequency hopping and requires specially designed radios. (To the best of my knowledge - I'm no expert).

My project has three Pyboards communicating with a central one. All boards wake up hourly. The outlying boards have unique one minute time slots in which they attempt to link to the central unit: this avoids contention. Outliers are synchronised to the central one on every data exchange so clocks are never more than a few seconds out. Under normal conditions the outliers wake in a specific minute after the hour and the central one (with an e-paper display) wakes for four minutes per hour. Under poor conditions the outliers will make further attempts to communicate in subsequent permitted time slots; the process will continue for up to 15 minutes before all units abandon the attempt until the next hour. This would obviously impact on consumption but in practice even the most distant unit usually communicates on first attempt and immediately shuts down: an uptime of a few seconds per hour. All RTC's have backup batteries so the AA cells can be replaced without loss of sync. The outliers are not particularly easy to access so changing batteries on these is more of a chore than on the central unit in my office. The central one can also be woken with a pushbutton to provide a second screen of data.
Peter Hinch
Index to my micropython libraries.

Nelsyv
Posts: 4
Joined: Wed Jan 27, 2016 2:26 am

Re: UART BLE Module?

Post by Nelsyv » Thu Jan 28, 2016 8:02 pm

pythoncoder wrote:The nRF24L01+ is incompatible with any version of Bluetooth. Bluetooth uses frequency hopping and requires specially designed radios. (To the best of my knowledge - I'm no expert).
My mistake, I did a quick googling of nRF24L01 and did not read close enough to enough to note that it's a simple 2.4 GHz radio, not a version of Bluetooth 2. Oops! :o
I suppose your solution works well for wirelessly interacting with other PyBoards, but mine will have to use a standard WiFi or Bluetooth connection to be able to connect to the existing hardware in my smartphone. (And due to the high power draw of WiFi on both ends, I'll probably end up using some iteration of Bluetooth ¯\_(ツ)_/¯ ).

Turbinenreiter
Posts: 288
Joined: Sun May 04, 2014 8:54 am

Re: UART BLE Module?

Post by Turbinenreiter » Thu Jan 28, 2016 8:16 pm

The nice thing about UART Bluetooth modules is that they are pretty easy to use. It's a simple UART devices, so just hook it up to RX, TX and Power. The little interface they have is simple AT commands that are noted in the datasheet.

Really can't go anything wrong with it.

Post Reply