Installing ‘bluepy’ on EV3

Another python BLE library – not the most maintained, certainly not the most trendy but at the moment the only one I managed to install and use on EV3 (running ev3dev of course): bluepy.

Short instructions:

  • start from a totally fresh ev3dev installation
  • enable Wi-Fi and Bluetooth (assuming you have a USB hub with a compatible Wi-Fi dongle and a compatible BLE dongle)
  • update:

sudo apt update
sudo apt upgrade
sudo apt dist-upgrade

  • install ‘pip’ and ‘bluepy’ requirements (~15 min):

sudo apt install python3-pip libglib2.0-dev libcap2-bin

  • update ‘pip’:

python3 -m pip install --upgrade pip

  • install ‘bluepy ‘at last (~25 min):

python3 -m pip install bluepy

  • give proper permissions:

sudo setcap 'cap_net_raw,cap_net_admin+eip' ~/.local/lib/python3.5/site-packages/bluepy/bluepy-helper

  • test it:

robot@ev3dev:~$ /home/robot/.local/bin/blescan
Scanning for devices…
Device (new): 90:84:2b:4b:bf:59 (public), -70 dBm
Flags: <06>
Tx Power: <00>
Incomplete 128b Services:
Complete Local Name: 'Pybricks Hub'

A few notes:

  • I used ‘ev3dev-stretch-ev3-generic-2020-04-10’ that’s the same version that LEGO EDECUATION calls ‘EV3 Micropython 2.0’ and already includes Pybricks
  • bluepy uses a “bluepy-helper” based on BlueZ’s gatttool, it has been deprecated and sooner or later will be removed from BlueZ stack
  • there are some known bugs in ‘bluepy’ that have been fixed in a fork, see ‘ble-serial‘ instructions on how to install it if you think it might help

this had been used with this script to control the Top Gear technic car after flashing the Control+ hub with Pybricks 3.0.0a firmware:

sometimes the script fails after establishing the connection with the Nordic UART Service, not sure why yet.

Missa digital

Nesta paróquia da Diocese de Leiria onde viemos passar o fim de semana a igreja tem 2 televisores LCD que na missa vespertina passam as letras dos cânticos em formato karaoke. Além disso os próprios cânticos são em playback e em vez do regente do coro há um segundo ambão com mesa de som.

Aos Domingos as leituras passam também nos ecrans.

Dizem-me que este software litúrgico está à venda, com algum sucesso. Imagino que daqui a uns anos saia um upgrade com um pregador a assegurar as homílias. Se houver a opção «10 minutos, sem devaneios nem fugas ao tema» e a opção de download de vários avatares 3D à escolha então sim, as vendas serão colossais!

(in)segurança digital

O meu banco ligou-me, 2 movimentações suspeitas do meu Visa somando quase €200. Cartão suspenso preventivamente e já cancelado.

Não uso cartão de crédito directamente na Net, tenho para isso uma conta Paypal já enferrujada, tanto que há alguns anos que não actualizava a informação… mas curiosamente fi-lo há 4 meses, sem qualquer movimento posterior.

Portanto terá ocorrido uma fuga:

  1. na Paypal?
  2. na Visa?
  3. no meu banco?

Muito seguro, este admirável mundo novo.