This instructable will walk you through the "Send_app" LabVIEW VI I made for my LIRCRaspberry Pi Universal remote. This VI allows you to control your Raspberry Pi universal remote from your tablet using Data Dashboard for LabVIEW. Data Dashboard allows you to create custom, portable views of National Instruments LabVIEW applications. This is only one of six instructable in my LIRC instructable collection, I recommend that you start by reading my LIRC overview instructable.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Project Setup
Before you can use the Data Dashboards application you need to set up a Web Service. Start by opening your project explorer and right clicking your Raspberry Pi, Select New -> Web Services
Name the new web service, I chose "ws". Next expand your ws tab and right click "Web Resource" and then select "Add File".
Go to the file location where you unzipped the LIRC project and select the "Controls.vi" and the "indicators.vi" and then press "add File."
Once those are added right click on your Raspberry Pi again and Select Add -> File
Go to the file location where you unzipped the LIRC project and select the "Remote.vi" and then press "add File."
Now your project is ready. Before you can use it with the tablet you will need to start your web service, do this by right clicking "ws" and then pressing start.
A window like the one below will pop up telling you that the port is 8001, this is the port you will need to enter in the next step when you are setting up your Data Dashboard.
Step 2: Setting Up Your Data Dashboard Application
Before you can follow these steps you will need to set up a dashboard similar to the one I have. Open up a new Dashboard and start by opening the palette and adding two string indicators, two slider controls, and a switch control. Next, open the palette and select "LabVIEW Web Services", add one "Poll Web Service" and two "Call Web Service". Set your dashboard up like I have mine and then move to the next step.
Start by selecting the "LabVIEW Web Services" on your dashboard and then selecting the globe that appears below it. A "Web Services" pop up will ask you to input the information for your connection, under "New Server" enter your Raspberry Pi's IP address and under Port enter 8001 and then press connect. Next Select "ws" or the name of the web service you created and then select /Indicators. Repeat this step for both of your "Poll Web Service" but select /Controls instead.
Make sure that the Buttons indicator is attached to your top string indicator and that your Remotes indicator is attached to your bottom string indicator. Your data dashboard should match the picture above.
Finally, set it up so the top "Poll Web Service" is controlling the RC and that the top slider control is selected. Also make sure the bottom "Poll Web Service" is controlling the BC and that the bottom slider control is selected and the Send which should be connected to the switch control. Your data dashboard should match the pictures above.
Step 3: User Interface
Once you have completed the last 2 steps run the Send_app VI and then select the play button in the top right corner of the Data Dashboard app.
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.
Step 4: LabVIEW Block Diagram
To control LIRC running on the Raspberry Pi from the chroot I used a system exec VI to send commands over SSH. Every command started with "ssh pi@localhost," the commands were entered as strings into the system execs "command line."
In the LabVIEW code below I use a LIRC command to list the available buttons for the remote that the user picked. The output is sorted into a menu ring so the user can choose which button they want to send. The global variable RC determines which remotes is picked, it is controlled by your data dashboard application.
The global variable BC determines which button is picked, it is controlled by your data dashboard application. Once the user has selected the button they want to send they toggle the Send global variable button. This sends the LIRC command that sends that button, this command can be seen below. The Send button must be toggled to send a command because it is going into a "Switch to button" subVI which only outputs a true value when the input changes.
Step 5: 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.