spled / spled.github.io

Apps for LED controller
https://spled.github.io/
11 stars 2 forks source link

Protocol for SP105E #1

Open alexlinde opened 6 years ago

alexlinde commented 6 years ago

Hi,

I'm trying to use the SP105E Magic Controller from my Mac, but there's no documentation on the protocol for the Bluetooth service or characteristic. Do you have a document you can share?

Thanks,

Alex

alorbach commented 6 years ago

I have a SP108E controller and the LED Shop app. I know its working on TCP Port 8189, but I also need API decription in order to access the controller and set pixels using my own APP directly.

pemontto commented 6 years ago

SP108E looks to use 6 byte packets to port 8189. The first byte is always 0x38 and the last byte is always 0x83. In between the data is transferred on the 2nd, 3rd and 4th byte and the 5th byte is used to signify the mode.

E.g. changing colours (5th byte is 22) uses RGB values 0x38FFFFFF2283 (white) 0x38ff00002283 (red) 0x380000ff2283 (blue)

Setting the number of LEDs (5th byte is 2d) uses the 2nd byte for the value (0-255) 0x380100192d83 (set to 1) 0x38ff005d2d83 (set to 255)

alorbach commented 6 years ago

Indeed ... founds some things reverse engeneering the Ledshop Android APP:

public enum b { START_FLAG((byte) 56, "START_FLAG"), END_FLAG((byte) -125, "END_FLAG"), CMD_CHECK_DEVICE((byte) -43, "CMD_CHECK_DEVICE"), CMD_TOGGLE_LAMP((byte) -86, "CMD_TOGGLE_LAMP"), CMD_GET_DEVICE_NAME((byte) 119, "CMD_GET_DEVICE_NAME"), CMD_SET_DEVICE_NAME((byte) 20, "CMD_SET_DEVICE_NAME"), CMD_SET_DEVICE_PASSWORD((byte) 22, "CMD_SET_DEVICE_PASSWORD"), CMD_SET_DEVICE_TO_AP_MODE((byte) -120, "CMD_SET_DEVICE_TO_AP_MODE"), CMD_SET_RGB_SEQ((byte) 60, "CMD_SET_RGB_SEQ"), CMD_SET_IC_MODEL((byte) 28, "CMD_SET_IC_MODEL"), CMD_CUSTOM_PREVIEW((byte) 36, "CMD_CUSTOM_PREVIEW"), CMD_CUSTOM_RECODE((byte) 76, "CMD_CUSTOM_RECODE"), CMD_CUSTOM_EFFECT((byte) 2, "CMD_CUSTOM_EFFECT"), CMD_CUSTOM_DELETE((byte) 7, "CMD_CUSTOM_DELETE"), CMD_SYNC((byte) 16, "CMD_SYNC"), CMD_MODE_CHANGE((byte) 44, "CMD_MODE_CHANGE"), CMD_SPEED((byte) 3, "CMD_SPEED"), CMD_BRIGHTNESS((byte) 42, "CMD_BRIGHTNESS"), CMD_WHITE_BRIGHTNESS((byte) 8, "CMD_WHITE_BRIGHTNESS"), CMD_COLOR((byte) 34, "CMD_COLOR"), CMD_GET_RECORD_NUM((byte) 32, "CMD_GET_RECORD_NUM"), CMD_DOT_COUNT((byte) 45, "CMD_DOT_COUNT"), CMD_SEC_COUNT((byte) 46, "CMD_SEC_COUNT"), CMD_CHANGE_PAGE((byte) 37, "CMD_CHANGE_PAGE"), CMD_MODE_AUTO((byte) 6, "CMD_MODE_AUTO"), CMD_CHECK_DEVICE_IS_COOL((byte) 47, "CMD_CHECK_DEVICE_IS_COOL");

public static final int[] c = new int[]{205, 206, 209, 212, 211, 207, 210, 208}; public static final String[] d = new String[]{"METEOR", "BREATHING", "WAVE", "CATCH-UP", "STATIC", "STACK", "FLASH", "FLOW"}; public static final String[] e = new String[]{"FREQ_USER_COLOR_0", "FREQ_USER_COLOR_1", "FREQ_USER_COLOR_2", "FREQ_USER_COLOR_3", "FREQ_USER_COLOR_4", "FREQ_USER_COLOR_5", "FREQ_USER_COLOR_6"}; }

