Not able to connect to Bluetooth lightbulb

Posted on
  • I've been struggling with some basic attempts to connect to a "KuLight" (BT 4.0 RGB LED light from here: http://www.ebay.co.uk/itm/332254514323)

    Any attempt at connecting seems to kill the console connection to the PC. The IDE prompt hangs until I hit Enter a few times and often prints out "<- Serial1" or "ERROR: Prompt not detected - upload failed. Trying to recover"

    This is with code as simple as:

    NRF.connect("e1:fb:c1:6b:81:6f").then(fu­nction(gat) {
      console.log("Gat: " + gat);
    }).catch(function(e) {
          console.log( "catch caught an error!");
          console.log( "error:", e );
    });
    

    Tried on 1v92. 1v93 and master.

    I have no issues communicating with the light using either its own ColorfulLight App or nRF Toolbox.

    This is on standalone IDE on Windows 10. New battery etc.

    Do I need to setup a hardwired serial connection to Puck to really get to the bottom of it?

    Feels like I'm missing something very obvious.

  • Getting <- Serial1 is very strange indeed. What happens if you just copy/paste the code into the left-hand side?

    I tried it here with the latest travis build and it worked (well, it showed an error that it couldn't connect) - but then obviously I don't have a light to connect to. I did get a slight delay sometimes though, which I assume was it searching for the device.

    I just ordered a light to have a play with - I'd been steering clear of those lights, because I assumed they must be using normal (non-LE) Bluetooth for the music... But maybe they use a separate Bluetooth LE radio for the light?

  • Same result if I paste. Console freezes, and then recovers after a few keypresses and gives that <-Serial1 message.

    I'm not sure if they are BLE at all. Should that still work?

    Going to check Puck itself too. I had some stuff soldered which I removed and I wonder if I've bridged two pads or something.

  • Slightly different on Mac. Again the console freezes but then the IDE says Disconnected and it takes 10-20 seconds before I can reconnect again. The problem only seems to occur when trying to connect. I can do this no problem:

    var devices;
    NRF.findDevices(function(d) {
      devices = d;
      console.log(devices);
    }, 1000);
    
  • When you do findDevices, can you see the light bulb? If so I'd be pretty sure it is a BLE device.

    I had some stuff soldered which I removed and I wonder if I've bridged two pads or something.

    Ahh, that might explain -> Serial1 then - and it'd flatten your battery down quite quick. Basically if the default UART RX pin is connected to 3v at power-on, the Serial port is initialised - but it takes up a decent amount of power to keep it running.

    I'd see if you can sort that out, as it's possible it is responsible in some way...

  • findDevices sees the bulb but only when very very close.

    I'll check the UART RX pin, thanks! The first general clean-up didn't seem to help.

  • Ok this is even weirder. On the off-chance, I decided to try and connect to a Milestone Pod instead. It worked perfectly. So it seems that the lightbulb is doing "something" to mess with the Puck. I'll try and connect a Serial-USB dongle later.

  • Ok, thanks! Well, at least I have one coming so can check.

  • Running the code connected via Serial-USB shows that it's just an "error: Connection Timeout" happening. Not sure why that would cause such issues for the PC-Puck connection.

    Here's what NRF.findDevices returns for that light:

    BluetoothDevice { 
        "id": "e1:fb:c1:6b:81:6f random", 
        "rssi": -64, 
        "services": [  ], 
        "data": new ArrayBuffer([8, 9, 75, 117, 76, 105, 103, 104, 116, 3, 25, 52, 18, 2, 1, 6]), 
        "name": "KuLight"
       }
    

    Ah wait a sec, just changing the ID to "e1:fb:c1:6b:81:6f random" did the trick! What does that even mean?

    Now happily communicating with the light. Managed to turn it off. Now to figure out the rest of the config settings via the nRF Connect App.

  • Great!

    BLE has two different types of addresses (possibly 3) - but public means the MAC address is unique in the world, and random means it's probably only unique on your local network. If you don't specify a type, Espruino guesses you meant public.

    Quite why a Connection Timeout should cause it to disconnect from your PC I don't know though - hopefully I'll be able to reproduce it here.

  • Ok, now that's strange... Did you edit the original post and change the link to eBay at all?

    I could have sworn I ordered the light you linked - which I thought was this one: http://www.ebay.co.uk/itm/12W-B22-E27-Wi­reless-Bluetooth-Music-Speaker-28-LED-RG­B-Bulb-Light-Lamp-New/263065714049

    But that's not where the link goes now...

    Anyway, I can now confirm - those speaker-based bulbs are definitely not Bluetooth LE devices. They seem to use the Bluetooth A2DP for sound, which also provides a side-channel which I guess is used for bulb control.

  • That's definitely not the bulb. Can they re-use URLs like that on eBay for different products?

    Ah no, the message at the top of the page is that the original product is gone and they are showing a possible alternative.

    I think this is the thing I ordered: http://www.ebay.co.uk/itm/E27-RGB-4-5W-L­ED-Bulb-Light-Wireless-Bluetooth-Control­-Home-Bar-Lamp-Decor/292209739874

  • Aha - that might be what happened then. Probably me just clicking though in a hurry :)

    Interestingly I already have one that look just like that, but from what I can tell it has a totally different Bluetooth name. Perhaps we should set up a repo of known bluetooth lamp types and UUIDs?

    I've been playing with another BLE bulb I have though, and have found that the Enable Bluetooth HCI snoop log developer option in Android is great. You just turn it on, copy the file off /sdcard/0 and then open it in wireshark. It's not super user-friendly, but you can at least make out all the read & write commands the app makes!

  • Having a repo of UUIDs would be really helpful. I found zero info trying to Google "KuLight" other than the Android App.

    That's a brilliant tip re Wireshark!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Not able to connect to Bluetooth lightbulb

Posted by Avatar for ConorONeill @ConorONeill

Actions