Sunday, September 20, 2009

pHduino Firmware v04 released

Again, one more pHduino firmware release. Two main features: pH alarm, to warn when the pH is out of the normal range, and save parameters in the Arduino EEPROM memory, to recover the last configuration after a reset or a power off.

Changelog v04_20090920
  • Changed file name from phduino.h to pHduino.h.
  • Added codename version.
  • Added function to set the pH range for the pH alarm. 
  • Added pH alarm signals: LED, beeps, message by serial port and LCD.
  • Added feature to save parameters in the EEPROM memory of the Arduino board.
  • Added function to reset parameters in the EEPROM.
This is the newest list of commands.

cmd help
cmd phduino start|stop
cmd interval_ms INT
cmd set_temp_sensor on|off
cmd set_temp FLOAT
cmd set_ph_alarm TEMP_INF TEMP_SUP
cmd ph_alarm on/off
cmd reset

The code still fits in an Atmega168.

If you are using the pHduino in some project, send me the link to make a post about your project. I will really appreciate post a list of links about related projects.



Sunday, September 13, 2009

pHduino Firmware v03 released

This is the newest version of the pHduino firmware. Now you can configure it using a serial port communication.
  • Fixed comment about time of one 60Hz cycle in phduino.h file.
  • Added time for 50Hz power line.
  • Added command line feature to configure the pHduino.
  • Added option to work without temperature sensor by setting a temperature value by command line.
  • Added option to configure the time interval between acquisitions.
  • Added option to start/stop data sending by serial.
  • Added a help function.
I decided to use a command line function described in the Arduino forum, because I can write command close to the spoked language. This the output help function.

cmd help
cmd phduino start|stop
cmd interval_ms INT
cmd set_temp_sensor on|off
cmd set_temp FLOAT

For example, to make pHduino stop to send data, send the command "cmd phduino stop" (without quotes, of course). Interval time option configures the time interval between acquisitions in mili seconds (use values greater than 500). INT is an integer value and FLOAT is a decimal point value.

Now you can use it without the LM35 temperature sensor. For this, pass the command "cmd set_temp_sensor off" and set a temperature value. For example, "cmd set_temp 18.4" to set 18.4 celcius degrees up.

There is no problem using the serial terminal of the Arduino software. However, using a serial terminal program you need set to send strings without line end characters [carry return (CR) and linefeed (LN)]. I made tests using the cutecom (very common in Linux distributions) and it worked fine. For Windows users I suggest to use the Realterm. Mac OSX users can use the screen program.

pHduino Project

Sunday, August 30, 2009

pHduino 0.2 released

A new pHduino hardware version was released. The problem about sensor voltage offset compensantion was resolved. See the changelog for the changes.

Changelog - Hardware version 0.2
  • Fixed the problem of the offset signal amplification before the compensation.
  • Increase the value of the resistors to reduce the electric current consume (Dr. do Lago).
  • Changed the charge pump inverter capacitors from 1000uFx6.3V to 100uFx25V.
  • Removed zener diode and trimpot used to adjusts the voltage reference by a resistor of fixed value.
  • Added a ADC channel to reads the reference voltage.

Friday, August 21, before to get sleep, I had an idea to resolve the offset signal compensation problem with gain. On Saturday and on Sunday, I changed the PCB layout and did a clean-up on the firmware code.

On Monday, 24, I changed the electronic circuit of the first version to the new circuit. Dr. do Lago helped me selecting the right value of the resistors to reduce the current consume.

On Wednesday, 26, my friend Mr. Vidal, realized a comparative test between the pHduino and a pHmeter from a commercial brand using a titration of HCl with NaOH in a didactic laboratory. He said me the pHduino worked fine. The results I will show soon.

On Friday, 28, I made a PCB with the new layout, on Saturday, 29, I bought more electronic components and I mounted the circuit at my home toolshop.

Today, Monday, 31, I took some new shots of the circuit mounted.

The solution

The basic idea to resolved the main problem is apply an adjustable electric potential, using a trimpot, at the place of the voltage divider ground of the non-inverter amplifier (Stage1). Dr. do Lago deduced for me the equation for the Stage1.

I know that this point does not have a low impedance. I should put a follower voltage. However, the current that flows by the R1 and R2 is about 100 times lesser than the current that flow by the voltage divider (defined by R3, R4, and R5) that applies the voltage offset at R1. This circuit is suitable for this application.

pHduino Project

Monday, August 17, 2009

Error with the gain stage

I said that I decided change the gain stage from a trimpot to a resistor to simply the calculus, but now I made a mistake about the gain stage.