Not easy to read but I think protocol can be reverse engeenered enough to get control over the SP108E controller ;)

alorbach commented 6 years ago

0x38FFFFFF2283 (white) = START_FLAG & RGB Bytes & CMD_COLOR & END_FLAG

I guess this is how thre packet has to be build

pemontto commented 6 years ago

Tested this code and it worked ok, nothing special required just a plain TCP connection.

import socket import time

ip='192.168.1.206' port=8189

START_FLAG = '38' END_FLAG = '83' COLOUR_MODE = '22'

WHITE = 'ffffff' RED = 'ff0000' GREEN = '00ff00' BLUE = '0000ff'

def get_bytes(data, mode): return (START_FLAG + data + mode + END_FLAG).decode('hex')

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((ip, port)) s.send(get_bytes(WHITE, COLOUR_MODE)) time.sleep(1) s.send(get_bytes(RED, COLOUR_MODE)) time.sleep(1) s.send(get_bytes(GREEN, COLOUR_MODE)) time.sleep(1) s.send(get_bytes(BLUE, COLOUR_MODE)) time.sleep(1)

I've no experience writing libraries but it shouldn't be terribly hard. What I would like to be able to do is use this in home assistant.

hamishcoleman commented 5 years ago

I have had some success working out the protocol used - see https://github.com/hamishcoleman/led_sp108e

I'm still looking for a way to control the pixels individually, but the protocol might not support that

pemontto commented 5 years ago

@hamishcoleman that looks great! Ideally we could integrate with https://github.com/beville/flux_led I had a brief look, but you should see if you can piggyback off that work and create a PR. Then we would instantly have Home Assistant et al. support.

rbrenton commented 5 years ago

Here is some of what I've figured out. I haven't seen anyone mention this yet, but there needs to be a delay after most commands before the controller will process another command. I haven't figured out the exact delay needed yet, but started tinkering with it.

#!/usr/bin/python
import select
import socket
import time
from collections import OrderedDict

START_FLAG = '38'
END_FLAG = '83'

CMD_CUSTOM_EFFECT         = '02'
CMD_SPEED                 = '03'
CMD_MODE_AUTO             = '06'
CMD_CUSTOM_DELETE         = '07'
CMD_WHITE_BRIGHTNESS      = '08'
CMD_SYNC                  = '10'
CMD_SET_DEVICE_NAME       = '14'
CMD_SET_DEVICE_PASSWORD   = '16'
CMD_SET_IC_MODEL          = '1C'
CMD_GET_RECORD_NUM        = '20'
CMD_COLOR                 = '22'
CMD_CUSTOM_PREVIEW        = '24'
CMD_CHANGE_PAGE           = '25'
CMD_BRIGHTNESS            = '2A'
CMD_MODE_CHANGE           = '2C'
CMD_DOT_COUNT             = '2D'
CMD_SEC_COUNT             = '2E'
CMD_CHECK_DEVICE_IS_COOL  = '2F'
CMD_SET_RGB_SEQ           = '3C'
CMD_CUSTOM_RECODE         = '4C'
CMD_GET_DEVICE_NAME       = '77'
CMD_SET_DEVICE_TO_AP_MODE = '88'
CMD_TOGGLE_LAMP           = 'AA'
CMD_CHECK_DEVICE          = 'D5'

