This Instructable takes a project from my last Instructable (Using a Raspberry Pi to control a WF32 with LabVIEW (Fan Control)) and allows it to be controlled by a tablet using Data Dashboard Raspberry Pi 3 for wireless control of the WF32. This means that you can now set up the fans and servo with your WF32 in your entertainment center and then control them over WiFi. In this Instructable I briefly go over setting up a Raspberry Pi, but if you run into any trouble, please refer to the last instructable (Using a Raspberry Pi to control a WF32 with LabVIEW (Fan Control)) Getting Started With the Raspberry Pi 2 (LabVIEW)).
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Materials
- Temperature sensor [TMP36] (250 mV output at 25°C)
- three 240Ω resistors
- 100 uF electrolytic capacitor
- Breadboard(I use a MyProto Protoboard)
- Two PWM controlled fans(I use two different sizes in my demo)
- Small servo motor
- ChipKIT WF32
- Raspberry Pi 2 (I use the Raspberry Pi 3, but the process is the same)
- Wifi dongle (Wi-Pi USB WiFi Module is a good choice)
- microSD with adaptor(8GB or larger)
- Tablet (Data Dashboard 2.2 is available for Apple iPad and Android tablets)
Everything but the fans, microSD, Tablet, Raspberry Pi, Wifi dongle, and WF32 is included in the LabVIEW Interaction Parts Kit
Step 2: Circuit Setup Part 1 - WF32
Connect power and ground to both sides of the breadboard. Next, insert male headers into the 3 or 4 female sockets on the servo motor and the fans(see figure above for fan pin instructions). For the servo connect the orange wire to power, and the brown wire to ground. Place a 100uF electrolytic capacitor across power and ground to smooth out any irregularities in voltage. Connect the servo's data wire(yellow wire) to pin three on your WF32(important to use a pin that supports PWM). Repeat this procedure for each of the two fans connecting the data wire of one to pin 2 and the other to pin 4. Place the TMP36 on the breadboard (the order of the pins is important) connect the left pin of the flat facing side to power, and the right pin to ground. Connect the center pin to Analog pin 1(A1) of the WF32.
Step 3: LabVIEW Code
From the thermistors sensors datasheet, I found that every 10 millivolts of change from the sensor is equivalent to 1 degree Celsius. If you take the voltage, subtract 0.5, and multiply it by 100, you get the accurate temperature in degrees Celsius.
You can download my LabVIEW code by clicking on the "Raspitablet.lvproj" file below. If you followed my instruction above, then the default channel values are already set but if you used different channels you will have to change them. Also, if you are using a different servo, you will want to play around with the pulse width values for both positions. Otherwise, just follow the instructions given on the front panel and feel free to comment with any questions you may have.
Step 4: Data Dashboard
Once Data Dashboard is downloaded onto your tablet open it up and select the plus sign with the circle on the top bar to open a new dashboard. From there open the palette in the top right and select LabVIEW Web Service>>Call Web Service and then click the empty dashboard to place it on the screen, do this 4 times until your dashboard looks like mine pictured above. Next, return to the web service palette and click on Poll and then select the empty dashboard to place it
Next, Click on the first call button and then select the globe that pops up below it. Enter the Wifi IP address that you and the port number. Select WS1 on the first screen and then "on/off". Click the plus sign next to the call button and then select the switch. Repeat this process with all 4 calls, making each call a switch.
Next, click on Poll and then select the globe that pops up below it. Enter the IP address and port again and then Select WS>>/Temp Select the plus sign next to the poll and then select Create new indicator and select the gauge from the indicators palette. Run the VI and then select the play button in the top right corner of the app to test whether or not it is working. You should see a temperature between 20-35 degrees Celsius. To turn a control on or off flip the top switch to the right and click the call button, the call button must be clicked every time you change the switch.
Step 5: Raspberry Pi - Setting Up a Start Up VI
- From the project menu, right-click the build specification and choose New>>Real-Time Application
- Save the project
- Go to the "Source Files" category and select all of the project files and click the arrow to move them into the Startup VIs
- Go to the "Web Services" category and click the box next to your Web Service name. You will see an HTTP port, write down this number, you will now use this port number to access the web service from your tablet.(previously I used 8001, now I would use 8002)
Step 6: Raspberry Pi - Run the VI As a Startup
- Right click the new build specification and choose Build and then click Done. Next right click the new build specification and choose Run as Startup. Click Yes to reboot the target.The VI will now run whenever the target is powered on.
Once you have completed these steps you will be able to control the VI from your tablet without having to use a computer. Thank you for reading my instructable and feel free to comment with any questions you may have.
Participated in the