PLease check out my DIY CNC mill & drill pictures and PROXXON MF-70 conversion on my music site. I will be transfering information very soon.
PH-Probe
Written by Administrator
Tuesday, 24 June 2008
This is a PH-Probe or PH-Meter .It reads PH- Values from 0 to 14 and converts it to the right voltage 0-5V for your MCUs ADC. The original design was predestined to be used for a LCD Display. I took parts of the interesting schematics and converted it to my use. This wonderful project is necessary for the Aquarium Controller V2 and will be implemented very soon.
The first version here is kind of bulky and big since it was milled with the PCB CNC mill & drill. The second version will be on SMD basis. And will be a daughterboard to fit on the Aquarium Controller.
here is the SMD version.A sub-module for the aquarium controller.
Here is the program in MikroBasic that reads and translates the voltages into a Text that can be displayed by the LCD.
sub procedure PH_Read()dim CurrentValue, LastValue as word
Text asstring[5]
rrrr as real 'float
calib asbyte'Lcd_Init(PORTD) ' initialize (4-bit interface connection)'Lcd_Cmd(LCD_CURSOR_OFF) ' send command to LCD (cursor off)
Lcd_Cmd(LCD_CLEAR)' send command to LCD (clear LCD)'LCD_Out(1,1,"PH") ' print string a on LCD, 1st row, 1st column'Delay_ms(2000)
LCD_Out(2, 1, "PH:")' print string a on LCD, 2nd row, 1st column'Lcd_Out(2, 14, "PH") ' Write "V" out of the loop, since it never changes
LastValue = 0' Inititalize LastValue
CurrentValue = ADC_read(1)' get ADC value from channel No.2if CurrentValue <> LastValue then' perform conversion only if they are different
rrrr = (CurrentValue*(14000.0/1024.0))' 5 Volts over 1024 levels (10-bit conversion)
CurrentValue = rrrr ' This assignment will convert float to word
CurrentValue = CurrentValue - 40
MyWordToStrWithZeros(CurrentValue, Text)' Convert word to string with zeros (right justified)'Text[5] = Text[4]
Text[4] = Text[3]' This sequence will
Text[3] = Text[2]' insert the "." character
Text[2] = Text[1]' just after the first char in Text.
Text[1] = "."
Text[5] = 0' The string always ends with 0
PHText[2] = Text[2]
PHText[1] = Text[1]
PHText[0] = Text[0]
LCD_Out(2, 4, Text)' Write formatted text
LastValue = CurrentValue ' Equalize them, so next time we do not write the same valueendifdelay_ms(3000)end sub