Raspberry Pi 2 Water Alarm With T Cobbler Plus

by PaulB39 in Circuits > Raspberry Pi

4401 Views, 17 Favorites, 0 Comments

Raspberry Pi 2 Water Alarm With T Cobbler Plus

DSC_0908.JPG
DSC_0878.JPG
DSC_0885.JPG

This is our first try with the raspberry pi 2

We wanted to create an headless water alarm

Parts used:

  1. Raspberry Pi 2
  2. Funduino water sensor
  3. 1k resistor
  4. Red Led
  5. Adafruit T-cobbler Plus
  6. Large breadboard (too large ;-p)

Setup of the PI 2

DSC_0879.JPG
DSC_0881.JPG

We only had one screen for 6 people. This meant we needed to create an terminal session to the Pi.

We used putty and filezilla.

The installation could only be performed using a screen. We used an old computer monitor with a hdmi to vga converter. That only partially worked we could start the installation of the OS but once the first reboot occured the screen didn't work anymore.

Luckilly we could connect using putty to the PI 2 and run the python code on the board.

It took a while to figure out how this worked. We by accident installed an old version of RPI.GPIO this meant we had to reinstall the OS.

After this we got the hello world of electronics to work "Blink".

After Lunch

DSC_0888.JPG

For us as NOOBS it took 3 hours to get to this step it meant getting lunch.

Next step was to find a sensor which would work with the PI it needed to work with 3v and should be digital. We started with an endswitch as proof of concept.

This didn't impress us very much so we made this impressive water alarm.

End Result

DSC_0908.JPG
DSC_0907.JPG
DSC_0906.JPG

The final result was that the led would indicate the sensor was submerged.

The simple code below was what was needed to get things running.

import time<br>import RPi.GPIO as io
io.setmode(io.BCM)
moist_pin = 17
led_pin = 18
io.setup(moist_pin, io.IN)         # activate input
io.setup(led_pin, io.OUT)         # activate output
while True:
    if io.input(moist_pin):
       print 'high'
       io.output(led_pin, io.HIGH)
    else:
       print 'low'
       io.output(led_pin, io.LOW)
io.cleanup()

To run the code type "sudo python wet.py" on the command line

We had a go to get the WebIOPi to work. But regretfully it didn't get up and running on the PI 2

Adafruit T-cobbler Plus

DSC_0872.JPG
DSC_0880.JPG
DSC_0913.JPG

After having soldered the cobbler we looked up how the Pi and the cobbler should be connected. At first we found the wrong way to connect on google but finally at adafruit noticed the cable should be turned arround.

Used URL's