The nRF51822 comes loaded with eight configurable ADC channels. Why not take advantage of them? I am evolving the design of the Ladybug Blue Lite to use the nRF51822’s ADCs instead of the ADS1015 + MUX. In the previous plan, six op amps were used. One for VGND, one for pH, and four for EC (one for Wien Bridge, one for the Gain loop, and two for rectification). Then a MUX switched between VOUT and VIN signals. Removing the MUX means two more op amps are needed to participate in rectification. Now, instead of a MCP6242 and MCP6244, the Ladybug Blue Lite will use two MCP6244’s. Another benefit is the reduction in complexity. I see the complexity reduction to be highlighted most in the firmware. Previous to this change, I used a timer to give about 10 seconds wait between measuring VIN and VOUT to allow the effect of switching signals to work it’s way out of the circuit.
The change to the BoM is:
Ladybug Blue Lite with ADS1015:
- no ADS1015
- no MUX
- exchange MCP6242 for MCP6244. The MCP6244 costs $.68. $.68 – $.43 = $.25
- one additional MOSFET: $.17
The goal of this post is to understand and evaluate the nRF51822’s ADC for pH and EC measurements.
Thanks to Those That Went Before
I am truly grateful to:
- Chris Gammell – I continue to learn A LOT from his Contextual Electronics course. Recently, the “Full Charge Ahead” section was a great introduction to designing and laying out LiPo batteries. Chris is also an amazing mentor.
- Ryan of Sparky’s Widgets has made it so much easier for us to sense pH and EC readings. I started with Ryan’s schematics and design of the minipH and miniEC boards and have evolved my designs from there. The work I am currently doing proudly stands on the shoulders of Ryan’s. Thank you.
- Adafruit for their attention to learning and support. There is so much great stuff on their site!
- OSH Park for their excellent PCB fabrication service and hiring such terrific folks that really care about the support.
What is Good Enough
I am not concerned with sampling rate. But resolution is a factor. The nRF51822’s maximum resolution is 10 bits. The ADS1015 has a 12 bit resolution. Is the loss in resolution going to negatively affect my goal of pH and nutrient adjustment? It shouldn’t. In an earlier post, I noted the minimum resolution for pH is 8 bit. With EC, the VIN, VOUT, and VGND are all measured. It should be fine for the resolution to be 10 bits.
Running a Test
To see if I can get expected results, my first test will measure VGND when the power source = 3.3V. VGND measures 1.6V. The test code I used (ADC_Simple) is available at this GitHub location. It is zipped into an Eclipse project (Note: There are some hard coded paths that you would need to modify – mostly in the makefile).
The ADC HAL SDK documentation notes the following settings for the default configuration:
- 10 bit resolution
- 1/3 prescaling
- internal 1200mV VREF
- 10 bits = 1024 steps (0 to 1023)
- reference = 1200mV
- post-scale factor = 3
Calculating the Resistance
- VOUT relative to VGND = 2463 – 1584 = 879mV
- VIN relative to VGND = 1731 – 1584 = 147mV