429 NRF52 Bluetooth (BLE) Tutorial. Does it consume less than the ESP32? (Feather, XIAO, ItsyBitsy)

preview_player
Показать описание
The NRF52 chips from Nordic should be much better for Bluetooth Low Energy projects than the ESP32. Is this true? Can we use them with the Arduino IDE? And which boards are available? Let’s have a closer look.

Links:

The links above usually are affiliate links that support the channel (no additional cost for you).
If you want to support the channel, please use the links below to start your shopping. No additional charges for you, but I get a commission on your purchases to buy new stuff for the channel

Please do not try to email me. This communication channel is reserved for my primary job
As an Amazon Associate, I earn from qualifying purchases
#no#midroll#ads
Рекомендации по теме
Комментарии
Автор

Great video as always, Andreas! However, I don't concur regarding creating YouTube videos not being arduous - especially when you spend half an hour recording some demonstrations only to realize that you forgot to plug a microphone cable into the video recorder (which happened to me just yesterday). Would have loved to have measured my heart rate at that point, I'm sure it was well over the 63 BPM of calmness you manage to maintain!

Dronebotworkshop
Автор

Thanks Andreas. Long awaited video! The Adafruit core (also my favourite by far) is based on freeertos and has some interesting functionality. I think you should try out not suspending the loop but instead putting delay(xxx); in there which is the equivalent to a sleep mode. A little counter intuitive.
The XIAO BLE sense powers all of its sensors from gpio pins so pulling them low switches them off completely. This is the most interesting nrf52840 board out there because it actually takes care of those things and also uses a very low Iq LDO.
BTW the seeed core is weird: if you install 1.0.0 you get a ported version of the bluefruit library out of the box with all the examples, whereas the 2.x version does not include them.

insanitywolf
Автор

Great Video Andreas. I have been a maintainer of a BLE keyboard firmware ever since the days of the nRF52832. When I first got into it, I did try to program with the Nordic SDK and after hours of work, I still couldn't even get a LED to flash. I then turned to the Adafruit nRF52 board support package and I was able to get it working within minutes. Since then, I have been creating keyboards and even extended my firmware to the nRF52840. It's really a shame that Nordic doesn''t support the maker community and that Adafruit will only accept boards that they make or sell to be as part of their BSP. (This is quite understandable from a support point of view). However, this only helps fragmenting Arduino Support for the nRF52840 boards into several forks and really doesn't help for maker adoption. The nRF52 chips are amongst the best (if not THE best) for power consumption.

To get power consumption down with the Arduino IDE, you need to do some coding black magic (minimum would be to make sure to use a delay in the main loop; if you use a loop) and measure, measure, measure. Apparent small changes in code, sometimes makes big differences in power consumption. One has to remember that the CPU when running non-stop would use about 6mA (from the datasheet) and the radio about 20mA (From the datasheet). Anything to minimize CPU time and radio time will help bring power consumption down. There are also some "magic settings" from the softdevice that will also influence power consumption. These aren't documented in the Adafruit nRF52 library but are buried in Nordic's documentation.

Adafruit's implementation uses FreeRTOS to manage the main loop and any other tasks one wants. Delay for the Adafruit nRF52 library isn't a true "delay" but more of a yield of the currently running task to other tasks. If the RTOS doesn't have any other tasks to process, it will go into low power mode until the next "tick" and see if it need to go back at running the delayed task again. If I remember well, the "Idle" task does have the necessary code to put the CPU into idle state (low power) but the default might not be what everyone wants. The defaults that Adafruit has implemented are reasonable for most applications but are not necessarily for everyone. A lot of the tweaks one would need to do to get it running exactly as they want aren't exposed by the library but many settings have been exposed since I first started working with it.

To make fragmentation even worse, support for the nRF52833 (a chip with USB - like the 840 but with the flash and ram of the 832) isn't there yet, even if the chip has been out for a while. The complicating factor to get support for it is Nordic's different softdevice versions. From what I remember, the update from 6.x to 7.x changed a few things and none of the Arduino libraries I have seen supports the 7.x version - which is the version needed for the 833 and the newer, more advanced BLE features some people have been asking about.

jpconstantineau
Автор

Thanks for the video Andreas and great timing for me as I have recently started experimenting with the NRF52840 development kit. As others have stated, the learning curve is very steep, but I finally managed to build a thermometer beacon. It transmits every 5 seconds using the highest power setting (+8dB) and is drawing an average of 34µA with only the most basic power saving features enabled. I'm sure it can go a lot lower with further tweaking.

garytrehair
Автор

Nordic doesn't really support Arduino, their focus is both on their own libraries and the Zephyr RTOS. The Arduino BLE support is built by third parties (like Adafruit) on top of the closed source Nordic "softdevice" (essentially RTOS core), AFAIK. I have personally found this setup extremely buggy and borderline unusable. Worse, it does not expose a lot of important functionality.

