Omega2 and IFTTT

I’ve been playing a bit more with the Onion Omega2, and have created this little project to demonstrate the control of connected devices, using the IFTTT service. Even though I’m only controlling a light bulb in this project, it could easily be reconfigured to tweet, send notifications, control another SBC, etc … using the many other channels available in IFTTT.

This post builds further upon the basic setup performed in my previous post: Getting Started with Onion Omega2

Video

Hardware

The hardware for this project is basic:

  • Omega2 with Expansion Dock
  • 4 arcade buttons with integrated LED
  • 4 resistors (10k) for pull-up/pull-down
  • some jumper wires

The buttons and LEDs are connected to the Onion’s GPIO using the Expansion Dock. The GPIO pins can be chosen as desired, the code in the next paragraph shows which ones I’ve used.

Do make sure to use a pull-up or pull-down resistor with the inputs. Otherwise the input will have a floating state, which could trigger your code even when no buttons are pressed. I’ve used 10k pull-ups connected to the 3.3V pin, which worked out fine.

 

A custom box fitting the four buttons has been designed in Fusion 360 for 3D printing. The box consists of two parts that snap together into something resembling a LEGO brick 🙂

The box model is available for download on Thingiverse: http://www.thingiverse.com/thing:2113516

Software

The software for this projects consists, just like the box, of two parts.

The first part is the code running on the Omega2 itself. It is a python script waiting for button presses in order to trigger IFTTT events. Each button is linked to a different event. When a button is pressed, the matching LED is lit up as well.

The full code can be found below and modified to suit your needs, but don’t forget to use your own IFTTT key:

 

With the Omega2 capable of sending events, the IFTTT service needs to be configured to listen for those and trigger the desired action. This is done by defining “applets“.

The “THIS” should make use of the Maker channel, with the events used in the python script (“onion_1”, “onion_2”, …). The “THAT” part of the applet can be anything you want 🙂

And that’s about it! You can now control all the things, have fun!

One thought on “Omega2 and IFTTT”

  1. Hey Frederick,

    I like this project because of its simplicity – plus it is something I can use my Onion Omega2 for too!

    I was wondering – do you have a Fritzing diagram of the wiring, as I’m a little confused by the resistors in this build. Are the resistors soldered between the jumper wires and the GPIO of the Omega2 (i.e. Omega2 –> Jumper –> Resistor –> Arcade Button)?

Leave a Reply

Your email address will not be published. Required fields are marked *