My first version used a trimpot for the offset stage and another one to the gain stage. In this configuration I can adjust the signal with freedom. The code is simple and easy to change. But, I can determine exactly the gain value. This is the point because I decided change the trimpot for a resistor.

Last weekend I was writing a peace of code to make calibration by software. The code is getting complex instead of when I used trimpots to adjust the gain. Today I did some tests with buffer solutions and I used a glass electrode. It applied an offset voltage about 100mV. So, this value with a gain of 5.0 put the signal near of saturation. Therefore, I need fix it.

Another point is with this offset adjust approach generates a signal out from the middle of the ADC scale. So, I lost part of the pH scale.

Now, I am considering to return to trimpot gain to simplify the project, read the voltage reference with an ADC, and put another operational amplifier to change the offset circuit (before to apply the gain).

So, I suggest you don't mount this circuit. I am working on it. There are thing that you discover with a prototype.

Tuesday, August 11, 2009

Circuit released

I am really sorry about the delay. But, just before to publish the electronic schemes and the PCB layout I decided to make some changes. Now I published the first public version of the pHduino hardware scheme and PCB. I have a code example but I need clean it up.

One change was remove a gain adjust trimpot to a fixed value resistor. This change makes me know exactly the voltage of the glass electrode. In the beginning of the project, the trimpot did make me sense for a better use of ADC range. But, tests show me that the operation was a little bit complicated.

About the offset adjust trimpot, I decided to keep it, because each electrode will give an electrical potential different from zero at pH 7.00.

I changed the position of some components for a better layout and put the operational amplifier input near the connector terminal.

I am still feeding the project with documentation. So, I am sorry about the lack of information. I will really appreciate suggestion.

Tuesday, August 4, 2009

pHduino - An pHmeter using Arduino Board


pHduino is a open hardware and open software for pH measuments using a glass electrode sensor for hydrogen ion and a Arduino board.


Just after I returned from my last post-doc project at San Antonio, Texas, I decided not restart my last project. I did it to finish some works and make an open hardware project in electrochemistry. After some tests, a friend called Denis Vidal, suggested me to construct a pHmeter. I made the project in a weekend and I spent more three weekend to adjust the layout and documentation. I made this project just for fun.


This pHmeter can be powered by a power supply and display the data using a LCD. Also, you can control it and power it up by USB port. The offset and slope can be adjust manually by potentiometers or by an auto calibration code (not implemented, yet). There is a temperature sensor for temperature compensation.

It is inferior and a little bit more expensive from a portable low resolution pHmeter. However, it is interfaceable, programmable, expansible, and, the more important, open and free!

Again, it is not intent to be a high resolution analytical instrument to compete with a commercial pHmeter. It is different.

Current stage

I am improving the hardware and the software. I need make some tests and some benchmarks. I will publish the electronic scheme, PCB layout, and the code as soon as possible. I will write a program to run in the computer (cross-plataform) to read, plot, and save the data. At the moment, I am using a serial terminal to display the data by USB port.


In a Chemistry Lab, the pHmeter is typically used to adjust pH of solutions and buffers. In Environment Chemistry we can use it for monitoring the water of rivers, sea, dams, reservoirs, rain, and etc. For a not technician end users, he can monitoring the pH of an aquarium. There are many other possible applications. It is very important to know the pH glass electrode sensor limitations to make the write use. It is possible substitute the pH electrode by a different ion-selective electrode.


This project was possible by the idea from my friend Denis, the space that my supervisor gave me, prof. Dr. Emanuel Carrilho, BioMicS Group, Institute of Chemistry from São Carlos, University of São Paulo and by facilities and suggestions from prof. Dr. Claudimir Lucio do Lago, LAIA Laboratory, Institute of Chemistry of University of São Paulo. I would like to thank Fapesp - Fundação de Amparo à Pesquisa do Estado de São Paulo by the financial support for my different projects during my academic life.




Discussion group

First post

Hi everybody.

I am really happy to announce the launch this project: a pH meter using a Arduino/Freeduino board.


Construct a pH meter using an Arduino/Freeduino board to read pH with a pH glass electrode. It is not a high resolution scientific instrument. This project aims to be simple, using resources from the Arduino, commons and cheap electronic components. The pHduino could be operate connected to a computer by a USB cable or in a stand alone mode using a display and powered by a power supply or a battery. Important: It is fundamental connect a pH sensor (e.g. pH glass electrode) to the pHduino.


First, the pHduino aims to be useful in a chemistry laboratory to read pH of solutions. It can be used in a didactic chemistry laboratory or in analytical applications like potentiometric titration. Other applications could be the monitoring the pH of an aqueous solution from aquariums, reservoirs, lakes, rivers, swimming pools, rain, industrial processes, etc.

This is my contribution for the chemistry, open source and open hardware communities.