Peripheral – A BLE peripheral device

Implement a BLE peripheral which runs locally. Set up using the supplied services, and then allow advertising to be started and stopped.


import bleio

# Create a Characteristic.
chara = bleio.Characteristic(bleio.UUID(0x2919), read=True, notify=True)

# Create a Service providing that one Characteristic.
serv = bleio.Service(bleio.UUID(0x180f), [chara])

# Create a peripheral and start it up.
periph = bleio.Peripheral([service])

while not periph.connected:
    # Wait for connection.
class bleio.Peripheral(services, *, name='CIRCUITPY')

Create a new Peripheral object. :param iterable services: the Service objects representing services available from this peripheral. :param str name: The name used when advertising this peripheral


True if connected to a BLE Central device.


A tuple of bleio.Service that are offered by this peripheral. (read-only)


The peripheral’s name, included when advertising. (read-only)

start_advertising(*, connectable=True, data=None)

Starts advertising the peripheral. The peripheral’s name and services are included in the advertisement packets.

  • connectable (bool) – If True then other devices are allowed to connect to this peripheral.
  • data (buf) – If None, advertise the services passed to this Peripheral when it was created. If not None, then send the bytes in data as the advertising packet.

Stop sending advertising packets.