Fab Academy 2015

Fab Academy

How to Make Almost Anything...


Input Devices

Weekly Assignment

This week assignment consists of measure something, add a sensor to a microcontroller board that you've designed and read it. In my case I will measure the pH of water, for this I create a board that adapts the signal that gives me the pH probe. The adapted signal will be send it to my board "Extreduino".

pH Probe

This sensor can output signal which corresponding to the hydrogen ion concentration that measured by PH electrode. Because it can be directly connected to controller,and then you can observe the PH value at any time.

The problem with this sensor is that it works with very small signals and has a very large impedance, for this reason I create a board that fits the signal and even allows adjustment via a potentiometer.

pH Probe

Previous design

For the previous design I have consulted many ways for signal amplification, by the type of probe (low voltage, high impedance). I opted for the amplification of the signal in two stages, the first stage is fed with a signal of +-5 volts, and the second stage with a signal between 5 and GND (signal adapted to Extreduino).

pH scheme

The circuit is composed of three chips, two operational amplifiers and an integrated circuit that inverts the input signal, with this integrated I get a negative voltage of 5 volts. The first operational features a potentiometer for adjusting the signal.

Board

This is the resulting plate as shown, has a reduced size despite the BNC connector, this BNC connector is indicated when working with signals that are prone to noise, be careful because when connecting the probe can be damaged the traces, in the future this connector, you will screw into a box, preventing it may damage the traces to connect the probe.

pH Board

Making the board

For the construction of this board I have not done anything out of the ordinary, I have 3 files generated in eagle, traces, outline and holes, for holes and traces I used 1/64 inch mill and for the outside 1/32 inch mill.

pH Board

These are the files of traces, holes and outline.

pH TracespH DrillpH Outline

Programming the board

Testing program for the pH probe is very simple, the program takes 10 readings of the probe and makes an average to obtain a smooth value. Then converts it to a pH value and displays it on the serial monitor.

			/*
			# This sample codes is for testing the pH meter
			# Date: 12/04/2015
			*/

			#define SensorPin 0          //pH meter Analog Input 0
			unsigned long int avgValue;  //Store the average value of the sensor feedback
			float b;
			int buf[10],temp;

			void setup()
			{
				pinMode(13,OUTPUT);  
				Serial.begin(9600);  
			}
			
			void loop()
			{
				for(int i=0;i<10;i++)       //Get 10 sample value from the sensor for smooth the value
				{ 
					buf[i]=analogRead(SensorPin);
					delay(10);
				}
				for(int i=0;i<9;i++)        //sort the analog from small to large
				{
					for(int j=i+1;j<10;j++)
					{
						if(buf[i]>buf[j])
						{
							temp=buf[i];
							buf[i]=buf[j];
							buf[j]=temp;
						}
					}
				}
				avgValue=0;
				for(int i=2;i<8;i++)                      //take the average value of 6 center sample
				avgValue+=buf[i];
				float phValue=(float)avgValue*5.0/1024/6; //convert the analog into millivolt
				phValue=3.5*phValue;                      //convert the millivolt into pH value
				Serial.print("    pH:");  
				Serial.print(phValue,2);
				Serial.println(" ");
				digitalWrite(13, HIGH);       
				delay(800);
				digitalWrite(13, LOW); 
			}
		

Test and calibration

It is very important calibrate the pH probe, this requires creating several water samples having a known pH, I bought some solutions to create samples of 4.01, 7.00 and 10.01. These solutions must be discharged into deionized water and removed until dissolved. The pH changes very easily with temperature, so it is necessary to take measures water temperature to know that pH must have, is very difficult to obtain pure samples of pH, so that the adjustment will be made in terms of the three samples (by averaging).

pH Solution

pH Samples

Source Files