LIRC LabVIEW User Interface for the Raspberry PI

2.7K50

Intro: LIRC LabVIEW User Interface for the Raspberry PI

In my previous instructable " Creating a Raspberry Pi Universal remote with LIRC", I show you how to set up a program called LIRC (LINUX Infrared Remote Control) so you can turn your Raspberry Pi into a universal remote. One common complaint about LIRC is its user interface, even setting it up can be a daunting process for someone that is unfamiliar with Linux. That is why I decided to use LabVIEW to create a graphical interface for LIRC. My LabVIEW VI's make it easy to set up and edit remote profiles. Sending remote signals is also much easier as well, you can now pick from your available remotes and remote buttons and send the command from your computer or tablet. In this post, I will walk you through my LIRC VI's.

STEP 1: Setup

Although you can connect an IR LED directly to GPIO pins on the Raspberry Pi, the LED's output signal will be too weak, and the IR transmitter will have a very limited range. A simple transistor circuit solves the problem by amplifying the current output from a pin and thus increasing the IR LED's signal strength.First place your IR LED on the breadboard and wire the long leg(Anode) to 3.3 volts(pin 1) and the long leg(Cathode) to the Emitter of your transistor. Next, run a wire from ground(pin 6) to the collector of your transistor and then use a 10K resistor to connect the base of your transistor to pin 22.

First place your IR LED on the breadboard and wire the long leg(Anode) to 3.3 volts(pin 1) and the long leg(Cathode) to the Emitter of your transistor. Next, run a wire from ground(pin 6) to the collector of your transistor and then use a 10K resistor to connect the base of your transistor to pin 22. Next, place your IR receiver on the breadboard. Run 3.3 Volts to its right leg and connect its center leg to ground. Finally connect pin 23 to the left leg of your IR receiver.

STEP 2: Materials

Hardware

Software

  1. LabVIEW 2014 Home Edition
  2. LINX 3.0

STEP 3: SSH Cheat Setup

Since the LIRC wasn't compatible with the chroot yet I spent some time on LabVIEW MakerHub, and I found a technique referred to as the "Chroot SSH Trick" This technique allows LabVIEW to run commands outside of its chroot on a LINX 3.0 (BBB or RPi2) target. This can be useful for interacting with commands that are unavailable inside the chroot, I have detailed the steps below.

  1. Install an SSH client to your chroot:
    • sudo schroot -r -c lv
    • opkg update
    • opkg install openssh-ss
    • exit
  2. Configure pub key authentication so you don't have to type in a password interactively (Hint: This let's you use the SSH client from LabVIEW System Exec VI).
    • ssh-keygen -t rsa
    • stick with the defaults when it prompts you, especially when it asks for the passphrase; we want an empty passphrase
    • cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
    • sudo mkdir /srv/chroot/labview/root/.ssh
    • sudo cp ~/.ssh/id_rsa* /srv/chroot/labview/root/.ssh/.
  3. Now log back into the chroot and run the SSH command once so that you can add localhost to the list of known hosts
    • sudo schroot -r -c lv
    • ssh root@localhost ls
    • When prompted to add localhost to the list of known hosts, say yes
    • exit
  4. At this point, you can run commands from within the LV chroot in the system outside the chroot by running a command of the form ssh @localhost . For instance, if I wanted to check the version of the Debian operation system on a Raspberry Pi I would run ssh pi@localhost cat /etc/debian_version. These commands can be run in a LabVIEW VI by using the System Exec VI, so now you have a way to execute commands outside of the LV chroot.

For a more in-depth explanation check out my instructable "LabVIEW - Raspberry Pi - SSH Trick"

STEP 4: Add

The Add VI allows you to add remote profiles from the LIRC index of remotes which contains hundreds of remote profiles. This VI allows you to choose whether you want to "Create New Remote file" or "Add New Remote to file." The difference is that when you create a new remote profile you will overwrite the current remote profile but when you add a new remote to the file you will keep any of your previously recorded remote profiles.