If you want to really get control of what the SoC is doing and minimize power consumption, you need to use either Nordic's SDK directly (and then you can use other protocols too - e.g. Zigbee, Ant/Ant+, NRF24L01+ compatible Shockburst ...) or Zephyr. Don't expect Arduino to be able to do that, it is set up for making the common use case simple, not for allowing to squeeze every bit of performance out of the hardware.

Nordic's documentation is excellent, BTW - but do expect a really steep learning curve because there is no "handholding" with something like BLE for you there - you get the control of literally everything, including the crypto required for establishing the connection. So it can be quite overwhelming at the start.

JanCiger
Автор

This is one of the best introduction video on how to plan and decide which uc and board to select when building a low power solutions.

aacasd
Автор

That's why my Nordic boards are still unused and waiting for a rainy day when I am very bored and have lots of time.
The resources are rather thin.
It is such a lot of work to get the stuff working, hence me not having bothered with it yet.
Your video on the subject is good, it illustrates a path one could follow when there's a need to do one of these types of projects.

Uncle-Duncan-Shack
Автор

Thank you for all your videos, especially the ones on antenna tuning!

austinhiggs
Автор

Awesome tutorial this will be a good reference to start programming this processor. Nordic has the leadership in BLE field. Generally, it has higher price compared to ESP32 though.

usefulelectronics
Автор

Always interesting to see other people using these chips. I started getting into Segger embedded studio to program them and have got rather out of my depth. Partly because I'm determined to use ANT+. One day maybe it will make sence and the benefit is the Arduino IDE now looks simple.

Ed.R
Автор

BTW, one more board one could try is an ESP32C3. They are now even available in the ESP01 form factor. Before I used the Xioami thermometer I built a WiFi solution with UM's TinyPico and after that ran out of power after 90 days I tried a TinyS2 which is still running after a 100 days, just to see how long it will run. Both had long intervals (6min) between readings and only switched on Wifi in case of a temperature change (sensor was a BME680 and now and SHT30 powered via GPIO, battery was 1000mA Lipo). My next try would have been an ESP32C3, which may give better results with BLE instead of WiFi).

drmocm
Автор

2 years ago, I investigated nrf52840 boards to make a low power data logger (for rain gauge first) and use BT to unload data (with a goal of 3 years autonomy, at list with a 1/2AA LiSOCl2 battery). Best arduino support seems provided by adafruit but should also apply to sparkfun products (I should check the whole list in your video). Only Adafruit nrf52840 boards provide additional memory available for user, up to 2 MB. I made a first device with the Feather board. Indeed, power consumption at idle (without BT) is between 600 µA and 1 mA, due to the RGB LED that is drawing 600 µA off. I will try to unsolder that LED, which may be more accessible on ItsyBitsy than on Feather. If I can go bellow 100 µA, it should be enough to go for 3 years operation. Otherwise, I may apply other tricks like bypassing the LDO and battery voltage divider (and go for coin cell???).

ericsibert
Автор

As always, thanks for your thorough research into the nRF solution. It is a good tutorial to reference in the future!

Average_Geo
Автор

I've been using the Arduino BLE Sense. It has a number of fun sensors. At the moment I convinced it that it is a Bluetooth mouse that moves the pointer based on acceleration values

CorvanEssen
Автор

I was just thinking about building a BLE thermometer with an NRF58240, but then I saw the Xiaomi LYWSD03MMC thermometers which you can flash with the ATC firmware and which then have very low power consumption. I got 4 for $27 and use them with OpenMQTTGateway, even the seeed board would be much more expensive than that.

drmocm
Автор

Aside from the ongoing chip shortages plaguing everyone, I've found Lady Ada's operation has been making things incrementally cheaper over the last few years. I was shocked to learn her company was offering an ESP32 (bare module, but still) for US$4 a year or so ago. With a warehouse and staff in the middle of Manhattan, New York City, I don't know how she manages to balance this. Maybe her manufacturing scale has just become that large? It's an engineering marvel in itself. 👍️

McTroyd
Автор

the only problem is: chip only (NRF52840) costs around 9$ while ESP32 chip cost 10x less. So for particular well thought project it is ok, but for day to day thinkering... quite expensive.

zyghom
Автор

Basically Nordic provides documentation and libraries for their chips. However unlike arduino the learning curve is very steep. It is easy to run demo, but once you need to run your own code it is pretty hard to debug. Because ble rf core is separate peace of code.

MSP_TechLab
Автор

First thought for reducing power is to reduce tx power in code and further stretch advertising interval.
Use board with rtc xtal installed AND properly configure it from code.
Use lowest permissible power mode whilst ble beacon still works.

For those who don’t want to use softdevice, alternative exists:
Riot RTOS support nrf thru Apache Nimble,
Zephyr RTOS has direct NordicSemi contributions for ble drivers.

thanks
Автор

Sorry to jump in but was sitting in the front row and missed if you have ever done a video or the T-PicoC3 from LiilyGo? Thank you for your great videos. Go solar!

MaxGoddur