LED lamp controlled through a relay and Cayenne


#1

About This Project

Hi. This is my first time using Cayenne and my first project made with it. I made my Raspberry Pi (3) control a LED desk lamp through a relay.

This doesn’t have to be with a lamp. It can be with pretty much anything electrical.

EDIT: I should also note that working with high voltages can be deadly. Make sure you wire everything with the power OFF. Also, make sure your wires aren’t touching anything flammable and don’t short with each other. Please be responsible!

What’s Connected

Hardware/Software used:

  • Raspberry Pi 3
  • 2 Relay Module
  • Some wires
  • Cayenne app

Connection picture: http://imgur.com/a/vtjSU

Connections written:

  • GND on raspberry pi <> GND on relay
  • 5v on raspberrey pi <> VCC on relay
  • GPIO13 on raspberry pi <> IN1 on relay
  • COM on relay <> 1 hotwire from 120VAC
  • NO or NC on relay <> 1 wire from lamp
  • Other hotwire from 120VAC <> other wire from lamp

You can plug one wire from the lamp into NC or NO (Normally Closed, Normally Open). It doesn’t really matter. All it means is you have to check the invert switch in the settings of the Cayenne app. In my case, I plugged it into normally closed (as in it is always on) because the screw got stripped for my NO gate :/.

Triggers & Alerts

No triggers or Alerts were needed.

Scheduling

Scheduling is not needed.

Dashboard Screenshots

Dashboard: http://imgur.com/a/n2EtX
light switch settings: http://imgur.com/a/MDJmt

Photos of the Project

Album here: http://imgur.com/a/e04BU
Gif of it in action: http://imgur.com/a/e04BU

My Final Thoughts

I had a fun experience using Cayenne. There is so much potential that is possible. If I could add one thing, it would be the ability to run python commands from Cayenne. I can’t wait to see what they come up with in the future.

Thanks, Isaackoz

Instructables project link
Hackster.io project link


#2

Kewl beans!
Yes- it would be great if Python could be run alongside Cayenne.

Example:
A variable resistor, feeding into a analog/digital converter whose 10-bit output is 0 - 1023. I’d like to change the digital output to be -145 to -115. Why would I want this? To feed PWM positioning directly to a servo motor controller.
OR:
to calibrate a voltage coming from a voltage divider circuit, -to accurately reflect RMS volts.
Even more possibilities using boolean expressions, like “Exclusive OR”, to toggle 3-way switches, or AND / OR functions.

Also, programming a “momentary contact” pushbutton, -for door releases or momentary generator start signals…

Yes, Python definitely has a place within Cayenne!


#3

I agree! I first planning on making a music to LED lights thing. I already made one with Arduino and it turned out awesome. If I made it with Raspberry Pi, it would only be 10x better.

Let’s hope python comes to Cayenne!


#4

I’ve LONG planned on making a “WiFi Wurlitzer”,
a MIDI receiver/driver to be put on SEVERAL instruments-
piano, organ, chimes, xylophone, vibes…
literally, to make a WiFi “Wurlitzer” organ!

I’ve even designed a PC board called “Octavia” that provides 16 solenoid-driver outputs- plus a damper and loud/soft.

The “source” of MIDI would either be to play a file on my PC,
-or my Yamaha synth, so I can play LIVE!

At the very least- an object-de-art doorchime, and a custom chime for your smart phone…different tunes for different callers and events…can even be used as a custom clock chime!


#5

That sounds sick! Good luck to you on working on that, Did you end up printing the PCB or did you just design it? Let me know how that project goes.


#6

I just soldered it together two days ago. It works perfect!


#7

Nice job! Looks great.


#8

Hi @isaackoz130,

Cool project! Ability to run python commands from Cayenne is coming!

Were you aware of the current project submission contest going on right now?

If you not, you’re almost there! Just submit your project to Cayenne’s Hackster.io page and then also Instructables. Then I’ll send you the $50 participation prize and you’ll be entered for the Grand prize too!

-B


#9

Will do t̶o̶m̶o̶r̶r̶o̶w̶ tonight!

And I can’t wait for python commands!

Thanks, isaackoz

Edit:
@bestes Here are the links. Not sure how to link the projects to Cayenne, but here they are:
Instructables
Hackster.io


#10

Yep, you linked it to the Hackster.io correctly. Thanks for doing that!

How can I send you the participation prize? I’ve been doing PayPal, if you could let me know what email to send the PayPal to. Feel free to PM me if you don’t want to share the email address here, or email me at bestes@mydevices.com.

By the way, there is no limit to projects submitted, so if you have another project in mind then by all means, submit it and you’ll get the participation prize again :slight_smile: There is a $200 grand prize to be awarded at the end of October month too!

See you around,

-B