I’m iterating on the design of the Ladybug Blue Lite (LBL). The LBL measures pH and EC of a nutrient bath (used for hydroponics). Measurements are sent to an iOS app over BLE.
Instead of using the nRF51822 chip directly, I decided to use the MDBT40 BLE module from Raytac. I don’t know anything about BLE radios so it is best to leave it to a chip integrator that has been certified.
The goal of this post is to provide an overview of the schematic I used around the MDBT40 BLE module. There was stuff I didn’t understand/didn’t get right that I muddled through with the help of “those that went before” (see below).
Thanks To Those That Went Before
- THANK YOU to Nordic support! I am finding Nordic support – the company behind the nRF51822 – to be EXCELLENT. A HUGE shout out to Ketil Aas-Johansen. Ketil was able to clarify design mistakes I had made. He even checked out my schematic and Gerbers to make sure I got the design right with respect to the MDBT40.
- Another shout out to Martin Børs-Lind for the excellent (and kind!) answer he provided to my question about the AVDD. The code example he gives for enabling/disabling the DC/DC converter as well as turning on/off the BLE radio was extremely helpful.
- THANK YOU to Adafruit for their Bluefruit LE UART Friend and their excellent support forum. They have incredibly sharp folks (like ktownsend) who seems to be pivotal in the design and build not only of the hardware but firmware for the Bluefruits. Thank you for being so amazingly helpful. I totally recommend buying from Adafruit. Particularly if you are like me – learning about electronics.
- Chris Gammell’s excellent Contextual Electronics course and exceptional mentoring has taken me far in my currently two year journey learning electronics. While every day I delight in finding out stuff I didn’t know or – even more enchanting – totally misunderstood! – Not knowing/misunderstanding is better to take when there is a path to understanding which I feel Chris’s efforts have given me.
- I am incredibly grateful to the skilled folks who share their knowledge on forums and blog posts. It amazes me how much easier it is to figure stuff out than it used to be!
The schematic and layout Kicad files are located in this GitHub repository.
Here’s the current schematic for the MDBT40 on the LBL:
Simple, right? Yes. But I still managed to misunderstand some aspects…
Mistake 1: My Interpretation of AVDD
In a previous post, I interpreted the Analog voltage to supply power to the other ICs (like the op amps) on the board. Wrong. AVDD provides power to the BLE radio. This is EXACTLY what the nRF51822 product spec says it does, from Table 1 Pin functions:
I believe the reason I got confused was what I got out of reading the Power management section (3.4) of the nRF51822_PS v3.1.pdf. This section starts out by stating:
nRF51 supports three different power supply alternatives:
- Internal LDO setup
- DC/DC converter setup
- Low voltage mode setup
Oh how nice I thought….this chip does everthing…voltage comes in from the CR2032 battery and the nRF51 cleans it up for the rest of the circuit to use.
Um….No. What is perhaps obvious to you – but not me at the time – was this section was saying….when the BLE radio is transmitting or receiving, the radio’s power supply (AVDD) can be set up to use one of three different voltage regulators.
A challenge I faced was / is being overwhelmed by the documentation. As pointed out by Martin Børs-Lind in his answer to my question on the Nordic DevZone, the information about how the different regulators work is nicely covered in Figure 9 of the nRF51_Series_reverence_manual v3.0.pdf. Because the “goo” behind interacting with BLE is kept from me via the SoftDevice 110 stack, I was unaware of:
NRF_POWER->DCDCEN = 1;
NRF_RADIO->TASKS_TXEN = 1;
NRF_RADIO->TASKS_START = 1;
The radio_test example in the nRF51 SDK does use these.
My Current Understanding of the Radio’s Power Source
Perhaps yet another obvious statement. The Radio uses the AVDD power source when it is transmitting or receiving packets over BLE.
The simplest is the radio LDO setup. Note: there are other LDOs for system and peripheral as well as flash power. This is the configuration in the schematic above. I ended up using the LDO because it was the simpler than using the DC/DC Converter. A ~ 3V power source feeds into the AVDD. An internal LDO voltage regulator provides the expected power to the BLE radio.
The DC/DC buck converter sounded like the way to go as noted in 188.8.131.52 of the spec:
This feature is particularly useful for applications using battery technologies with nominal cell voltages higher than the minimum supply voltage with DC/DC enabled. The reduction in supply voltage level from a high voltage to a low voltage reduces the peak power drain from the battery. Used with a 3 V coin-cell battery, the peak current drawn from the battery is reduced by approximately 25%.
The things that need to be there for the DC/DC converter to work:
- an inductor and capacitor wired between the VDD and AVDD pins. Here is an example from the MDBT40 specification:
- the DCDEN register needs to be enabled (through firmware).
Figure 9 is an equally great visual of the radio DC/DC converter:
The other thing the images point out is the LDO regulators for the power needs of flash and the system. A separate topic on its own merits!
Figure 10 gives a visual of using a low voltage mode for powering the radio:
In this mode, an outside power source can be used to provide power to the radio. I’m not sure if the MDB40T supports this mode since there is a DEC2 but no exposed DEC1? I don’t plan to use this mode so I won’t investigate more right now.
Mistake 2: Confusion On Pin Outs
I didn’t understand what the MDB40T included above the nRF51822 – besides the BLE radio. For example, a requirement for the nRF51822’s radio to work is a crystal on the XC1/XC2 pins of the nRF51822:
The MDB40T does not expose these pins. However, all their reference circuits included a crystal on XL1 and LX2 (see the MDB40T reference circuit above). This made me think the crystal on XL1/XL2 was required, which is not true. The crystal on XC1/XC2 is provided by the MDB40T.
On The Other Hand
On the other hand, the MDB40T reference circuits all include a resistor on SWDCLK:
As Ketil pointed out to me: “The pull down resistor was only needed in the very first revision of the nRF51822. It’s been on-chip for quite a while now so you shouldn’t need it.“
Also I have gotten in the habit of sprinkling a bypass cap on any VDD. Yet the MDB40T reference circuits include a 1uF bypass cap on AVDD but not VDD. Ketil also clarified this for me: “There are 100 nF caps close to all VDD and AVDD pins on the module and these takes care of HF noise. But somewhere in your design you should have a larger cap, 1 µF is fine here. You can have 1 µF caps on all VDD pins if you like, no problem.”
- While RTFM definitely applies, I find it impossible to believe I will understand something so new without making the type of design mistakes I made above.
- I hope what I have learned will translate to other micro controllers. This makes me even more excited to design, build and program around the STM chip we’re using in Contextual Electronics.
- Nordic and Adafruit support are top notch. I will continue buying their products whenever possible.