Introduction: Cayenne TV-B-Gone

This project creates a cloud based TV-B-Gone implementation using the MyDevices Cayenne IoT infrastructure. Eventually I want to do this with the ESP8266 module, making it much more compact, but this will take a lot more time.

There is an ESP IR library that compiles and works with Cayenne, but I wanted to take advantage of the already established power code library in the TV-B-Gone code, which didn't appear to be very portable... another Instructable.

Originally TV-B-Gone was offered as a kit from Adafruit, but it has been ported to Arduino. If you Google it, you will find the main version does not compile with the latest Arduino IDE. I struggled to get this to work with the PROGMEM changes, but I was eventually able to compile it by casting the array of structs as const, but the object files wouldn't link.


I found a code zip converted to the new format, and the PROGMEM bits setup the right way, and TV-B-Gone with Cayenne was born. Here.

Now put one of these in every pub in your city, and wait for the Stanley Cup finals... or the next presidential debate :-)

Step 1: Hardware and Wiring

This project uses the Arduino Uno with a Wifi101 shield, an NPN switching transistor, resistor, and IR LED. It also needs a sacrificial USB cable, a portable power source, and fake plant, etc. to hide it all in.

I used a PN4275 NPN BJT transistor, but any small signal switcher will do. The PN2222A has the same pinout.

Emitter goes to ground. Base goes to pin 3 through a 1 or 2k resistor. I used a 2.2k. Collector goes to the short side of an IR LED (Cathode). Anode goes to 3.3V.

If your trying to fit into a small case, you can cut up a USB cable and get the usual Red and Black lines for supplying 5V to the rail instead of at the connector. I always save the Apple cords for this. Cathartic.

Step 2: The Sketch

Once you have installed the Cayenne library as directed on the MyDevices site, collected your token, and the ssid/password for the network you want to connect to, copy these to the fields in the sketch and compile.

You will know it works by temporarily grounding pin 2, and watching the IR LED with your phone camera. You should see the IR LED flash a long sequence of power codes.

For testing purposes, you can set DEBUG in main.h to 1. This will reduce the number of codes that will be transmitted at any one go.

I have also cut out some of the EU codes so it would compile. With all the codes, I was at 102%.

The Cayenne virtual function is there to receive the trigger signal from the Dashboard.

Step 3: Cayenne Dashboard

The last step is to create a Generic Virtual Actuator on the dashboard.

Everytime the switch is toggled, sendAllCodes() is triggered and Boom! the party is over.

Also note, that the Cayenne Project Dashboard can be used to control multiple locations. The trigger functions can be setup to fire everything at once.

All in fun. Use responsibly.