not logged in | [Login]

The Bluetooth module HC05 is available in the Micro Python Store. HC05 Most of the content on this page was derived from Turbinenreiter's forum post

Resources

Pins

The physical pins of the UART busses are:

UART(4) is on XA: (TX, RX) = (X1, X2) = (PA0, PA1)
UART(1) is on XB: (TX, RX) = (X9, X10) = (PB6, PB7)
UART(6) is on YA: (TX, RX) = (Y1, Y2) = (PC6, PC7)
UART(3) is on YB: (TX, RX) = (Y9, Y10) = (PB10, PB11)
UART(2) is on: (TX, RX) = (X3, X4) = (PA2, PA3)

Connections

Connect the module to the pyboard as shown in the table below. Note: Connect the TX pin from the HC05 to the RX pin on the pyboard, and the RX pin from the HC05 to the TX pin on the pyboard.

pyb | hc05
3V3 | VCC
GND | GND
RX  | TX
TX  | RX

Modules

No custom modules are required, use the UART module:

from pyb import UART

uart = UART(1, 9600)                         # init with given baudrate
uart.init(9600, bits=8, stop=1, parity=None) # init with given parameters

Then use the following to send the REPL to the UART you created above

pyb.repl_uart(uart)

Connecting to your PC

Windows

  1. Search for 'Add Bluetooth Device'
  2. Scan for Bluetooth devices
  3. Connect to HC-05
  4. Enter pin 1234
  5. Search for 'Change Bluetooth settings'
  6. On the COM Ports tab find the 'Outgoing' COM port (eg: COM6)
  7. Use PuTTY to connect to your pyboard on the 'Outgoing COM port (eg: COM6) via Bluetooth

Ubuntu

Bluetooth - Set up new device - choose the device - Pin options '1234' - Next. Get the modules MAC address:

hcitool scan

Add the serial port by editing the file: /etc/bluetooth/rfcomm.conf

rfcomm0 {
    bind no;
    device MAC address of your module;
    channel 1;
    comment "Serial Port";
}

Then connect it with:

sudo rfcomm connect 0

Watch it with:

screen /dev/rfcomm0