Cannot connect to PicarX via Bluetooth or WiFi (from EZBlock Studio App or Web)

I installed the image on the instructions on my RasberryPi 4B:
Raspios-buster-armhf-lite-2021-1-11_EzBlockOS-v1.2.1.img

I can connect via SSH, but…
When trying to connect via Bluetooth from the App, from both an ipad and an Android phone (freshly installed), I always get:
“Bluetooth connection failed”

Here is my /opt/ezblock/log file:

------------------------23/07/04 16:38:31------------------------
23/07/04 16:38:31,067 [Entry] python_version: 3.7.3
23/07/04 16:38:32,038 [Entry] ezblock-service start version: 1.2.1
23/07/04 16:38:32,039 [websokcets] Ezb_Service.start_service
23/07/04 16:38:32,443 [reset_servo] Products type: PiCarMini
23/07/04 16:38:32,474 [reset_servo] i2c_adress_list: ['0x14']
23/07/04 16:38:32,474 [reset_servo] picarx init
23/07/04 16:38:32,487 [reset_servo] reset_servo error for PiCarMini:[Errno 2] No such file or directory: '/home/pi/.config'
23/07/04 16:38:32,488 [websokcets] Ezb_Service.ezb_service_start
23/07/04 16:38:32,726 [websokcets] WS.user_service_start does not auto-run
23/07/04 16:38:32,734 [websokcets] [Process] __start_ws__: 8864
23/07/04 16:38:32,741 [websokcets] WS.__start_ws__
23/07/04 16:38:32,802 [BLE] Not BLE only, changing config
23/07/04 16:38:33,549 [BLE] Registering advertisement OK :/org/bluez/example/advertisement0
23/07/04 16:38:33,552 [BLE] BLE: Agent registered
23/07/04 16:38:33,555 [websokcets] BLE start: ezb-Raspberry
23/07/04 16:38:33,560 [websokcets] bluetooth_status_led thread start
23/07/04 16:38:33,575 [BLE] BLE: GATT application registered
23/07/04 16:38:33,581 [BLE] BLE: Advertisement registered OK
23/07/04 16:38:33,587 [websokcets] got ip: 192.168.1.20
23/07/04 16:38:33,806 [websokcets] [Process] websocket_service_process: 8891
23/07/04 16:38:34,018 [websokcets] no process occupies port 7852
23/07/04 16:38:34,018 [websokcets] open websockets server
23/07/04 16:38:36,228 [websokcets] client connected
23/07/04 16:38:36,237 [websokcets] [Process] ws_battery_process_start: 8969
23/07/04 16:38:36,245 [websokcets] start getting battery thread by websocket process
23/07/04 16:38:46,715 [websokcets] client connected
23/07/04 16:39:00,090 [websokcets] client connected
23/07/04 16:39:00,092 [websockets] recv_data_load:{'RE': 'all', 'APP': '3.2.137'}
23/07/04 16:39:00,117 [websokcets] send data: {'name': 'null', 'type': 'PiCarMini', 'version': '1.2.1', 'mac': 'D8:3A:DD:19:9C:8A', 'auto-run': 'False', 'ip': '192.168.1.20', 'voltage': '7.94', 'battery': 67.14}
23/07/04 16:47:31,997 [BLE] ble interfaces_added: 0
23/07/04 16:47:37,934 [BLE] ble properties_changed: 1
23/07/04 16:47:41,784 [BLE] ble interfaces_added: 0
23/07/04 16:47:47,684 [BLE] ble properties_changed: 1
23/07/04 16:47:48,971 [BLE] ble interfaces_added: 0
23/07/04 16:47:54,839 [BLE] ble properties_changed: 1
23/07/04 16:48:20,489 [BLE] ble interfaces_added: 0
23/07/04 16:48:26,399 [BLE] ble properties_changed: 1
23/07/04 16:48:28,961 [BLE] ble interfaces_added: 0
23/07/04 16:48:34,852 [BLE] ble properties_changed: 1
23/07/04 16:48:36,143 [BLE] ble interfaces_added: 0
23/07/04 16:48:42,053 [BLE] ble properties_changed: 1
23/07/04 16:52:01,913 [websokcets] client connected
23/07/04 16:52:22,514 [websokcets] client connected

Please help, we have had the product for a few weeks and still have not been able to make it work.

Thanks

Figured out the problem from the Log itself:

Turns out I was setting a different name for the username instead of “pi”.

In addition, once I burned the correct image into the SD card (using “pi” as the linux username), in order for Bluetooth to work we had to choose “Forget bluetooth connection” in our devices.

I believe it would be a good thing to clearly specify in the instructions that the linux username MUST be set to “pi”

Hope this saves some frustration!

ezblock The problem of username not being pi:

  1. This is a path error caused by the username not being pi
  2. You can login to the Raspberry Pi terminal via ssh or other means, and make it connect properly by modifying a line of code
  • Go to the folder: cd ~/ezb-pi/ezblock/

  • Edit the file: sudo nano ezblock/websockets.py

  • Press alt+shift+3 at the same time to show the line number

  • As shown in the figure, change the code in line 136 to Ezb_Service.set_share_val(‘debug’, [str(e), True]).
    Note that the indentation uses spaces

  • Press ctrl+o to save, press ctrl+x to exit

  • reinstall: sudo python3 setup.py install

  • Rerun: sudo server ezblock restart
    -At this point, you should be able to connect normally using the app, and after connecting, you will receive the version update and update it

  • When the update is complete, the Raspberry Pi will restart automatically and then you can use it normally.

  1. If you don’t mind, you can change the username to pi

  2. We will update the image in a few days after the test passes, you can download the latest image after that.