not logged in | [Login]
The Bluetooth module HC05 is available in the Micro Python Store.
The physical pins of the UART buses 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)
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 |
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)
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
Last edited by Bingyu Zhou, 2017-06-03 12:32:42