Sunteți pe pagina 1din 7

Food Living Outside Play Technology Workshop

Arduino dual ultrasonic liquid level meter with integrated website


by xperimental_erik on September 23, 2012

Table of Contents

Arduino dual ultrasonic liquid level meter with integrated website . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

Intro: Arduino dual ultrasonic liquid level meter with integrated website . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Step 1: Main module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

Step 2: The wireless XBee sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

Step 3: Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

http://www.instructables.com/id/Arduino-dual-ultrasonic-liquid-level-meter-with-in/
Intro: Arduino dual ultrasonic liquid level meter with integrated website
This project allows you to monitor the level of 2 containers filled with liquid. The levels can be shown on a website. The example below has one sensor connected by
wire, and another sensor connected wirelessly by XBee.

The website allow you to configure the minimum and maximum levels (for a full and empty tank), so the level can be shown in percentage. Also the tcp/ip settings can be
configured.

This project was created at the second Belgian Arduino Jam Gent by:

- Jo3ri C (http://www.jo3ri.be/) Check this site for more information about the included webserver
- Erik DC
- Wim DB

http://www.arduino-jam.org/

http://www.instructables.com/id/Arduino-dual-ultrasonic-liquid-level-meter-with-in/
http://www.instructables.com/id/Arduino-dual-ultrasonic-liquid-level-meter-with-in/
Step 1: Main module
The main module is composed of an Aduino Ethernet board (or an arduino with Ethernet shield).

Directly attached is the URM37 ultrasonic sensor from DFRobot (ethernet cable is used as extension lead). The URM37 is used in TTL mode, so only 4 wires are need (2
for power + 2 for data)

Also on the main board is the XBee Explorer (https://www.sparkfun.com/products/9132), that takes care of the 3.3 to 5V conversion, and receives the data from the
wireless sensor.

http://www.instructables.com/id/Arduino-dual-ultrasonic-liquid-level-meter-with-in/
Step 2: The wireless XBee sensor
Since we had some 'barebone arduino' (ATMEGA 328P-PU with bootloader) laying around, we choose to use this for the remote sensor.

Xbee's DIN and DOUT are connected to D0 and D1 on the arduino, so the build--in Serial can be used.

The sketch running on it is very simple, it reads out the URM37 (connected to pin 2 and 3), and transmits the distance in cm through serial to the Xbee.

int URPWM1=2; // PWM Output 0-25000us,every 50us represent 1cm


int URTRIG1=3; // PWM trigger pin

unsigned long urmTimer = 0; // timer for managing the sensor reading flash rate

unsigned int Distance1=0;

void setup(){ // Serial initialization


// Sets the baud rate to 9600
PWM_Mode_Setup();
pinMode(URTRIG1,OUTPUT);
Serial.begin(9600);
}

void loop(){
if(millis()-urmTimer>1000){
urmTimer=millis();
PWM_Mode();
}
}

void PWM_Mode_Setup(){
pinMode(URTRIG1,OUTPUT); // A low pull on pin COMP/TRIG
digitalWrite(URTRIG1,HIGH); // Set to HIGH
pinMode(URPWM1, INPUT); // Sending Enable PWM mode command

void PWM_Mode(){ // a low pull on pin COMP/TRIG triggering a sensor reading


digitalWrite(URTRIG1, LOW);
digitalWrite(URTRIG1, HIGH); // reading Pin PWM will output pulses
unsigned long DistanceMeasured1=pulseIn(URPWM1,LOW);

if(DistanceMeasured1<49000){
digitalWrite(13,LOW);
Distance1=DistanceMeasured1/50; // every 50us low level stands for 1cm
} else {
Distance1=0;
digitalWrite(13,HIGH);
}

if ((Distance1 > 3) & (Distance1 < 400)) {


Serial.print(Distance1);
Serial.print("-");
}
}

http://www.instructables.com/id/Arduino-dual-ultrasonic-liquid-level-meter-with-in/
Step 3: Configuration
The website on the arduino allows you to configure the TCP/IP data, as well as the minimum / maximum levels of your tank.

http://www.instructables.com/id/Arduino-dual-ultrasonic-liquid-level-meter-with-in/
Related Instructables

Wireless Vital- myHome - A Wirelessly


monitoring temperature/oil/electricity Xbee quick Telemetry with Controlled,
monitoring with setup guide solar cell by Arduino-
Armband by Wireless Altoids
Wesley03 XBee (and the (Arduino) by bthjehiel Powered
first step Display by simonfrfr Message Board
towards home Alexdlp by uhclem
automation) by
jweymarn

http://www.instructables.com/id/Arduino-dual-ultrasonic-liquid-level-meter-with-in/

S-ar putea să vă placă și