, ,

In a previous post, I discussed reducing prototyping time by using the services at my local hacker space, Metrix:Create.  I’m excited to discuss testing of the pH proto board that Metrix:Create fabricated for me.

The Goal

The goal of this post is to walk through the gotcha’s and successes in testing the pH proto board.  

Thanks to Those That Went Before

Each day there is much to be thankful for.  I am continually thankful for Chris Gammel.  The journey to my current skill at electronics would be monumentally more difficult without taking Chris’s Contextual Electronics course.  Chris’s guidance, knowledge is unbelievable.

Thanks to Metrix:Create for providing a space, services, and tools to do stuff like these proto boards without me having to know much about the process.  While at the same time Lauren (the person who made the proto board) walked me through each step.  I learned a lot from her discussion of the process and watching the machines in motion.

Thanks to Osh Park for the exceptional quality and service building low quantity PCBs.  

Design and Layout

Kicad files for the proto board are located in this GitHub repository.

Both the pH and EC circuit use an ADC.  To save costs, I decided to put two separate circuits on the pH proto board:

  • the pH circuit that takes in a voltage value from a probe and sends it through an op amp in preparation for the analog -> digital conversion.
  • the ADC that converts the analog voltage into a digital value so the Arduino can figure out the mapping of the voltage value with a pH value.
I am focusing on just the analog part of the circuit and the conversion to digital.  Other aspects of the Healthy pH Shield, such as the pumps and voltage regulation is not included.  These have already been tested and work as I expected.
Perhaps a negative aspect of using proto boards is the layout is different than what the final layout will be.  I have been focusing on both design and final layout.  I actually see this negative aspect as a huge positive. For example, I do not focus on better/best ways to handle power/ground paths.  A critical and time consuming aspect of the final board layout but not the priority when connecting the components into a test circuit.  The proto board layout is more like a bread board layout.
Proto Board Layout

Difference Between an Osh Park PCB and a Proto Board

Proto Board
A positive side effect of doing a proto board was working with the differences between this proto board and the more refined PCBs I get from OshPark was the opportunity to refine soldering skills.  With the proto board:
    • The copper wires are exposed.  It is much easier to connect two wires with solder that shouldn’t be.  I got great practice in using my DMM to test connectivity as well as in solder removal techniques.  I have been trying different temperatures for the solder iron and techniques when soldering and de-soldering.  Techniques I picked up after asking for advice:
      • (link) OOPS! I tore the copper: comment/advice:  what happens is the epoxy holding it down gets damaged, then the copper itself simply tears, as it is extremely thin – typically 35µm.The surface tension of the solder seems to be strong enough to tear it when you’re moving the iron around!
      • (link) OOPS! I melt the material around the plastic:   Counter-intuitively, this is usually caused by the iron being too cold, forcing you to take a long time to do each joint.A sufficiently hot iron can consistently do a good joint in about 1 second.I never run my iron below 350°C.  I am now setting both the reflow and iron at 360˚C and applying heat for just a second or two.  So far, this technique is working much better.
      • stay away from VIAs.  At least at this time – this process of rapid prototyping doesn’t include plating the VIAs.  VIAs require connecting copper layers, typically by soldering a piece of wire through the VIA drill hole.  This video goes through a few techniques.  

Fixing blunders early on

After making D’OH blunders on part footprints (see my embarrassing mess up with the barrel jack), moving forward I will print out the copper layer that has parts on it.  In this case, I only use the front copper.
Front Copper Layer
I can easily print out the front copper Gerber file from the version of Kicad I am running.  Armed with the print out, I then place the active parts (no need to place capacitors and resistors – I stick to an 0805 footprint).  YIPPEE!  I found a footprint that was incorrect and fixed it immediately :-).

Design Changes


I have replaced the MCP3901 ADC with the MCP3221 (data sheet).  After experimenting with the MCP3901, it became clear to me that the capabilities of this ADC far exceeds my needs.  While it is great to have 24 bit resolution and programmable op amps, the experience I seek of simply reading the pH and adjusting the pH can be handled by the MCP3221.  I chose the MCP3221 based on a query for an ADC on Parts.io, Ryan’s (Sparkys Widgets) use in the minipH, Microchip does an excellent job documenting the serial communications between its chip and a master (like the Arduino).
I am very glad I made this switch.  The firmware that needs to be written is far (far!!!) simpler.  Talking to the MCP3221 is simply a matter of figuring out what address the device is at.  Everything else is taken care of by Arduino’s Wire I2C library.


When I first started exploring a pH circuit, I was not sure a VREF would be needed.  Worst case, perhaps I could use Arduino’s VREF.  As my exploration and electronics practice evolved, I became convinced a VREF is important to the design.  This I feel is particularly true given the small range of pH voltage values (+/- .415V).  The MCP3901 has an internal VREF.  The MCP3221 does not.  I initially decided on a 3V VREF.  The decision was based partially on the MCP3901’s lower VREF and partly on SparkysWidgets’ minipHv3_2 schematic (GitHub location).  Alternatively, I could choose the more conventional 4.096V VREF.  This voltage works well for a 12 bit ADC since 12 bits means there are 4096 steps.  4.096/4096 makes each step a nice even 1mV (a step is also referred to as an LSB size).  I thought given the small voltage values to be converted, if a 3V VREF was used 3/4.096 provides a great granularity per step at .73mV.  Although 3/4096 does not divide evenly.
Simpson DOH
My D’OH moment was not paying attention that the V+ pin of the MCP3221 is also the VREF pin. Unlike the MCP3901, the MCP3221 does not separate out the VREF.  In order to use a 3V VREF, I would have to use the power supply of the Arduino for the I2C wires.  A Sparkfun article on logic levels shows the minimum/maximum values for HIGH and LOW voltages on input and output.  



An Arduino pin will send a 1 at a voltage greater than or equal to 4.2V.

The MCP3221 data sheet recommends a 4.096V reference.  


…but then I got to thinking (which could be a mistake!) that given an voltage output HIGH from the Arduino has a minimum voltage of 4.2V, if VDD = VREF = 4.096V, isn’t the VREF/VDD too low?  I tested the VDD with my bench power supply to see how low the voltage can go before the SDA line can’t talk with the MCP3221 when the Arduino is on one power supply and the MCP3221 is on another.  This turns out to be 3.7V.  So a VDD = VREF = 4.096 will work when the MCP3221 is on a separate power supply.  I guess the circuit inside the MCP3221 differentiates between the I2C, the rails, and the analog -> digital conversion.  How?  I have no idea. 

Initial Test Results

I used a POT hooked into a voltage divider to feed in various voltage values into the pH circuit which then was sent to the ADC for conversion.


Luckily, the design supports removing the VREF and using the bench power supply directly as the power supply.  My DMM showed I was getting 5.06V of regulated power.  The conversion of an ADC reading to millivolts is:

float mV = (((float)adc_result/4096)*5.06)*1000;

DMM ADC (avg >= 20 values) Difference
504 502.65 1.35
41.1 34.21 6.89
809 805.69 3.31

The biggest difference , .007V happened at a very low incoming voltage.  This margin of error is small.  I assume numbers will improve once a VREF is added.


Off to more testing…and figuring out stuff about the circuit I have yet to comprehend because of changing the ADC…


Thanks for reading this far.  Please find many things to smile about.