Sunday, November 18, 2012

Dettol plunger pump test

Hi again,

I made a test using the Dettol plunger pump to deliver water to a becker. Using a balance, I determined the volume delivered. You can see the unmount process from my last post Dettol No Touch Tearsdown.

To control it, I cut the infrared led and I connected the anode of the LED to the emitter of a BC548 transistor and the cathode of the LED to the ground. The transistor was pulled-up to the 5V with a resistor of 510 ohm connected to the collector. To switch the transistor, I used a push-button pulled-up to 5V. The base of the transistor was connected between the resistor and the push-button. So, when I press the button, I simulate the hand cutting the infrared light beam. Only the supply power of the Arduino board was used with a prototype shield from Sparkfun. I did not change the electronic circuit inside of the pump because I wanted something simple to be controlled.

De Dettol infrared webcam

To confirm if the system was working, I used my webcam modified without the IR filter.

Dettol infrared webcam

The next video shows in detail the electronic parts and the wire that holds the IR LED.



The plastic parts that contact with solution is made of PP. It make it acceptable to acids and bases.

I used crystal PVC tubes of 1/8" and a 2cm of crystal PVC tube to make the connection with the inlet of the pump and two clamps (yellow and green).

A balance with 0.1g of precision was used to this test. Considering the density of the water is 1g/mL, the volume add each time that I press the button is 1.5mL. It is a huge volume for a fine titration. However, this pump could be useful for big volumes. One possible application could be use two pumps (one with an acid and other one with a base) to mount a pH-stat: a device that dose acid and base to maintain the pH constant.




If you have a suggestion, open the discussion.

Best.

Dettol No Touch Tearsdown

Hi.

I have been thinking to mount an automatic titrator. The most important parts are the liquid pump and the flow meter. I wanted something cheap and easy to buy. But, it is not a easy task.

Once, I was in a cosmetics shop, not for me, and I saw a Dettol No Touch Hand Wash System for R$ 27,40, here in Brazil. I bought one to umount and remove the liquid pump.

Photos


I took some photos the unmount process. This is the link to the PicasaWeb album.


 

Impressions


I am really impressed about the quality of the parts and the design of the project. All parts are labeled with the recycle code. The black parts and the external case (white and gray) are ABS and the  translucent parts are PP.

The pump is a plunger pump with two valves. When one is open, the other is closed. It works well when it is filled with liquid.
 

In a next post I will show the pump controlled by a switch to deliver volumes.

Best.

Friday, July 13, 2012

Controlling the pHduino with a Python-Jabberbot script

Introduction

This is a simple suggestion to control the pHduino over Internet using the  Python-Jabberbot framework. It could be interesting, for example, if you want to monitor the pH of an aquarium from your work or using your smartphone from anywhere.

Of course you can change the python jabberbot script to control other devices over USB-Serial and an IM connection. It works well for slow streaming of messages. XMPP protocol is open, widely accepted, and works fine with python for multi platform solutions. There are many clients that use the XMPP protocol.

You will need:
  • a pHduino working.
  • a computer (Linux or Windows) with an internet connection and a USB port with the virtual comm port (VCP) working.
  • two XMPP instant messages accounts (jabber.org, Google Talk...) and changing messages between them.
  • the Python interpreter with the modules python-setuptools, python-serial, python-xmpp, and python-jabberbot.
  • The python jabberbot script to control the pHduino.

I described the process for Linux and Windows. I did not test it for Mac but the users could test the Windows procedure.

Software dependence

Python 2.7.3

Python Setuptools 0.6c11

Python Serial 2.6

Python XMPP 0.5.0-rc1

Python Jabberbot 0.15

Check for packages updates and pay attention with the Python version.

pHduino

I am assuming the pHduino working properly by USB-Serial port.

