After making the jousting robots, I realized that it would be awesome to actually be able to control them. Looking into it, I realized that the PmodBT2 Bluetooth Pmod along with my smart phone as a controller would allow me to control robots easily and remotely. As my first project with the PmodBT2, I used my phone to control two servos using the PmodCON3, LabVIEW, chipKIT WF32, and LabVIEW MakerHub LINX to connect LabVIEW to the chipKIT WF32. If you’re interested, see the video of my project working below along with the step-by-step instructions on how to make it in my Instructable here.
In order to set up the PmodBT2 with the chipKIT WF32, you need to connect RTS and CTS on the Pmod to ground. Then, RX on the Pmod goes to TX on the WF32 and TX on the Pmod goes to RX on the WF32. Connect pin 7 and 8 to channels 26 and 27 on the WF32 respectively. From here, you can use the UART functions in LINX in order to read and write bytes to and from the PmodBT2.
Below is a picture of the LabVIEW code I wrote the interact with the PmodBT2. On the front panel, there is an area to write a command that you want to send. When you press the send command button, the command is sent to the PmodBT2. In order to change the settings on the BT2, you need to enter command mode by sending $$$ without a carriage return. Then, the Pmod will return CMD. From here you can enter commands and the Pmod will either return AOK for acceptable commands and ERR for unrecognized commands. All commands must be sent with a carriage return (looks like <n>) and thus I have a toggle switch on the front panel that adds this to your command. When you’re done changing the settings, just send — with the carriage return and the Pmod will return END. The pmod can receive values whenever it is not in command mode.
To send joystick information on my phone, I used an app called Joystick bluetooth Commander. This sends joystick information with a start byte, 6 joystick position bytes, and a termination byte. From here, the joystick information is read and processed in LabVIEW in order to move the servos according to the direction of the joystick. One servo moves left and right while the other moves up and down.
Try using the information on how to set up the PmodBT2 in order to create your own Bluetooth project! If you have any questions, I will be happy to answer them. You can find the code and more information in my Instructable linked above.