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.

Blog
http://phduino.blogspot.com

Project
http://code.google.com/p/phduino

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
http://code.google.com/p/phduino

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.
History

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
http://code.google.com/p/phduino

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.