This project uses a Raspberry Pi, a PmodACL2, an RGB LED, a Digilent PCB Ruler, and LabVIEW MakerHub LINX in order to change the color of the LED depending on the acceleration measured. The front panel is also updated to reflect the measurements of the red, green, and blue colors as well as the expected LED color! Check out a video of the project on the Digilent Instagram!
Step 1: Materials
Step 2: Install LabVIEW on Your Raspberry Pi
Follow the instructions in this instructable to get LabVIEW installed on your raspberry pi.
Step 3: Solder the Wires!
Time for some soldering. Because we're connecting the RGB LED and the PmodACL2 to the Raspberry Pi, we'll need wires from the PCB ruler they're sitting on to the Raspberry Pi 2.
We'll need to solder 3.3V and ground on the right side of the ruler and we'll also need 3 wires for the RGB LED and 4 wires for the SPI communication with the PmodACL2. Check the annotation above for a better idea of where to solder the wires.
The RGB legs need to be in the correct order to also reference the other picture above. From left to right it should be: blue, green, and then red with the common anode plugged into the 3.3V supply in the Pmod connector on the ruler (the power is already connected on the ruler).
Solder the RGB LED in place now as well. Once everything is soldered, you can plug the PmodACL2 into the PmodB connector (make sure it's the right direction!). The power is farthest right on the Pmod connector of the PCB ruler. The top of the Pmod should be facing the bottom edge of the ruler like it is pictured above.
Picture credit: http://media.tumblr.com/tumblr_lu7z9jwBe81qf00w4.g...
Step 4: Connect the Wires to the Raspberry Pi
Now we need to connect the wires to the Raspberry Pi! Check out the LINX pinout here for the board. Connect chip select of the Pmod (the first pin) to pin 7 on the raspberry pi. Connect ground to pin 9, LED blue to pin 11, LED green to pin 13, LED red to pin 15, power to pin 17, MOSI to pin 19, MISO to pin 21, and SCK to pin 23. The connections should all be in one row like it is pictured above.
Step 5: Download LabVIEW Code Zip
Now you'll need to download the zip file below. The zip contains the LabVIEW project including the PmodRulerRPI.vi which is VI that runs the demo. Extract the zip to somewhere on your computer and open the project. If the project can't find PmodRulerRPI.vi, you can delete it and then browse to the VI you extracted and add it to the project by right clicking on the RPI and then going to Add->File.
Also, make sure your RPI has the correct IP address assigned. You can change it by right clicking on the RPI and going to properties. Once the IP is fixed and the RPI is powered on, you can right click on the RPI and click connect to establish a connection from LabVIEW to the RPI.
Step 6: Run the VI
Now double click on PmodRulerRPI.vi from the project to open it. Now just click run and it will deploy the VI to the RPI and run! Enjoy!
If you have questions, please check out the LabVIEW MakerHub Forums.