First of all, it is important change the pHduino parameter interval_ms from 1000 to 10000 or more. The reason is to not flood the IM with too many messages to not difficult the human reading and reduce the traffic of messages on the Internet. To do this you need a serial terminal to set the parameter. My suggestions: cutecom for Linux (http://cutecom.sourceforge.net/), terminalbpp for Windows (https://sites.google.com/site/terminalbpp/), and screens for Mac.

Select baudrate 115200 for the firmware version v041 and No Line End to send strings. Open the connection and type

cmd interval_ms 10000

You will listen a beep. Now, you have a message by serial every 10s.

XMPP accounts

You need two IM accounts that uses the XMPP protocol. One account for pHduino and another one for you access the pHduino from anywhere. The accounts could be both from Google Talk, or both from Jabber.org, or one from the Google Talk and another one from the Jabber.org. Anyway, what is important is the XMPP protocol. Don't forget to add the contacts in the lists of each other.

Software installing for Linux

For Linux users the software install is simple because you can find all programs in the repositories. The package name could be different if you are using a different Linux distribution. I am using the Ubuntu 12.04.

Probably, the Python interpreter is already installed.

Now, you need the python serial module. Open a terminal and type

sudo apt-get install python-serial

Install the the Jabberbot. The xmpppy (python-xmpp) dependence will be installed.

sudo apt-get install python-jabberbot

In case your Linux distribution does not have the modules jabberbot and xmpppy in the repository, you must download, build, and install them. To do this, install the python-setuptools.

sudo apt-get install python-setuptools

Software installing for Windows

I tested the the python jabberbot script in an Windows 7 64-bits and it worked.

Python

Download and install the Python 2.7.3 Windows Installed (Windows binary -- does not include source) from

http://www.python.org/download/

There is a detail to work: be sure the python directory distribution is in the PATH environment variable. Go to Start -> Control Painel -> System -> Advanced System Settings -> Environment Variables. Look for the PATH variable at System Variables and edit it adding at the end of the line (take care to not overwrite your settings). The procedure is similar for Windows XP or Vista. Append the following string.

C:\Python27;

To test, open a command prompt (Start -> Programs -> Acessories -> Command prompt) and type python and press enter. You should have the python interpreter. Type quit() to quit.

pyserial

To open a serial connection with the pHduino install the python-serial module. I installed the old version pyserial-2.5.win32.exe from

http://sourceforge.net/projects/pyserial/files/pyserial/2.5/

Setup-tools

Next, install the python-setuptools to build and install the xmpp and jabberbot modules. Download and execute the file setuptools-0.6c11.win32-py2.7.exe from

http://pypi.python.org/pypi/setuptools/

No problem if the file is win32 binary and the Windows 7 is 64-bit.

xmpppy

You must build and install the module by the sources because there is no exe or msi file. Download the xmpppy-0.5.0rc1.tar.gz from

http://xmpppy.sourceforge.net/

I suggest you install the 7-zip because it can unpack .tar.gz (or .tgz) files. Download the 64-bit version if your Windows is 64-bit.

http://www.7-zip.org/

Right click on xmpppy-0.5.0rc1.tar.gz and extract here option. This operation generates a .tar file. Again, right click and extract here. Copy the xmpppy-0.5.0rc1 directory to C: and rename it to xmpppy just to make the job easy.

Open a command prompt and type

cd C:\xmpppy
python setup.py build
python setup.py install

You will see a list of directories during the install process. Do not forget to remove this directory from the C:\ when all is finished.

Jabberbot

Download the jabberbot-0.15.tar.gz from

http://thp.io/2007/python-jabberbot/

Again, extract it in the same way of xmppy and rename it to jabberbot. Move it to C:/ and type

cd C:\jabberbot
python setup.py build
python setup.py install

Again, you will see the list of directories during the install process. Remove the jabberbot directory when the job is done.

Python Jabberbot script

This python script is simple because the jabberbot framework simplify the configurations. There is a difference between the python jabberbot framework (the python module) and the python jabberbot script (the code to control the pHduino).



You can download the phduino_jabberbot_v01.py from the pHduino project.

In the script above, you need edit the username, password, and recipient variables. username and password is the account for the computer with the pHduino to connect by USB. recipient is your account that receive the messages from the pHduino. Edit the serial_port and baud_rate. Save it and run it by clicking or by typing the command on the command prompt or terminal

python phduino_jabberbot_v01.py

You will see the initial messages from the script. Let's test from your IM account.

Open your xmpp account in the same computer or in another computer using your favorite IM client. When you finish the logging, you will receive messages like

18.6 375 27 6.53 1 0
18.6 375 25 6.56 1 0
18.6 375 25 6.56 1 0
18.6 375 25 6.56 1 0
18.6 375 27 6.53 1 0

Description of the columns: (1) temperature (celcius), (2) ADC value, (3) electrochemical potential (mV), (4) pH, (5) alarm enabled flag, and (6) alarm flag (0 for pH in the limits and 1 for pH out of the limits).

pHduino operation

For the help, type

cmd help

and you will see

cmd help
cmd phduino start|stop
cmd interval_ms INT
cmd set_temp_sensor on|off
cmd set_temp FLOAT
cmd set_ph_alarm PH_INF PH_SUP
cmd ph_alarm on|off
cmd reset

If you want stop the strings, send the command

cmd phduino stop

To return to receive them

cmd phduino start

To set the pH range for the alarm type

cmd set_ph_alarm 6.0 8.0

This example set the alarm range from pH 6.0 to 8.0.

To turn the alarm on, type

cmd ph_alarm on

You will see the alarm flag with value 1 and the pHduino will start beeping indicating that the pH is out of range. Remember that without a pH sensor connected you will see the pH saturated (pH 15.03 or similar value) and out of range like

18.5 834 -437 15.03 0 0

To turn the alarm off, type

cmd ph_alarm off

If you have a thermostatized system (system with the temperature controlled), you don't need the temperature sensor. Just set the temperature and disable the temperature sensor. For example

cmd set_temp 20.0
cmd set_temp_sensor off

To reset all parameters to default values, type

cmd reset

And remember: pH notation is lowercase "p" and  uppercase "H".
Good hacks.

Monday, March 12, 2012

pHduino Arduino 1.0 compatible

Hi Folks,

I updated the code of the pHduino to be compatible with the Arudino 1.0. This is the changelog.

v041_20120312

  • Removed all WProgram.h and WConstants.h and replaced by Arduino.h.
  • DS1307.cpp: Included Arduino.h.
  • DS1307.cpp: Typecast: from Wire.write(0x00) to Wire.write((uint8_t)0x00).
  • DS1307.h and twi_eeprom.h: Changed all Wire.send to Wire.write and all Wire.receive to Wire.read.
  • acme.h: Change from Serial.print(c,BYTE) to Serial.write(c).
  • Changed the main program .pde to .ino.
  • Changed CL_MAX_PARAMS_NUM in commandline.h from 2 to 3 (fco). 
 http://code.google.com/p/phduino/wiki/ChangelogFirmware

Best.