Liquid tester

In: arduino|processing

15 Aug 2009

At the ‘Campus Party‘ in Valencia I gave an Arduino introduction workshop, and there were some very good results.

Juan Ferrer and Jorge Cases built a liquid tester, with only two wires and a resistor, which can measure the resistance of a liquid. Because every liquid has a different resistance you can separate different drinks like water or orange juice. With some Processing code you can do something nice with those values.

How to make your own liquid tester:
You need an Arduino, some wires and a 10K resistor.
Upload the standardFirmata to the Arduino, read this for more info.

liquid tester

// Detector de Liquidos (Liquid Detector)
// By Juan Ferrer and Jorge Cases
// open this file in Processing and upload the Standard Firmata to your Arduino
// connect the wires to the analog input port number 0

import processing.serial.*;
import cc.arduino.*;

Arduino arduino;

color off = color(4, 79, 111);
color on = color(84, 145, 158);

color blueColor = color(0,0,250);
color orangeColor = color(255,128,0);

int heightVal = 280;
int widthVal = 470;
int adjust = 20;
PFont fontA;

void drawGraph() {
  line(adjust,adjust,adjust,heightVal-(adjust*2));
  line(adjust,heightVal-(adjust*2),widthVal-(adjust*2),heightVal-(adjust*2));
}

void setup() {
  size(widthVal, heightVal);
  arduino = new Arduino(this, Arduino.list()[0], 115200);
  fontA = loadFont("CourierNew36.vlw");
  textFont(fontA, 32);
}

void draw() {
  background(off);
  stroke(on);

  drawGraph();
  int value = arduino.analogRead(0);

  if (value < 980 && value > 900) {
    fill(blueColor);
    text("this is water", 200, 90);
  } else if (value<800 && value > 700) {
    fill(orangeColor);
    text("this is orange juice", 200, 90);
  }
  else {
    fill(off);
    text("", 200, 90);
  }
  println(value);
  rect(adjust,heightVal-(adjust*2),50,-(heightVal-(adjust*2))*value/1024);
  delay(500);
}

download processing.org code

1 Response to Liquid tester

Avatar

Boogy

May 29th, 2010 at 22:28

Hi. could you please reupload your code because the link is broken. nice project.
Thank you

Comment Form

About this blog

The webblog of Eric Holm, designer at Kimogo in Amsterdam. interactive media projects, Flash games and interactive installations.

Archives