class SP108E_Controller:

    def __init__(self):
        # Settings
        ip = '192.168.4.1'
        port = 8189

        print "Connecting to %s:%s" % (ip, port)

        # Open connection.
        self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.s.connect((ip, port))
        self.s.setblocking(0)

        data = self._sendrecv(CMD_GET_DEVICE_NAME, '000000') # \0SP108E_1f5e6f
        print "Connected to %s" % (data)

        self.sync()

    def __get_bytes(self, data, mode):
        return (START_FLAG + data + mode + END_FLAG).decode('hex')

    def _sendrecv(self, cmd, data, delay = 0.0, debug = False):
        self._send(cmd, data, delay, debug)

        data = self._recv(debug)

        if debug == True:
            print ""

        return data

    def _send(self, cmd, data, delay = 0.0, debug = False):
        if debug == True:
            print "Sending: cmd %s data %s (%s)" % (cmd, data.decode('hex'), data)

        self.s.send(self.__get_bytes(data, cmd))

        if cmd == CMD_SET_DEVICE_NAME:
            delay = max(1.0, delay)
        elif cmd == CMD_BRIGHTNESS:
            delay = max(0.10, delay)
        elif cmd == CMD_COLOR:
            delay = max(0.02, delay)
        else:
            delay = max(0.05, delay)

        time.sleep(delay)

    def _recv(self, debug = False):
        if debug == True:
            print "Checking recv."

        data = ''
        ready = select.select([self.s], [], [], 1)

        if ready[0]:
            data = self.s.recv(4096)
            if debug == True:
                print "Response: %s (%s)" % (data, data.encode('hex'))
        else:
            if debug == True:
                print "No response.";

        return data

    def pulse(self):
        delay = 0.25
        self.setBrightness('40', delay)
        self.setBrightness('50', delay)
        self.setBrightness('40', delay)
        self.setBrightness('30', delay)
        self.setBrightness('20', delay)
        self.setBrightness('10', delay)
        self.setBrightness('20', delay)
        self.setBrightness(self.settings['brightness']['str'], delay)

    def sync(self):

        # Check state.
        #self._sendrecv(CMD_CHECK_DEVICE, '000000', 0, True) # 0x010203040500
        #self._sendrecv(CMD_GET_RECORD_NUM, '000000', 0, True) # 0x03
        #self._sendrecv(CMD_CHECK_DEVICE_IS_COOL, '000000', 0, True) # 0x31 "1"
        #self._sendrecv(CMD_SYNC, '000000', 0, True) # 0x3801d001230200960006fefdfc0303ff83

        # Bytes.
        # 00 - 38 = START_FLAG
        # 01 - 01 = on/off (01/00)
        # 02 - d3 = pattern (cd=meteor, ce=breathing, cf=stack, d0=flow, d1=wave, d2=flash, d3=static, d4=catch-up, fa=off?)
        # 03 - 63 = speed (01-ff)
        # 04 - 20 = brightness
        # 05 - 02
        # 06 - 00
        # 07 - 96 = dot count
        # 08 - 00
        # 09 - 06 = sec count
        # 10 - ff = red
        # 11 - ff = green
        # 12 - ff = blue
        # 13 - 03
        # 14 - 03
        # 15 - ff
        # 16 - 83 = END_FLAG

        # 0x3801 db cc 80 0200960006 888888 0303ff83 pattern
        # 0x3801 d0 01 23 0200960006 fefdfc 0303ff83

        print "Fetching state..."
        data = self._sendrecv(CMD_SYNC, '000000') # 0x3801d001230200960006fefdfc0303ff83
        print "Received: %s" % data.encode('hex')

        settings = OrderedDict()

        def fill(settings, key, value):
            settings[key] = { 'raw': value, 'str': value.encode('hex') }

        fill(settings, 'power',      data[1])
        fill(settings, 'pattern',    data[2])
        fill(settings, 'speed',      data[3])
        fill(settings, 'brightness', data[4])
        fill(settings, 'dot_count',  data[7])
        fill(settings, 'sec_count',  data[9])
        fill(settings, 'red',        data[10])
        fill(settings, 'green',      data[11])
        fill(settings, 'blue',       data[12])

        for key in settings:
            print "%s: %s" % (key.ljust(16), settings[key]['str'])

        self.settings = settings

    def setColor(self, value, delay = 0.0):
        print "Setting color to %s" % value
        self._send(CMD_COLOR, value, delay)

    def setBrightness(self, value, delay = 0.0):
        print "Setting brightness to %s" % value
        self._send(CMD_BRIGHTNESS, value + value + value, delay)

    def setMode(self, value, delay = 0.0):
        print "Setting mode to %s" % value
        self._send(CMD_MODE_CHANGE, value + value + value, delay)

    def setSpeed(self, value, delay = 0.0):
        print "Setting speed to %s" % value
        self._send(CMD_SPEED, value + value + value, delay)

