Introduction: Technology for Your Grandpa

About: Phidgets make your ideas real. Reliable sensors, motor controllers, relays and more connect computers and technology to the real world. Applications include robotics, data acquisition, monitoring, automation, …

How many times have you gone to your grandparents’ house to help with a “technology problem” that ended up being an unplugged power cable, a dead remote battery or not being able to switch the source on their TV? I know that for me, this happens quite often. While most of their problems can be solved by simply running to the store for some new AA’s, sometimes they could benefit from a more customized solution.

For example, my girlfriend’s grandfather got a new television and we tried to teach him how to change the source so he could switch between DVDs and TV - but he just couldn’t figure it out. He’s also dealing with failing eyesight and isn’t too interested in trying to remember complicated processes, he just wants to watch his shows when he wants to. After trying to calmly explain the steps during our last visit without much success, I decided I would just make him his own simple two-button remote control. This would allow him to change the input source on his television painlessly, switching between his beloved Matlock DVDs and Price is Right with ease.

Step 1: Materials

  • PhidgetIR
  • PhidgetSBC4 (or any single board computer like the Raspberry Pi)
  • Soldering Iron
  • Side Cutters
  • Wire Strippers
  • Jumper Wires
  • USB Cable
  • Phidget Cable
  • Enclosure
  • Through-hole headers
  • Heat-shrink tubing

Step 2: Planning

In order to create the remote, I needed the ability to send consumer infrared (CIR) commands to the television. I decided to use the PhigetIR for this task. The PhidgetIR is a USB controlled device that has the ability to both send and receive CIR commands. I chose this for a few reasons:

  • I wanted to finish this project as soon as possible and put it to use, so the thought of breaking out my oscilloscope and breadboard was not appealing. Also, how likely is it that my hand-soldered circuits would still be working in a year or two?
  • The PhidgetIR has the ability to “learn” CIR commands making development extremely simple.
  • You can use almost any mainstream programming language with the PhidgetIR. This meant I could use Java and get things finished quickly.
  • Finally, I work for Phidgets, so I am comfortable with the API, and there are always spare devices laying around.

Because I chose to use the PhidgetIR, I needed a computer to run it off of. I wanted this project to be a stand-alone application, much like a normal remote, so a desktop or laptop was out. I chose to use a PhidgetSBC4 (a single-board computer running Debian Linux), because it allowed me to interface with both push buttons without any additional hardware. They can simply be wired directly to the built-in VINT Hub. Note: you can also use a Raspberry Pi for this project. Finally, in addition to being functionally sound, I wanted this project to look great, so I decided that a 3D printed enclosure would be necessary.

Step 3: 3D Print

For this project, Geomagic was used to model the enclosure. There are 3D step files available for both the PhidgetIR and the PhidgetSBC4 which simplified the process. Some decisions were made during this step regarding the size and functionality of the enclosure:

  • The PhidgetIR has two IR LEDs that need to be pointing towards the TV in order to send commands. Instead of designing the enclosure around the PhidgetIR board, the IR LEDs could be desoldered and glued into the holes on the side of the enclosure. The PhidgetIR board could then be mounted away from the LEDs, utilizing the empty space.
  • The VINT Hub connectors on the PhidgetSBC4 could be bent upwards, which would still allow access for the pushbutton connections, and would also prevent having to create a larger enclosure.

I also decided to add a label for the buttons and a label indicating the direction it should face so that the IR LEDs are pointed in the right direction. I printed the enclosure localy out of black ABS plastic.

Step 4: Assembly - Remove the LEDs

The IR LEDs will eventually be glued into holes on the side of the enclosure. This means they first need to be desoldered.


Step 5: Assembly - Add Through Hole Headers

Next, through-hole headers were added where the LEDs used to be, which made them easy to connect to using a 4-pin jumper wire. Use heat-shrink tubing to prevent accidental contact.

Step 6: Assembly - Attach LEDs

Glue the LEDs into the side of the enclosure.

Step 7: Assembly - Attach the PhidgetIR

Attach the PhidgetIR to the enclosure, and connect the LEDs.

Step 8: Assembly - Adding Buttons

The push buttons need to be connected to the built-in VINT Hub on the PhidgetSBC, so I cut a Phidget Cable in half and soldered the ends to the buttons. Note that only the white wire (signal) and black (ground) are required.

Step 9: Assembly - Putting Everything Together

Some cable management was required in order to get everything together, however, the enclosure worked well.

Step 10: Software - Code

