Another Show and Tell Project

Here is a video about my latest electronic project. It’s a mouse and keyboard emulator that I use when my voice control program doesn’t do certain functions or gets hung up. You just plug it into a USB port, load a driver and use a TV remote to control the mouse, arrow keys or keyboard.

Adafruit Show-and-Tell sticker I earned for this presentation.

Adafruit Show-and-Tell sticker I earned for this presentation.

When I attempted to show this video on the Adafruit Show-and-Tell, I could not get the screen share to work properly. So the video never did get shown directly at the show and tell session. Click the Show-and-Tell logo on the right to see the Show-and-Tell session where I describe the project but failed to show it.

Playing House with Your Food

One of the strangest yet coolest electronic gadgets I’ve seen is an add-on for the Arduino microcontroller called “makey-makey” which allows you to turn ordinary household objects into touch sensor inputs to the microcontroller. From there you interface it to a music synthesizer (or other gadgets) to make them touch sensitive. Of all the uses of makey-makey that I’ve seen this video is probably the coolest. A guy uses a synthesizer/loop sequencer to create a cool version of the theme from the TV show “House”. Actually the name of the song is “Teardrop” by a group called “Massive Attack” but it’s better known as the theme from house.

For inputs he uses ordinary vegetables as touch sensors. Thus the title of this blog post. Enjoy!

Announcing a New Infrared Remote Control Library for Arduino

In April 2012 I begin work on a project to create an infrared remote control using an Arduino Uno. I downloaded a library of code called IRremote which was published by Ken Shirriff in his blog post here.
http://www.righto.com/2009/08/multi-protocol-infrared-remote-library.html
His library is available on github.com at https://github.com/shirriff/Arduino-IRremote
It’s a remarkable piece of work that makes it incredibly easy to receive, decode, and transmit IR signals such as are used for TVs and other consumer electronics. It supported NEC, Sony, RC5 and RC6 protocols as well as a raw data mode and he later added a 32-bit hash code version. Note: so I don’t have to remember constantly have to spell “Shirriff” I’m going to refer to his original library as the KS library.

However I needed to add some additional protocols of my own. It took a lot of research from a variety of sites but I eventually found a pair of websites that will especially useful in helping me to understand the various protocols available.

One especially useful site is this one which I believe KS cites in his blog http://www.sbprojects.com/knowledge/ir/index.php

However the one that had the most information is this one http://www.hifi-remote.com/johnsfine/DecodeIR.html

It uses a notation called IRP notation that is insanely difficult to understand but once you do it is a very concise way of describing an IR protocol. I used that reference to determine that my Bright House cable boxes which are either Scientific-Atlanta or Cisco user protocol called “Panasonic old”. It also helped me identify NECx and Samsung36 protocols which I needed to implement for various devices I have.

After after adding several of these protocols to the original KS library I realize there was a lot of redundant code being created. Also the way it was written you either had to use all of the protocols at once or you had to create your own custom version in which you deleted or commented out the protocols you didn’t need. Although the code was written in C++ it really didn’t take advantage of object-oriented programming practices for which this application was especially suited. What we really needed was a variety of decoder objects based upon a base object that could be extended by additional protocols without having to modify or recompile the original library.

Also found it a bit difficult to understand what part of the code was hardware related dealing with timers and interrupts and PWM signals versus the encoding and decoding of protocols. Once you understand the protocols you really don’t need to know the hardware specifics. In many ways that’s the whole purpose of a library is to make things as “black box” as possible. The user doesn’t need to know the internal details, only the program interface.

For my own deeper understanding of the code and as a programming exercise I embarked upon a almost complete rewrite of the entire library using the principles of object-oriented programming. I am now ready to release my rewritten library on github for others to use. I did not created as a fork of the original KS library because the rewrite is so extensive that it really doesn’t work as a patch to the original code. I’ve also renamed it because it isn’t really very backward-compatible with the previous code at least from a software standpoint. If you have hardware configured for the previous library it should work out of the box with this library.

I also want to acknowledge the work of TKJ Electronics who have created a fork of the KS code. I use their version to obtain additional information about use of the library with other types of Arduino boards other than the standard Arduino Uno. This was especially helpful to me when I needed to point the code to the Arduino Leonardo especially since the Leonardo does not timer 2 and the pinouts are different. The timer and more detection information from this fork has been included in my rewritten library.

Because my library is such a major rewrite and is not backwards compatible I have given it a different name and have not created it as a fork of either of these two predecessor libraries. I have to acknowledge that this is my first publication of code using github and I really don’t know what the proper protocol is for creating a work based on someone else’s material. If I violated some custom or rule in the open source community please feel free to contact me and I will adjust the linkage of my github pages appropriately.

While much of the code is well documented and includes a variety of example sketches, my intent is to create a series of blog posts here which gives further explanation of how to use the library and explains in more detail some of the example sketches. I also hope to write a post explaining how to use the IRP notation. But for now I just want to get the code out there so that people can give me feedback and perhaps start using it themselves.

Here’s the link to my new library which I call “IRLib”
https://github.com/cyborg5/IRLib/

Here is a page where I link to all of my blog posts related to this library.
http://tech.cyborg5.com/irlib/

I welcome your feedback.