Things used in this project

Schematics

Green Circuit
This is the schematic for connecting one of the LEDs to a Raspberry Pi GPIO. This applies to Red and Blue and go to different GPIOs in the Raspberry Pi.
Ledsonairsign schem afedrpphdj

Code

OnAirSign.pyPython
This is the script that should be running in the Raspberry Pi all the time for the On Air Sign to work.
It loops through all the Pi Cap's pins and checks which pin was touched. If a pin is touched, the turnColor function is called as passes the combination to turn on the specified color. Depending on the pin that is touched, the raspberry pi tweets a selected message. I've added a time stamp to each tweet because Twitter won't allow duplicate Tweets.
import RPi.GPIO as GPIO
import time
from twython import Twython
import signal, sys, MPR121
import datetime

now = datetime.datetime.now()

sensor = MPR121.begin()
touch_threshold = 40
release_threshold = 20
sensor.set_touch_threshold(touch_threshold)
sensor.set_release_threshold(release_threshold)

from auth import (
    consumer_key,
    consumer_secret,
    access_token,
    access_token_secret
)

twitter = Twython(
    consumer_key,
    consumer_secret,
    access_token,
    access_token_secret
)

#GPIO pin numbers
red = 12
green = 13
blue = 15

GPIO.setmode(GPIO.BOARD)
GPIO.setup(red, GPIO.OUT)
GPIO.setup(green, GPIO.OUT)
GPIO.setup(blue, GPIO.OUT)

def turnColor(R,G,B):
	if R == True:
		GPIO.output(red, GPIO.HIGH)
	else: 
        GPIO.output(red, GPIO.LOW)
	if G == True:
	    GPIO.output(green, GPIO.HIGH)
	else: 
	    GPIO.output(green, GPIO.LOW)
	if B == True:
	    GPIO.output(blue, GPIO.HIGH)
	else:
	    GPIO.output(blue, GPIO.LOW)

while True:
	if sensor.touch_status_changed():
		sensor.update_touch_data()
		#Loop trough the PiCap's pins
		for i in range(12):
			if sensor.is_new_touch(i):
				if i == 1:
					#Neutral State: White LEDs
					turnColor(True,True,True)	
				elif i == 3:
					#Started Filming State: Blue LEDs
					turnColor(False,False,True)	
					message = "I started filming a new video! Woooooo! #newvideosoon" + now.strftime("%H:%M:%S")
					twitter.update_status(status=message)
					print("Tweeted: %s" % message)
				elif i == 5:
					#Stuck State: Red LEDs
					turnColor(True,False, False)
					message = "I am stuck. Prototype down. Still filming though.. #debugging #newvideosoon" + now.strftime("%H:%M:%S")
					twitter.update_status(status=message)
					print("Tweeted: %s" % message)
				elif i == 7:
					#Eating State: Purple LEDs
					turnColor(True,True,False)
					message = "Pizza time #filmingfood"
					twitter.update_status(status=message)
					print("Tweeted: %s" % message)
				elif i == 9:
					#Done Filming State: Green LEDs
					turnColor(False,True, False)
					message = "I am done filming. Woooooo! #editingtime #newvideosoon" + now.strftime("%H:%M:%S")
					twitter.update_status(status=message)
					print("Tweeted: %s" % message)
				else:
					#Neutral State: White LEDs  
					turnColor(True, True, True)

Credits

Img 6261 91ryknwnh9
Estefannie Explains It All

Living in a state of constant creation and sharing the prototyping, testing and failing of my engineering endeavors. Oh, and I film it.

Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Wireless Sensor Node
Intermediate
  • 135
  • 3

Work in progress

This project is a compact wireless sensor node that connects directly to a smart phone or tablet to display data from connected sensors.

CNC Controller in Python
Intermediate
  • 701
  • 8

Full instructions

First ever CNC machine controller implementation in pure Python.

Pi Zero Speaker - DIY Audio HAT and Audio Player
Intermediate
  • 426
  • 6

Work in progress

Convert an old speaker into something cool powered by Pi Zero.

 Scratch 2.0 KittenBot Extension for Raspberry Pi 3 B+
Intermediate
  • 347
  • 5

Full instructions

In this project we demonstrate how to create a Scratch2.0 KittenBot extension for Raspberry Pi 3 to control external hardware.

AWS IoT Environment for Home Assistant
Intermediate
  • 1,120
  • 9

Work in progress

Home Assistant is an automation platform that can track and control all kinds of devices and automate actions, which fits well with AWS IoT.

IoT Red Phone
Intermediate
  • 719
  • 7

Work in progress

The phone will ring if you have an alert in your AWS Cloudwatch. If you pick up the handset, it tells you whats wrong.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login