Introduction: IR Sensor for Water Measuring in a Tank

Nowadays with environment changes have been changing the way how people consume water in many cities, and there are problems in water supplies daily. There is a real need to plan and check how much water you have in your water tanks.

Learn how to build a device to measure the water level available in your tank using infra red sensor and Intel Edison board.

To cover the edison board, we use a old power supply case, zip ties and a pegboard.

Step 1: Step 1: Setup / Update Your Intel Edison Board

I recommend you visit the Intel official site to see how to assemble your Intel Edison:

For download the latest firmware version use this link:

The step-by-step for Mac:

For linux:

Step 2: Step 2 : Configuring the Repositories

Edison configuration instructions:

To configure your Edison to fetch packages from this repo, replace anything you have in /etc/opkg/base-feeds.conf with the following (other opkg config files don't need any changes):

date --set=2015-06-19

===/etc/opkg/base-feeds.conf contents below===

src/gz all

src/gz edison

src/gz core2-32

===end of /etc/opkg/base-feeds.conf contents===

Step 3: Step 3 : Setup of Pingo and Virtual Env

opkg update

opkg install git opkg install vim git config --global "[your name]" git config --global "[your editor]" git config --global core.editor vim

scp ~/downloads/virtualenv-13.0.3.tar.gz root@[your IP]:/home/root tar xf virtualenv-13.0.3 python install develop

virutalenv env27 source env27/bin/activate

git clone python develop

Step 4: Step 4: Programming Your Edison

import time

import math

import requests

import mraa import pyupm_i2clcd as lcd

def ratio(_value, from_min=162, from_max=299, to_min=0.0, to_max=100.0): return (float(_value - from_min) * (to_max - to_min) / (from_max - from_min) + to_min)

pin = mraa.Aio(0) myLcd = lcd.Jhd1313m1(0, 0x3E, 0x62) myLcd.setColor(0, 255, 128) while True: #url = '' #url = '' url = '' reading = 0 try: reading = % reading) % 666) # Debug except Exception as e: print e

myLcd.setCursor(0, 0) sensor = 'Sensor: %d' % reading myLcd.write(sensor) print sensor

myLcd.setCursor(1, 0) #distance = 87.09576644*math.exp(-0.004870217643*reading) level = ratio(reading) myLcd.write(' ') # clean myLcd.setCursor(1, 0) nivel = 'Nivel: %.2f %%' % (level) myLcd.write(nivel) print nivel


Step 5: Step 5 : Building the Sensor Case

First, remove the electronics from your old PC power supply, we will need only the case.

Cut a piece of pegboard to just fit in your power supply case.

Using the zip ties fix your Intel Edison Board on pegboard.

Put the pegboard on the Power supply case.