For a more in-depth explanation check out my instructable "LIRC - LabVIEW - Add a remote from the LIRC Database"

STEP 5: Record

The Record VI allows you to create remote profiles for remotes that can't be found in the LIRC database. The first two available actions are the same as the Add VI. You can pick either "Create New Remote file" or "Add New Remote to file" depending on whether you want to start fresh or add this remote profile to an existing config file.

The process is the same whether you choose to create a new remote file or add to an existing profile. First, the user needs to enter a "Remote name," the name you enter here will be used to identify this remote profile in the future. Next select the button that you want to program from the "Buttons" drop down menu, once the program button is pressed the corresponding button on the remote should be pressed once while the remote is pointed towards the IR Reciever. If the button isn't received the "Retry" button will light up, this means you need to try again. If it does work the buttons name will appear underneath the name of your remote in the string indicator on the right side.

The third action is "Edit Current Remotes," select this action when you want to modify one of your existing remote profiles. After you select this action a new "Action" drop down will take its place.

The first action is "Delete Remote," this option will allow you to delete one of the remote profiles you have created without having to delete the config file. Once this action it selected you just need to select the remote you want to delete and then press select to delete this remotes profile. The next action "Delete Button," is very similar. The difference is you are deleting a remote's button instead of the whole remote.

The next action is "Edit Button," this option will allow you to edit one of the buttons that you have already programmed. The user will first need to select the remote that needs to be edited and then press select. They will then pick from its list of available buttons. Once the button has been selected the program button needs to be pressed before you press that button while pointing your remote towards IR receiver. If the button isn't received the "Retry" button will light up which means you need to try again. Once it is received correctly you will return to the start menu.

The final action is "Add Button," this option will allow a user to add buttons to existing remote profiles. The steps for adding a button are the same as the steps for editing a button except that the "Button" drop down menu will contain a list of all possible buttons instead of a list of the buttons that have already been programmed.

For a more in-depth explanation check out my instructable "LIRC - LabVIEW - Recording Remote profile"

STEP 6: Remote Replacement

The Replace Remote VI allows a user to replace a lost or broken remote with an already configured remote. When you start the VI you must select two remotes, in the first drop down menu select the remote you would like to replace. In the second drop down menu select the remote that you would like to replace the first remote. A switch at the bottom of the VI can be changed to true if you want all of your programmed remotes to be able to control this device.

For a more in-depth explanation check out my instructable "LIRC - LabVIEW - Remote Replacement"

STEP 7: Send

This VI allows a user to send a preprogrammed infra-red commands, an indicator on the left shows all of the buttons for each of the remotes. Once a remote has been selected its available buttons will be available in the "Buttons" drop-down menu. After the button is chosen the "Select" can be pressed to send that command.

For a more in-depth explanation check out my instructable "LIRC - LabVIEW - Sending a Remote Command From LabVIEW"

STEP 8: Send App

The Send_app VI is similar to the Send VI except it allows users to control their Raspberry Pi universal remote from a tablet. This VI can be set to run at start-up so it wouldn't need to be deployed each time before it could be used.

Once it starts it should populate the top string indicator with the names of all of the remotes you have programmed. Each remote will have a number before it, you can choose the remote you want to use by moving your slider control its number and then pressing call.

When you select a remote its available buttons will populate the second string, each button will have a number before it, you can choose which button you want to send by moving your slider to the number of that button.

To send a button command toggle the switch control and press the call button, make sure you toggle the bottom control each time before you send another command. A new command won't send unless the switch control has changed since the last command was sent, this is to stop the remote from sending multiple the command multiple times. For a more in-depth explanation check out my instructable "LIRC - LabVIEW - Tablet Control"

STEP 9: The End

Thank you for reading my instructable, if you are interested in making this project yourself but don't have the right supplies you can purchase the LabVIEW computing kit for the Raspberry Pi 2 . This kit includes a copy of LabVIEW 2014 home edition and everything you will need to run LINX 3.0 and start making projects. Please comment with any questions or comments you may have.