faizi
Posts: 1
Joined: Mon Oct 21, 2019 5:03 pm

Auto Serial Connection between Raspberry pi zero w's Bluetooth and HC05 bluetooth module

Mon Oct 21, 2019 5:36 pm

Hi guys!!!!!!
Its my very first post on this platform.If I do any mistakes in posting my query plz forgive me.
I am communicating a famous String "Hello World!!!" between Raspberry pi's builtin Bluetooth and HC05 which is connected to Arduino.
Communication has been done successfully.
But I want to achieve the following
  • Whenever I start my pi the Bluetooth should automatically connected.So because I don't wanna do it again and again to connect them manually
I am using Bluetooth Manager as GUI for Bluetooth.
My python code is following.

Code: Select all

import serial
import time
port = serial.Serial("/dev/rfcomm0",baudrate=38400)
while True:
    port.write(b'Hello World!!!')
    print('sent')
    time.sleep(1)

User avatar
Douglas6
Posts: 4778
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Auto Serial Connection between Raspberry pi zero w's Bluetooth and HC05 bluetooth module

Mon Oct 21, 2019 6:38 pm

Here's what I would do.
1. Start rfcomm using a systemd service unit. See here: https://www.raspberrypi.org/forums/view ... 1#p1550791

2. Start your program using the same unit, a different unit, or one of the many methods you can find on this forum for starting a program at boot time.


Return to “Troubleshooting”