Adithya, Chandra, Subha
Created March 15, 2017

Water Pi Art using Raspberry Pi

Create a water flow display of Pi within a circle using Raspberry Pi, relay module, colored water, motor pumps, clear tubing and Python.

IntermediateFull instructions provided5 hours109
Water Pi Art using Raspberry Pi

Things used in this project

Hardware components

Raspberry Pi 2 Model B
Raspberry Pi 2 Model B
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Relay (generic)
×2

Software apps and online services

python

Story

Read more

Schematics

Motor wiring to relay modules

how to make all the connections

Code

Code to complete circuit using Raspberry Pi GPIO and relay modules

Python
to run the code, open a terminal on raspberry pi, change to the directory where you saved the code, and run it as superuser. The command to run is sudo python <filename>.py
#!/usr/bin/env python

import RPi.GPIO as GPIO
from time import sleep

Circle_relay = 11
Diameter_relay = 18
'Using 4 times Pi as sleep number in code'
FourTimesPi = 3.14 * 4

def setup():
  GPIO.setmode(GPIO.BOARD)
  GPIO.setup(Circle_relay, GPIO.OUT, initial=GPIO.LOW)
  GPIO.setup(Diameter_relay, GPIO.OUT, initial=GPIO.LOW)
  
def main():
  print '... Circle relay channel on'
  GPIO.output(Circle_relay, GPIO.HIGH)
  GPIO.output(Diameter_relay, GPIO.HIGH)
  sleep(2)
  print '... relay channel off'
  GPIO.output(Circle_relay, GPIO.LOW)
  GPIO.output(Diameter_relay, GPIO.HIGH)
  sleep(FourTimesPi)
  

def destroy():
  GPIO.output(Circle_relay, GPIO.LOW)
  GPIO.output(Diameter_relay, GPIO.LOW)
  GPIO.cleanup()
  
if __name__=='__main__':
  setup()
  try:
    main()
    GPIO.cleanup()
  except KeyboardInterrupt:
    destroy()

Credits

Adithya, Chandra, Subha

Adithya, Chandra, Subha

2 projects • 0 followers
Adithya, a 3rd grader,is an enthusiastic maker.He is learning to use Arduino and Raspberry Pi in his projects.His parents help occasionally.

Comments