iwalton3 / python-spotled

Allows control of SPOTLED bluetooth led displays via Python
MIT License
30 stars 7 forks source link

Problems connecting to sign #2

Closed uod-jhardy closed 2 months ago

uod-jhardy commented 11 months ago

Hi, I have been trying to connect to a spotled sign with this but I cannot make it work with your demo code. Using a Raspberry Pi 4 I have a problem with init.py at line 771 where I have an error ending with "Attribute can't be written". This may be related to a problem in the example.py where there is a problem at line 2, the sender definition is underlined in the error output. I have 64 bit bookworm installed and python3-gattlib 20210616-1+b1 Using a Pi3 the problem is with init.py at line 770 / 812 "timeout exceeded waiting for bluetooth connection". This is using 32 bit bullseye and gattlib 20201113. I can change the sign using the android app Any suggestions would be gratefully received.

uod-jhardy commented 11 months ago

Mistakenly closed!

Update. Pi 3 bluetooth is not working correctly (hardware problem). Tried on alterantive Pi but same configuration, problem same as with Pi 4. With both Pi3 and Pi4 i can connect to the sign using gatttool -b (mac) -I and then connect. I can read back the handles with char-desc.

gilraeon commented 10 months ago

Hi

Have a look at what I have done here - it may help

uod-jhardy commented 10 months ago

Hi gilraeon. Thanks for the update. I had a few problems locating the fonts folder, eventually copied it to /usr/local.lib/python3.11/dist-packages/spotled. After copying this I have problems with the example sending multiple lines (Value error: The animation exceeds the device frame limit) If I comment everything from "# send multiple pages ..." then the example seems to run (there is a few seconds delay before the terminal prompt returns) but there is no change to the display. Tried to comment on your repo directly but there is nowhere to do this

uod-jhardy commented 10 months ago

Sorry, I missed your new example file, I was using the original. This does update the display !! I cannot read the text but I assume that this is a format problem.

gilraeon commented 10 months ago

Maybe a bitmap or colour depth issue. Each type of display may need its own tweak - I only have the BD28 to work with.

My fork is very temperamental - e.g. doesn't update if you write too much text for the display. Also, watch out on Raspberry Pi if you use WiFi because I am having trouble with WiFi and Bluetooth interfering with each other.

uod-jhardy commented 10 months ago

I found the problem with WiFi and bluetooth, I turned the WiFi off to get the BT connection working. I will have another look at the characters later in the week and see if I can get something display clearly

uod-jhardy commented 2 months ago

Just an update, I went back to Gilraeon version of spotled and tried again, realised that the problem that you had "fixed" was avoiding getting the config data automatically from the display. Then I noticed that you had manually specified a width of 96 (line 823) whereas my display is only 64 bits, changed this and the display is clearly readable (on a single line).

Thanks iwalton for writing this in the first place and gilraeon for pointing me in the right direction!

madcock commented 2 months ago

I've been trying to get this to work with the (single color) 48x12 badge, and I'm assuming the firmware on these devices must have changed since this repo was created. With this iwalton3 repo, I can't connect to the badge at all.

Glad I found this thread, as @gilraeon's modifications at least allowed me to connect to the badge and send some data. Although I can't get text to send, and when trying the example bitmap code I can only get it to display a change to the top line of LEDs. After sending an update, I can't send any further updates without power cycling the device, as it gets a timeout/connection error. I'm guessing it's not finishing the update properly.

@uod-jhardy it sounds like I'm mostly doing what you did, but I'm not sure this thread/issue should be closed because the code here as-is doesn't seem to be working for anyone?

I started looking into capturing the bluetooth communication between the official SpotLED app and my badge. Managed to get bluetooth snooping going on my phone and I dumped the log and imported into wireshark. I've dabbled with wireshark in the past for wifi stuff, but this is my first attempt to use it for bluetooth traffic. Seems like it worked, and I have some examples to try to decode. When I have time, I'm hoping I can compare to the code here and with luck maybe it's not too different from what was being done before. But I feel like I'm well out of my comfort zone here...