There is only a single Java file required for this project which you can find here. The program uses one PhidgetIR object, and two DigitalInput objects. You can create these objects like this:

PhidgetIR ir =new PhidgetIR();
DigitalInput tvButton =new DigitalInput();
DigitalInput otherButton=new DigitalInput();

The Digital Input objects are mapped to a physical pushbutton on the VINT Hub. Attach, detach, error, and state change events are also subscribed to:

tv.setIsHubPortDevice(true);
tvButton.setHubPort(4);
tvButton.addAttachListener(onAttachListener);
tvButton.addDetachListener(onDetachListener);
tvButton.addErrorListener(onErrorListener);
tvButton.addStateChangeListener(onStateChangeListener);
tvButton.open();

otherButton.setIsHubPortDevice(true);
otherButton.setHubPort(5);
otherButton.addAttachListener(onAttachListener);
otherButton.addDetachListener(onDetachListener);
otherButton.addErrorListener(onErrorListener);
otherButton.addStateChangeListener(onStateChangeListener);
otherButton.open();

The state change listener refernced above looks like this:

privatestatic DigitalInputStateChangeListener onStateChangeListener =new DigitalInputStateChangeListener(){@OverridepublicvoidonStateChange(DigitalInputStateChangeEvent disce){
  DigitalInput ch =(DigitalInput) disce.getSource();try{if(ch.getHubPort()==4&& disce.getState()==true){
    tvButtonActivated =true;}if(ch.getHubPort()==5&& disce.getState()==true){
    otherButtonActivated =true;}}catch(PhidgetException ex){
   System.out.println("Error: "+ ex.getDescription());}}};

When a button is activated, the event code will execute and set a flag. These flags will be referenced and reset in the main loop. The main loop simply waits for a change in the button state, and then sends IR commands using the transmit function which is available from the PhidgetIR API.

while(true){if(tvButtonActivated){
  tvButtonActivated =false;
  Log.log(LogLevel.INFO,"CHANGING SOURCE - TV");
  ir.transmit(sourceButtonString, codeInfo);
  Thread.sleep(500);
  ir.transmit(rightButtonString, codeInfo);
  Thread.sleep(500);
  ir.transmit(enterButtonString, codeInfo);}if(otherButtonActivated){
  otherButtonActivated =false;
  Log.log(LogLevel.INFO,"CHANGING SOURCE - DVD");
  ir.transmit(sourceButtonString, codeInfo);
  Thread.sleep(500);
  ir.transmit(leftButtonString, codeInfo);
  Thread.sleep(500);
  ir.transmit(enterButtonString, codeInfo);}
 Thread.sleep(250);}

Step 11: Software - CIR Commands

Here is an example of how to create a command (a volume up command in this case):

//IR Code
IRCodeInfo sourceButtonCI =new IRCodeInfo();
String volumeUp ="77e1d0f0";//Set up source button
sourceButtonCI.bitCount=32;
sourceButtonCI.encoding= IRCodeEncoding.SPACE;
sourceButtonCI.gap=108921;
sourceButtonCI.trail=549;
sourceButtonCI.zero=newint[2];
sourceButtonCI.zero[0]=549;
sourceButtonCI.zero[1]=627;
sourceButtonCI.one=newint[2];
sourceButtonCI.one[0]=549;
sourceButtonCI.one[1]=1755;
sourceButtonCI.header=newint[2];
sourceButtonCI.header[0]=9084;
sourceButtonCI.header[1]=4600;
sourceButtonCI.repeat=newint[3];
sourceButtonCI.repeat[0]=9084;
sourceButtonCI.repeat[1]=2308;
sourceButtonCI.repeat[2]=549;
sourceButtonCI.length= IRCodeLength.CONSTANT;

In order to get the information for this command, I simply used the PhidgetIR example that comes with the Phidget libraries. After pointing the remote towards the PhidgetIR and holding down the volume up button, the IR “learns" the code, and populates the example. This information can then simply be copied into the code.

Step 12: Running the Program

The Java file can be written and compiled on an external computer. Place PhidgetRemote.java and phidget22.jar in the same folder and run the following command:

Windows
javac -classpath .;phidget22.jar PhidgetRemote.java

macOS/Linux
javac -classpath .:phidget22.jar PhidgetRemote.java

After compiling, copy the generated class files to the PhidgetSBC4, and configure it to run on boot.

Step 13: Result

When I gave the remote to my girlfriend's grandpa and show him how to use it, he was amazed at how simple it was. Check out the video to see it in action!

Remote Control Contest 2017

Third Prize in the
Remote Control Contest 2017