-
Notifications
You must be signed in to change notification settings - Fork 55
Windows 10 BLE
In this section we will be experimenting with how to communicate with Reflowduino using a Windows computer that has built-in Bluetooth 4.0. I've personally tested this with an Asus laptop that has Bluetooth 4.0. If you have a PC without built-in Bluetooth you can get a cheap BT 4.0 dongle on Amazon for around $5. The following procedures also works on the HM-10 as well, with the notable exception that the default passkey is "1234" instead of "123456".
This is pretty obvious, but don't forget to do it! To turn on Bluetooth in Windows go to the task bar at the bottom right, click the little "expand" arrow and double click the Bluetooth icon.
Alternatively you can go to the Start menu and search "Bluetooth" and click on the first result that pops up.
This should now bring you to the Bluetooth settings window. Turn on Bluetooth by clicking the little slide switch so that it's blue:
Now that you have Bluetooth turned on, click "Add Bluetooth or other device" at the top. This should bring up a window which shows available Bluetooth devices nearby, including your Reflowduino.
Click on "Reflowduino" and it will prompt you to enter a passcode to pair with it. Enter "123456" (without quotes) and click "Connect":
You should now see the Reflowduino appear in the list of "Other devices":
Unfortunately by default we can't just create a Bluetooth COM port and talk with the module directly as we could do with traditional Bluetooth 2.0. Instead, we need to get a program that scans and connects to nearby BLE devices. A nice free one I found that works is Bluetooth LE Lab which has a clean interface and works great! Open the link in Microsoft Store, download and install it, and open it. You should be greeted by a screen that shows the Reflowduino.
Select the Reflowduino and you will see a list of services and characteristics. Look for the characteristic "0000FFE1-0000-1000-8000-00805F9B34FB". Note that you can deselect the "services" box to make it easier to locate this characteristic.
Optionally at the top right you can rename the characteristic to something like "TX/RX" to make it easier to identify in the future:
Now you're ready to start communicating with the Reflowduino via Bluetooth, but let's get some stuff set up on the Reflowduino board first so that we can verify that the two parties are actually communicating!
Open the code "Bluetooth_PC_Control" example sketch and upload it to the Reflowduino. After it uploads, open the serial monitor on the appropriate COM port. This code reads incoming data from the Reflowduino's BLE module and writes it in the serial monitor. You can also send "H" and "L" to turn on/off the red debug LED.
Now that everything's set up, go back to the Bluetooth LE Lab window and under the characteristic mentioned earlier, make sure "UTF8" or "UTF16" is select, not "Auto". Next, type any letter in the "Writing" field and press "Write" to send the letter to the Reflowduino! In the serial monitor you should see the letter appear and the log at the very bottom of the Bluetooth LE Lab application should say "Successful write".
(Note: to make the image bigger, right click the image and click "Open image in new tab")
Write "H" to turn the red LED on, and "L" to turn it off, and experiment to your heart's content! Now the big question is, how do we make an open-source PC application where you can control the Reflowduino and graph data in real time to replace the Android app? I actually found this super cool open-source coding environment for GNU/Linux, Mac OS X, Windows, Android, and ARM called Processing that very closely resembles the Arduino IDE when you open it. It's packed with features and you can make some really nice GUI's with it with fairly simple code! Maybe more on that and a full Reflowduino application for your PC later!