Tags

,

Up until now, I have been using the MCP3901 (previous post).  I used it because it was what we used in Contextual Electronics.  Chris had stepped through the data sheet and also how to code to the MCP3901’s SPI bus.  It is a very nice ADC but not the right ADC for the pH and EC circuits I am building.  It is analogous to the type of transportation I might take to a place about 20 miles from where I am.  I could go in a jet plane or I could go in a compact car.  Both would get me there.  However, the jet plane is overkill for the job I need to get done – get 20 miles to and 20 miles back.  The MCP3901 is like the jet plane.  It is powerful.  It is feature rich.  But it is overkill for the goals of getting a digital value of the pH, temperature, or E.C. voltage – “good enough” so that a pump can be turned on and off in order to adjust a nutrient bath to great hydro growing conditions for vegetables and herbs (fresh lettuce – every day – in my house – YUM!).  My current plan is to use TI’s ADS1015 for the Healthy Shields.

The Goal

At the end of this post the ADS1015 will be included in the EC proto test (previous link).  An arduino sketch will take in readings from the ADS1015 and convert them to digital voltage values.  The Vrms value from the scope for the EC voltage going into the ADC will be compared to the digital value read from the ADS1015.  This will give me an initial feeling for how well the ADS1015 works as the ADC for the E.C. and pH circuits.

Thanks to Those That Went Before

I am always thankful to Chris Gammell.  Through Chris’s Contextual Electronics courses and mentorship, I am able to realize a passion for building electronic circuits.  Something I didn’t realize was so fascinating.

I am also thankful for Adafruit.  There are so many things Adafruit “gets right.”  I’ll highlight just two of the many: 1) their close relationship with their customers is extraordinary.  I enjoy the weekly “Ask an Engineer” show.  This week I also benefited (OK – they got my money!) with the 10% off code and bought their USB microscope.  2) they vet and provide libraries as well as schematics/layouts for many interesting components – like the one I use in this post, the ADS1015 breakout board.  Lady Ada – you are inspirational.  Thank you.

Using the ADS1015

The ADS1015 has some great features:

  • two differential inputs so that measurements can be relative to VGND.
  • a built in VREF – as I started playing around with different ADCs, an internal VREF is great because it is integrated in.
  • 12 bit resolution.  The 24 bit resolution offered by the MCP3901 is overkill.
  • A simple I2C interface with an Arduino library already written/tested by Adafruit.  Access to the ADC data is far simpler to code to than when accessing ADC data on the MCP3901.  The MCP3901 is more complex due to being a SPI bus, 24 bit ADC values (which don’t align to an int or long), many features that lead to many configurations and different calculations that need to be understood, set, and manipulated.
  • A PGA so that I can tighten the number of steps to the Vpp signal range of the pH or thermistor signals.
There are other features. The ones listed above are relevant to the pH, thermistor and E.C circuits. 

 Adafruit sells an ADS1015  breakout board.  Adafruit does a terrific job when they sell a breakout board.  They provide an Arduino library (here is a link to the library for the ADS1015) as well as a learning module.  Even better, Digikey carries Adafruit’s ADS1015 breakout board (link)!  The list price ($9.95) is the same.   I say “even better” because I get a Digikey order in 2 days with a minimum shipping cost.  Adafruit deliveries take about a week and shipping costs are much higher.

The Test

The test will add Adafruit’s ADS1015 breakout board to the E.C. proto test setup and see how close the Vrms value of the ECv (Vout) of the analog circuit is to the digital reading from reading the ADS1015 through an Arduino sketch.

I am using a solution that measures 3260PPM TDS on my inexpensive TDS meter.  The challenge I am finding is this meter can deviate in PPM value by +/- 200 PPM.  So the results for TDS/E.C. won’t be accurate.  However the mapping of the ECv to the ADC volts should be very close.

 Here is an image of ECv (Vout):

ECVout1stADS1015Test

The Vrms = 906mV.  

I attached a wire from the ECv of the analog circuit to the AIN0 of the ADS1015.

TestSetupECvVGNDECv

Whoa! What a Mess of Wires

 

 I attached the VGND wire from one of the wires of the pH probe (coming off the BNC) to the AIN1 of the ADS1015.  I then ran Adafruit’s example sketch for differential conversion.  I left the gain (see Adafruit’s section on adjusting the TDS1015’s gain)The column labeled LSB = 3mV shows results for 50 consecutive samplings.

I then set the gain so that each step (LSB) = .5mV and read 50 consecutive samples.

  LSB = .5mV LSB=3mV
  880.5 888
  920.5 903
  911.5 921
  899.5 918
  924.5 891
  881.5 885
  932 912
  890.5 924
  919 891
  907 897
  907.5 933
  905.5 897
  900 891
  915.5 936
  895.5 894
  917.5 909
  894.5 921
  914.5 873
  900.5 930
  907.5 888
  911 915
  901 894
  923.5 909
  879 894
  935.5 918
  890.5 885
  911 933
  909 873
  896.5 921
  930 906
  883 900
  915 927
  909 879
  894.5 912
  934.5 912
  887 876
  906 912
  924 918
  883.5 882
  905 903
  922 933
  882.5 903
  904.5 885
  924.5 912
  890.5 924
  902.5 900
  932.5 882
  909 909
  880 936
  907.5 903
Average: 906.2 905.2
StDev: 15.7 17.7
Count: 50 50

When the LSB = 3mV, the range of values ECv can have are +/- 6.144V.  This is a far greater range than an ECv reading will receive.  +/- 1.024V should be more than enough range, meaning the LSB = .5mV will give a slightly more accurate reading as shown in the table above.

The variance in values between readings is not surprising given the Vrms jumps around a little bit.  But the average of 906.2mV for LSB = .5mV is well within expectations for the Vrms pictured above (906mV).

These are encouraging results.  The ADC conversion seems to be close enough to the Vrms going into the ADC.  Clearly more testing is needed to evolve the accuracy of readings.  I am happy to have been able to walk through the analog and digital aspects of the EC circuit.  However, the wires all over the place point to places where inaccuracies as well as unconnected wires can cause havoc in the results.  

 

 

Thanks for reading this far.  I hope you find many things to smile about.

Advertisements