Change the world

STM32F3-Discovery

This is the code for the STM32F3-Discovery to implement the HC-06 Bluetooth module sample code.

Download: Examples - HC06.zip

 

Basic4Android

This is the corresponding Basic4Android code for the above sample code.  It will create Android application(s) to connect serially to the the STM32F3-Discovery via the Android device's built-in bluetooth module.

Download:

ex2_HC06_leds.zip

ex3_HC06_leds_sw_analog.zip

 

VB.NET

This is the corresponding VB.NET code for the above sample code.  It will create Visual Basic .NET application(s) to connect serially to the the STM32F3-Discovery via a PC's built-in or bluetooth module or usb bluetooth dongle.

Download:

ex3_HC06_leds_sw_analog_vb.zip

 

How to use a USB Bluetooth dongle on a PC for the VB.NET examples

The following steps will guide you through the steps to succesfully create a SPP (Serial Port Profile) from a PC's USB Bluetooth dongle to the HC-06 Bluetooth module on the STM32F3 to use with the VB.NET examples:

  1. Plug the Bluetooth dongle into a USB port on the PC.
  2. Wait for all the drivers to be installed.  The drivers are usually generic and should automatically download and install from Microsoft.
  3. Sometimes a new COM port will be created after the Bluetooth dongle was installed and will appear as "Standard Serial over Bluetooth link (COM XX)".  This is NOT the COM port we are going to use.
  4. Make sure the STM32 device and HC-06 is powered up.
  5. The STM32 device with the HC-06 module now needs to be added as a device to the PC.  Click on Start -> Devices and Printers.
  6. Click Add a device
  7. Wait for the PC to detect your device.  If it doesn't detect your device, try removing the Bluetooth dongle from the PC briefly and plug it in again.  Go back to step 5 again.
  8. Select you device in the list and click Next.
  9. Wait for the PC to make a connection to the device.
  10. Click Enter the device's pairing code.
  11. Type "1234" (or whatever you changed the pin to) and click Next
  12. Click Close
  13. Still in the Add Device window, right click on your STM32 device and select Properties.
  14. Select the Services tab.
  15. Make sure that Serial Port (SPP) is selected.  If it isn't, selelect it now and a new COM port will be created.  This COM port (the one that appears next to the Serial Port (SPP) option) is the COM port to use in your example code.
  16. You can also use a Serial Port Monitor application, such as Termite, to connect to the STM32 device.

 

How to use a built-in Bluetooth module on a PC for the VB.NET examples

The following steps will guide you through the steps to succesfully create a SPP (Serial Port Profile) from a PC's built-in Bluetooth module to the HC-06 Bluetooth module on the STM32F3 to use with the VB.NET examples:

  1. Make sure the Bluetooth function is enabled on the PC.
  2. Sometimes a COM port for the Bluetooth module already exists and will appear as "Standard Serial over Bluetooth link (COM XX)".  This is NOT the COM port we are going to use.
  3. Make sure the STM32 device and HC-06 is powered up.
  4. The STM32 device with the HC-06 module now needs to be added as a device to the PC.  Click on Start -> Devices and Printers.
  5. Click Add a device
  6. Wait for the PC to detect your device. 
  7. Select you device in the list and click Next.
  8. Wait for the PC to make a connection to the device.
  9. Click Enter the device's pairing code.
  10. Type "1234" (or whatever you changed the pin to) and click Next
  11. Click Close
  12. Still in the Add Device window, right click on your STM32 device and select Properties.
  13. Select the Services tab.
  14. Make sure that Serial Port (SPP) is selected.  If it isn't, selelect it now and a new COM port will be created.  This COM port (the one that appears next to the Serial Port (SPP) option) is the COM port to use in your example code.
  15. You can also use a Serial Port Monitor application, such as Termite, to connect to the STM32 device.