ctrl = SP108E_Controller()

ctrl.setColor('BA5B24')
time.sleep(1)
ctrl.setMode('db')
time.sleep(1)
ctrl.setColor('888888')
time.sleep(1)
ctrl.setBrightness('44')
time.sleep(1)
ctrl.setSpeed('66')
#ctrl.pulse()
#ctrl.sync()
#ctrl.setMode('50')
#time.sleep(1)
#ctrl.setMode('60')
#time.sleep(1)
#ctrl.setMode('70')
#time.sleep(1)
#ctrl.setMode('80')
#time.sleep(1)
#ctrl.setMode('db')

#ctrl._sendrecv(CMD_SYNC, '000000', 0, True) # 0x3801d001230200960006fefdfc0303ff83

#ctrl._send(CMD_SET_DEVICE_NAME, '00' + 'SP108E_test12.encode("hex"), 0, True)

#ctrl._send(CMD_COLOR, 'FF0000')
#ctrl._pulse()
#ctrl._send(CMD_COLOR, '00FF00')
#ctrl._pulse()
#ctrl._send(CMD_COLOR, '0000FF')
#ctrl._pulse()

# Patterns.
# 00 = rainbow
# 01 = multicolor chase
# 10 = meteor blue
# 20 = dot cyan
# 30 = line-follow yellow,green
# 40 = spread-close yellow
# 50 = long-chase
# 60 = short-chase
# 70 =
# 80 =
# 90 =
# a0 =
# b0 =
# c0 =
# cd = meteor
# ce = breathing
# cf = stack
# d0 = flow
# d1 = wave
# d2 = flash
# d3 = static
# d4 = catch-up

# db = custom1

# fa = off?
rbrenton commented 5 years ago

What I'm really after, is the protocol used to configure it into STA mode instead of AP mode, so that I can connect it to my network. Has anyone had any luck capturing this? The iOS app functionality to do this has not worked for me (#2).

pemontto commented 5 years ago

@rbrenton I've managed to get it to connect a few times, but whenever it gets power cycled it goes straight back to AP mode. I'll try to capture the traffic next time I have a chance.

rbrenton commented 5 years ago

I have a little arduino yun that I'm using, which can connect to 2 networks at once. I can automate something to check for it and reconfigure it each time. I'm working on a small page/script to give it a web interface; I'll share when it's functional.

Part of my problem is not being entirely sure I'm taking the right steps to configure the network. The wifi password it asks for, is that the 12345678 default password, or the password of the network it needs to connect to? How does it know the SSID of the network it's supposed to connect to? Does the phone use it's currently connected network as the config value? How is it communicating with the device when it's in configuration mode for the first 20 seconds after power on? Ad-hoc network?

rbrenton commented 5 years ago

I got this running on an Arduino Yun. https://github.com/rbrenton/sp108e

It's a web page that lets you send commands directly to the controller without the phone app. I'll extend it as we figure out more of the protocol. It's neat though, because I can have my Yun on the 192.168.4.0/24 wireless network that it creates, and have the Yun's ethernet port plugged in to my local network. So, it's acting as a bridge and interface for the controller with minimal setup.

hamishcoleman commented 5 years ago

I tried a couple of times to configure the device to connect to the wifi, but was never successful, so I have not captured that traffic - and I cannot see anything obvious from the CMD list above, its like it is missing a cmd to do that step..

it looks like CMD_CUSTOM_PREVIEW might allow me to control the individual LED values, so that is where i am looking next

rbrenton commented 5 years ago

I tried a couple of times to configure the device to connect to the wifi, but was never successful, so I have not captured that traffic - and I cannot see anything obvious from the CMD list above, its like it is missing a cmd to do that step..

it looks like CMD_CUSTOM_PREVIEW might allow me to control the individual LED values, so that is where i am looking next

Can it hold more than one custom pattern? Your notes are pretty good; we should put that up on a wiki and collaborate.

hamishcoleman commented 5 years ago

It may hold more than one pattern - the app has some "record" thing that I have not looked at and a bunch of boxes to "record" into. The RGB data is suspiciously sparse too - there are 15 bytes to transfer each 3 byte RGB.

All that being said though, I've been concentrating on finding out what frame rate I can get. The latest commits to my repo include my work from today, which includes a tool that successfully mirrors my desktop to the LEDs

rbrenton commented 5 years ago

The raw commands need a delay. I created a pulse function and had it ramp up/down the brightness and I had to use 1/4 second delays. I've done custom patterns from the phone app; maybe I'll try to capture those packets.

hamishcoleman commented 5 years ago

The only delays I have needed were easily provided by ensuring that I read the acknowledgement packet from the device after sending the CMD_CUSTOM_PREVIEW. I am getting quite high frame rates with no stalls or delays with my current code

hamishcoleman commented 5 years ago

(this, of course, only works if you send commands that generate a response, but that is a good reason for using the 0xd5 and 0x10 commands all the time as they always generate a response - which is what the phone app seems to be doing)

pemontto commented 5 years ago

@rbrenton, once I've managed to get it into STA mode it connects to the network my mobile device is currently connected to and grabs a DHCP lease.

hamishcoleman commented 5 years ago

@rbrenton are you able to capture the packets that your phone is sending during all that? I, too, would like to try and automate that bit (and I've never been able to get the app to put the device into STA mode)

rbrenton commented 5 years ago

@hamishcoleman I haven't tried capturing the packets. I might set up a proxy on the arduino yun and use it to capture. Yeah, I think I'll do that.

@pemontto Neat. So, you power cycle the controller, and immediately tap Add with the '12345678' wifi password in the app, and it worked?

hamishcoleman commented 5 years ago

After some mucking around, I have been successful at adding my LED controller to my local wifi - and I have written up my steps (See https://github.com/hamishcoleman/led_sp108e/commit/d8ba4371ae9d713f4494ed863c6a3b1339fed7e5#diff-a5d5286f1e67b6cd6876223e53f999c4R30)

hamishcoleman commented 5 years ago

I think I understand how the WIFI config is implemented, and can see why it might be a little unreliable.

I have updated my notes with what I have discovered (See https://github.com/hamishcoleman/led_sp108e/commit/56b8e9db755fbc7c5132e0d1265e8e564a743090#diff-a5d5286f1e67b6cd6876223e53f999c4R275)

rbrenton commented 5 years ago

@hamishcoleman this is great! I think there is a way to purge the git history to remove the encoded psk, though I do like having sample data. I'm guessing it's been so difficult for me to perform this operation because I'm in a busy wifi area.

rbrenton commented 5 years ago

On another note, we are basically sending out an obsfucated but unencrypted psk to anyone listening. Is there a way to just change the wifi password of the controller on AP mode? If so, I wonder if that sticks.

hamishcoleman commented 5 years ago

The encoded PSK that I put in that commit is just sample data, so I'm not worried about leaving it there. I would have said that where I am has quite busy wifi too - but yes, it is more likely to fail with busier areas - which is why the app repeats sending the data multiple times.

I have not found any packet types that look like they will configure STA mode from AP mode :-( I can change the ssid used by the AP mode and the password for the AP mode, and they seem to be saved after power-cycling

Daizygod commented 5 years ago

where can found a protocol for sp110e? I want do app on android (i already know about "ledhue")

michaelkleinhenz commented 5 years ago

@hamishcoleman I am playing around with the CMD_CUSTOM_PREVIEW sample code from your repository, but I get flaky results. I think this is caused by some delays I need to do inbetween sending data. Any hints?

hamishcoleman commented 5 years ago

@michaelkleinhenz what kind of "flaky" are you getting? I didnt find that I needed to have any delays at all (in fact, the faster I could send things, the better the video effect was)

michaelkleinhenz commented 5 years ago

@hamishcoleman multiple things, I use a 300 leds setting, which should give me 1:1 mapping on triplets in the 900 bytes if I correctly understand your notes.

One note here: I am not using your code directly, but ported it to an esp8266. From your notes, It could also have something to do with the MTU.

michaelkleinhenz commented 5 years ago

Ohm and everything works fine with the original app, so I do think the dropouts are not an electrical issue..

michaelkleinhenz commented 5 years ago

I wonder what kind of jerk the original developer was for not doing a proper restful api there.

michaelkleinhenz commented 5 years ago

Ok, interesting. I just tested out your code directly and this seems to work. I would bet it has something to do with the MTU.

hamishcoleman commented 5 years ago

random leds blinking does indeed sound like a TCP segmentation issue - I remember noticing some of this before I ignored it with my MTU hack. I did intend to go back and try and reverse what was happening in those cases, but I suspect that they are reading each TCP segment into a fixed buffer and assuming it is a full transaction..

As to why it was done this way - have you opened up the controller? there is a ARM micro being driven by an ESP8266. I expect that the serial protocol is probably identical to the one they used for bluetooth and for direct serial control - so they never changed the software running on the micro...

(So, you could even experiment with moving your code into the controller itself and reflashing the onboard ESP chip)

michaelkleinhenz commented 5 years ago

Ok, I will look into the MTU issue again. Looks like I can't change the MTU negotiation on the esp. I will likely try a raspi instead.

michaelkleinhenz commented 5 years ago

@hamishcoleman ok, it looks like it works stable from a desktop machine. Hacked a quick rest service and cli in golang from your command list and procedure. Will now try to see if it is running from a raspi: https://github.com/michaelkleinhenz/boardgametable. This only supports custom preview and brightness (this is all I need ;-).

X3n0Y commented 5 years ago

Hi everyone... I'm not a programmer or nothing else but i need someone that answer to all my questions: I have SP105E LED Controller for my WS2821B LED Strip and i was asking myself it if was possible to connect my SP105E to my pc and add more MODES and modify MODES already existing...modes already flashed into SP105E...I'm searching on web but NOTHING...can someone, that knows something about that, teach me if it's possible to do what i'm saying? Thanks you a lot!

tripzero commented 4 years ago

@hamishcoleman did you ever figure out how to control individual pixels?

hamishcoleman commented 4 years ago

@tripzero yes, I did - have a look at the x11-to-led code in https://github.com/hamishcoleman/led_sp108e

There are some limitations - mostly that no more than 300 LEDs can be individually controlled by the hardware.

tripzero commented 4 years ago

@hamishcoleman oh cool. I was looking in the python code where CMD_CUSTOM_PREVIEW was used in test or an example and it wasn't... Should have looked in the .c files too! I poked at it a bit trying to send bytes([commands.CMD_CUSTOM_PREVIEW]) + np.zeros((900)) but nothing happened. Need to understand the protocol a bit better I suppose.

hamishcoleman commented 4 years ago

Yeah, its a little fiddly in exactly what it accepts - I wrote my progress up in notes.txt (search for the section heading CMD_CUSTOM_PREVIEW), and there is some protocol description and buffer layout info there

LEDiMEISTER commented 4 years ago

Hello,

As original post was about SP105E I will answer about this controller: With ESP32 I used "BLEDevice.h" library BLEclient sample code static BLEUUID serviceUUID("FFE0"); static BLEUUID charUUID("FFE1");

I found some code to send over bluetooth and it works const uint8_t mode_auto[5] = {0x38, 0x00, 0x00, 0x00, 0x06}; const uint8_t mode_funct1[5] = {0x38, 0x01, 0x00, 0x00, 0x2C}; const uint8_t mode_funct2[5] = {0x38, 0x02, 0x00, 0x00, 0x2C}; const uint8_t mode_lightUp[5] = {0x38, 0x00, 0x00, 0x00, 0x2A};//7 steps const uint8_t mode_lightDown[5] = {0x38, 0x00, 0x00, 0x00, 0x28};//7 steps const uint8_t mode_speedUp[5] = {0x38, 0x00, 0x00, 0x00, 0x03};//7 steps const uint8_t mode_speedDown[5] = {0x38, 0x00, 0x00, 0x00, 0x09};//7 steps const uint8_t mode_OnOff[5] = {0x38, 0x00, 0x00, 0x00, 0xAA};

for sending I used pRemoteCharacteristic->writeValue(mode_xxx, sizeof mode_xxx);

Hopefully this is helpful for someone

LEDiMEISTER Andrus Estonia

McTristan commented 3 years ago

Hello,

As original post was about SP105E I will answer about this controller: With ESP32 I used "BLEDevice.h" library BLEclient sample code static BLEUUID serviceUUID("FFE0"); static BLEUUID charUUID("FFE1");

I found some code to send over bluetooth and it works const uint8_t mode_auto[5] = {0x38, 0x00, 0x00, 0x00, 0x06}; const uint8_t mode_funct1[5] = {0x38, 0x01, 0x00, 0x00, 0x2C}; const uint8_t mode_funct2[5] = {0x38, 0x02, 0x00, 0x00, 0x2C}; const uint8_t mode_lightUp[5] = {0x38, 0x00, 0x00, 0x00, 0x2A};//7 steps const uint8_t mode_lightDown[5] = {0x38, 0x00, 0x00, 0x00, 0x28};//7 steps const uint8_t mode_speedUp[5] = {0x38, 0x00, 0x00, 0x00, 0x03};//7 steps const uint8_t mode_speedDown[5] = {0x38, 0x00, 0x00, 0x00, 0x09};//7 steps const uint8_t mode_OnOff[5] = {0x38, 0x00, 0x00, 0x00, 0xAA};

for sending I used pRemoteCharacteristic->writeValue(mode_xxx, sizeof mode_xxx);

Hopefully this is helpful for someone

LEDiMEISTER Andrus Estonia

Yes it might, do you have a small code sample? I think your answer is based on the ESP32 BLE_client sample but as I'm absolutely not familiar with BLE nor the SP105E (well I've got 2 of them) a small sample would help enormously!

matths commented 3 years ago

I've got the SP110e, so I would appreciate more informations as well. I experiment using Bluetooth LE from within the browser. I can connect to the device using the service UUID, and i can send bytearrays to the characteristic, but I have no luck what exactly to send, sometimes some LED start to flash, but most of the time, it has no effect. I just don't understand the protocol.

So I tried to capture the traffic when using the SP110e with the LED Hue App in Android with the help of the "HCI Snoop Log" on a rooted smartphone, but as I have only a Mediatek based device, I do not get a standard snoop logfile but a mediatek proprietary bt_log, which is not readable with Wireshark.

So maybe, someone wants to share his experience, also about affordable alternatives.

michaelkleinhenz commented 3 years ago

Sometimes I ask myself what kind of complete idiots have designed those controllers. The SOCs in these things are capable of implementing a proper communication API, yet they settle on this weird byte-based communications that seems completely unreliable. If they would provide proper documentation on the whole thing, the community would happily develop a proper firmware for them to use instead of fiddling around with this garbage from the outside.

matths commented 3 years ago

Their business model is to sell hardware, not software. At least their HUE Led App is for free. So I partly share your opinion, that they could be more open to the community and profit this way selling more hardware as soon as one can easily do more stuff.

bad-jesus commented 3 years ago

Has anyone made any headway using the x-11 stream to set patterns using a single frame? (On the sp108e) I am trying to get this going with PHP. I would love to find, and be willing to pay for a valid and reliable example of a static pattern set. For example, 1 bulb warm white and then 1 off, repeated throughout the segment and pixel count. I believe it is capped at 300 pixel max? Any headway at all?

bad-jesus commented 3 years ago

@tripzero @hamishcoleman

Did either of you guys make any headway with the sp108e and individual pixel control? Either using Hamish's x-11 or CMD_CUSTOM_PREVIEW?

matths commented 3 years ago

I had no luck and am now using a PI Zero, which works great for me, see https://github.com/matths/rpi-ws281x-tixy

carl1961 commented 3 years ago

For what's it is worth, inside SP105E TM74HC245 Octal bus transceiver; 3-state https://assets.nexperia.com/documents/data-sheet/74HC_HCT245.pdf

GK068 32F030F4P6 CHN740RNA (STM32F030F4P6) ? https://pdf1.alldatasheet.com/datasheet-pdf/view/1132286/STMICROELECTRONICS/STM32F030F4.html

JPG00003 JPG00004 HM-10? https://github.com/plaguemorin/SP105E