Send binary/logic data

Hello experts!

I'm facing following problem.

I've captured the communication of the batterys bms on the bus of my electric scooter with a logic analyzer. Unfortunatly I cant really recognize, what kind of protocol this is. I've tried different baud rates. The shortes bit is about 500us long.

I want to replay the data I've got from the original bms with an esp to use it with a diy battery.

Communication is only on 1 wire, so its ground and data signal.

Would appreciate any help or hint, how to continue.

Time [s],Channel 7
0.186132321,1
0.227964000,0
0.242784000,1
0.243800000,0
0.244782000,1
0.245290000,0
0.246280000,1
0.246788000,0
0.247278000,1
0.248284000,0
0.248778000,1
0.249780000,0
0.250274000,1
0.251278000,0
0.252270000,1
0.252778000,0
0.253270000,1
0.254274000,0
0.255264000,1
0.255790000,0
0.256762000,1
0.257270000,0
0.258262000,1
0.258768000,0
0.259758000,1
0.260266000,0
0.260758000,1
0.261762000,0
0.262754000,1
0.263262000,0
0.263752000,1
0.264758000,0
0.265252000,1
0.266254000,0
0.267246000,1
0.267770000,0
0.268744000,1
0.269252000,0
0.270242000,1
0.270748000,0
0.271740000,1
0.272246000,0
0.273238000,1
0.273746000,0
0.274236000,1
0.275242000,0
0.275736000,1
0.276736000,0
0.277730000,1
0.278238000,0
0.278728000,1
0.279750000,0
0.280726000,1
0.281232000,0
0.282224000,1
0.282730000,0
0.283222000,1
0.284226000,0
0.285218000,1
0.285726000,0
0.286218000,1
0.287222000,0
0.288214000,1
0.288720000,0
0.289712000,1
0.290218000,0
0.291210000,1
0.291734000,0
0.292706000,1
0.293214000,0
0.294206000,1
0.294712000,0
0.295702000,1
0.296210000,0
0.297200000,1
0.297706000,0
0.298698000,1
0.299204000,0
0.300196000,1
0.300702000,0
0.301694000,1
0.302200000,0
0.303192000,1
0.303714000,0
0.304688000,1
0.305196000,0
0.306186000,1
0.306692000,0
0.307684000,1
0.308190000,0
0.309182000,1
0.309688000,0
0.310680000,1
0.311186000,0
0.312178000,1
0.312684000,0
0.313674000,1
0.314182000,0
0.314674000,1
0.315694000,0
0.316670000,1
0.317176000,0
0.318168000,1
0.318674000,0
0.319664000,1
0.320172000,0
0.321162000,1
0.321668000,0
0.322660000,1
0.323166000,0
0.324158000,1
0.324664000,0
0.325656000,1
0.326162000,0
0.327154000,1
0.327676000,0
0.328650000,1
0.329158000,0
0.330148000,1
0.330654000,0
0.331646000,1
0.332152000,0
0.333144000,1
0.333650000,0
0.334642000,1
0.335148000,0
0.336138000,1
0.336646000,0
0.337636000,1
0.338142000,0
0.339134000,1
0.339658000,0
0.340630000,1
0.341138000,0
0.341630000,1
0.342634000,0
0.343626000,1
0.344134000,0
0.345124000,1
0.345632000,0
0.346122000,1
0.347128000,0
0.347622000,1
0.348624000,0
0.349616000,1
0.350124000,0
0.351114000,1
0.351622000,0
0.783470000,1
0.784486000,0
0.785466000,1
0.785974000,0
0.786966000,1
0.787472000,0
0.787964000,1
0.788968000,0
0.789464000,1
0.790466000,0
0.790960000,1
0.791964000,0
0.792956000,1
0.793464000,0
0.793956000,1
0.794960000,0
0.795952000,1
0.796476000,0
0.797448000,1
0.797956000,0
0.798948000,1
0.799454000,0
0.800446000,1
0.800952000,0
0.801444000,1
0.802448000,0
0.803440000,1
0.803948000,0
0.804440000,1
0.805444000,0
0.805940000,1
0.806940000,0
0.807934000,1
0.808460000,0
0.808934000,1
0.809938000,0
0.810930000,1
0.811438000,0
0.811930000,1
0.812934000,0
0.813430000,1
0.814432000,0
0.814926000,1
0.815930000,0
0.816922000,1
0.817428000,0
0.818420000,1
0.818928000,0
0.819418000,1
0.820440000,0
0.821416000,1
0.821922000,0
0.822914000,1
0.823422000,0
0.823912000,1
0.824918000,0
0.825910000,1
0.826418000,0
0.826908000,1
0.827914000,0
0.828906000,1
0.829412000,0
0.830404000,1
0.830910000,0
0.831902000,1
0.832426000,0
0.833398000,1
0.833906000,0
0.834898000,1
0.835406000,0
0.835896000,1
0.836900000,0
0.837892000,1
0.838400000,0
0.839392000,1
0.839898000,0
0.840890000,1
0.841398000,0
0.841888000,1
0.842892000,0
0.843884000,1
0.844410000,0
0.845382000,1
0.845890000,0
0.846882000,1
0.847388000,0
0.847880000,1
0.848884000,0
0.849876000,1
0.850384000,0
0.850876000,1
0.851880000,0
0.852872000,1
0.853380000,0
0.854372000,1
0.854878000,0
0.855868000,1
0.856392000,0
0.857366000,1
0.857874000,0
0.858366000,1
0.859370000,0
0.860362000,1
0.860870000,0
0.861860000,1
0.862368000,0
0.863358000,1
0.863866000,0
0.864856000,1
0.865364000,0
0.866354000,1
0.866862000,0
0.867354000,1
0.868360000,0
1.329722000,1
1.364314000,0
1.379156000,1
1.380172000,0
1.381152000,1
1.381660000,0
1.382652000,1
1.383158000,0
1.383650000,1
1.384656000,0
1.385150000,1
1.386152000,0
1.386646000,1
1.387650000,0
1.388642000,1
1.389150000,0
1.389642000,1
1.390646000,0
1.391638000,1
1.392162000,0
1.393136000,1
1.393644000,0
1.394636000,1
1.395142000,0
1.396134000,1
1.396640000,0
1.397132000,1
1.398136000,0
1.399128000,1
1.399636000,0
1.400128000,1
1.401134000,0
1.401628000,1
1.402630000,0
1.403622000,1
1.404146000,0
1.405120000,1
1.405628000,0
1.406618000,1
1.407126000,0
1.408116000,1
1.408624000,0
1.409614000,1
1.410122000,0
1.410614000,1
1.411618000,0
1.412112000,1
1.413114000,0
1.414108000,1
1.414616000,0
1.415106000,1
1.416128000,0
1.417104000,1
1.417610000,0
1.418602000,1
1.419110000,0
1.419600000,1
1.420604000,0
1.421596000,1
1.422106000,0
1.422596000,1
1.423600000,0
1.424592000,1
1.425100000,0
1.426092000,1
1.426598000,0
1.427590000,1
1.428114000,0
1.429086000,1
1.429594000,0
1.430586000,1
1.431092000,0
1.432084000,1
1.432590000,0
1.433582000,1
1.434088000,0
1.435080000,1
1.435586000,0
1.436578000,1
1.437084000,0
1.438076000,1
1.438582000,0
1.439574000,1
1.440096000,0
1.441070000,1
1.441578000,0
1.442570000,1
1.443076000,0
1.444068000,1
1.444574000,0
1.445566000,1
1.446072000,0
1.447064000,1
1.447570000,0
1.448562000,1
1.449068000,0
1.450060000,1
1.450566000,0
1.451058000,1
1.452080000,0
1.453056000,1
1.453562000,0
1.454554000,1
1.455060000,0
1.456052000,1
1.456558000,0
1.457550000,1
1.458056000,0
1.459048000,1
1.459554000,0
1.460546000,1
1.461052000,0
1.462044000,1
1.462550000,0
1.463542000,1
1.464064000,0
1.465038000,1
1.465546000,0
1.466538000,1
1.467044000,0
1.468034000,1
1.468542000,0
1.469532000,1
1.470040000,0
1.471032000,1
1.471538000,0
1.472530000,1
1.473036000,0
1.474028000,1
1.474534000,0
1.475526000,1
1.476048000,0
1.477022000,1
1.477532000,0
1.478022000,1
1.479026000,0
1.480018000,1
1.480526000,0
1.481518000,1
1.482024000,0
1.482516000,1
1.483522000,0
1.484016000,1
1.485018000,0
1.486010000,1
1.486518000,0
1.487508000,1
1.488016000,0
1.580378000,1
1.581394000,0
1.582376000,1
1.582884000,0
1.583874000,1
1.584382000,0
1.584874000,1
1.585878000,0
1.586374000,1
1.587376000,0
1.587870000,1
1.588874000,0
1.589866000,1
1.590374000,0
1.590866000,1
1.591870000,0
1.592862000,1
1.593386000,0
1.594360000,1
1.594868000,0
1.595858000,1
1.596366000,0
1.597356000,1
1.597864000,0
1.598356000,1
1.599360000,0
1.600352000,1
1.600860000,0
1.601352000,1
1.602356000,0
1.602852000,1
1.603852000,0
1.604846000,1
1.605370000,0
1.605846000,1
1.606850000,0
1.607842000,1
1.608350000,0
1.608842000,1
1.609846000,0
1.610838000,1
1.611344000,0
1.612336000,1
1.612842000,0
1.613834000,1
1.614342000,0
1.614832000,1
1.615838000,0
1.616332000,1
1.617350000,0
1.618326000,1
1.618834000,0
1.619826000,1
1.620332000,0
1.621322000,1
1.621830000,0
1.622322000,1
1.623326000,0
1.624318000,1
1.624826000,0
1.625816000,1
1.626324000,0
1.626816000,1
1.627820000,0
1.628314000,1
1.629334000,0
1.630310000,1
1.630816000,0
1.631808000,1
1.632314000,0
1.633306000,1
1.633812000,0
1.634804000,1
1.635310000,0
1.636302000,1
1.636808000,0
1.637800000,1
1.638306000,0
1.639298000,1
1.639804000,0
1.640794000,1
1.641320000,0
1.641794000,1
1.642798000,0
1.643790000,1
1.644298000,0
1.644790000,1
1.645794000,0
1.646786000,1
1.647294000,0
1.647786000,1
1.648790000,0
1.649782000,1
1.650288000,0
1.651280000,1
1.651786000,0
1.652778000,1
1.653302000,0
1.654274000,1
1.654782000,0
1.655774000,1
1.656280000,0
1.657272000,1
1.657778000,0
1.658270000,1
1.659276000,0
1.659770000,1
1.660772000,0
1.661764000,1
1.662272000,0
1.663262000,1
1.663770000,0
1.664262000,1
1.665282000,0
1.666258000,1
1.666764000,0
1.667756000,1
1.668262000,0
1.669254000,1
1.669762000,0
1.670252000,1
1.671258000,0
1.672250000,1
1.672756000,0
1.673748000,1
1.674254000,0
1.675246000,1
1.675752000,0
1.676744000,1
1.677268000,0
1.678240000,1
1.678748000,0
1.679240000,1
1.680244000,0
1.681236000,1
1.681744000,0
1.682736000,1
1.683242000,0
1.683734000,1
1.684738000,0
1.685730000,1
1.686238000,0
1.686730000,1
1.687734000,0
1.688726000,1
1.689250000,0
1.690224000,1
1.690732000,0
1.691222000,1
1.692228000,0
1.693218000,1
1.693728000,0
1.694218000,1
1.695224000,0
1.695718000,1
1.696720000,0
1.697712000,1
1.698220000,0
1.699212000,1
1.699718000,0
1.700210000,1
1.701232000,0
1.702206000,1
1.702714000,0
1.703206000,1
1.704210000,0
1.705202000,1
1.705708000,0
1.706700000,1
1.707206000,0
1.708198000,1
1.708706000,0
1.709196000,1
1.710200000,0
1.711192000,1
1.711700000,0
1.712692000,1
1.713216000,0
1.714188000,1
1.714696000,0
1.715188000,1
1.716192000,0
1.717184000,1
1.717692000,0
1.718184000,1
1.719188000,0
1.719684000,1
1.720684000,0
1.721678000,1
1.722186000,0
1.723176000,1
1.723684000,0
1.724176000,1
1.725196000,0
1.726172000,1
1.726678000,0
1.727670000,1
1.728178000,0
1.728670000,1
1.729674000,0
1.730170000,1
1.731170000,0
1.732164000,1
1.732670000,0
1.733662000,1
1.734170000,0
1.734662000,1
1.735666000,0
1.736658000,1
1.737182000,0
1.738156000,1
1.738664000,0
1.739156000,1
1.740160000,0
1.741152000,1
1.741660000,0
1.742650000,1
1.743156000,0
1.744148000,1
1.744656000,0
1.745148000,1
1.746152000,0
1.747144000,1
1.747652000,0
1.748642000,1
1.749166000,0
1.750140000,1
1.750648000,0
1.751140000,1
1.752144000,0
1.753136000,1
1.753644000,0
1.754136000,1
1.755140000,0
1.756132000,1
1.756640000,0
1.757630000,1
1.758138000,0
1.758628000,1
1.759634000,0
1.760128000,1
1.761146000,0
1.762122000,1
1.762632000,0
1.763122000,1
1.764126000,0
1.765118000,1
1.765626000,0
1.766618000,1
1.767126000,0
1.767616000,1
1.768622000,0
1.769116000,1
1.770118000,0
1.770612000,1
1.771618000,0
1.772112000,1
1.773130000,0
1.774106000,1
1.774614000,0
1.775604000,1
1.776112000,0
1.776604000,1
1.777608000,0
1.778104000,1
1.779104000,0
1.780098000,1
1.780606000,0
1.781596000,1
1.782104000,0
1.782596000,1
1.783600000,0
1.784592000,1
1.785116000,0
1.786090000,1
1.786598000,0
1.787588000,1
1.788096000,0
1.788588000,1
1.789592000,0
1.790088000,1
1.791090000,0
1.791584000,1
1.792588000,0
1.793580000,1
1.794086000,0
1.795078000,1
1.795586000,0
1.796076000,1
1.797098000,0
1.798074000,1
1.798580000,0
1.799572000,1
1.800080000,0
1.800570000,1
1.801576000,0
1.802070000,1
1.803072000,0
1.804066000,1
1.804572000,0
1.805564000,1
1.806072000,0
1.806562000,1
1.807568000,0
1.808560000,1
1.809084000,0
1.810058000,1
1.810564000,0
1.811556000,1
1.812064000,0
1.812554000,1
1.813560000,0
1.814054000,1
1.815058000,0
1.815550000,1
1.816556000,0
1.817548000,1
1.818054000,0
1.819046000,1
1.819554000,0
1.820044000,1
1.821066000,0
1.822042000,1
1.822550000,0
1.823040000,1
1.824046000,0
1.824540000,1
1.825544000,0
1.826036000,1
1.827042000,0
1.828034000,1
1.828542000,0
1.829532000,1
1.830040000,0
1.831030000,1
1.831538000,0
1.832030000,1
1.833052000,0
1.834028000,1
1.834534000,0
1.835526000,1
1.836034000,0
1.836524000,1
1.837530000,0
1.838024000,1
1.839026000,0
1.840020000,1
1.840528000,0
1.841018000,1
1.842024000,0
1.843016000,1
1.843524000,0
1.844016000,1
1.845036000,0
1.846012000,1
1.846520000,0
1.847512000,1
1.848018000,0
1.848510000,1
1.849516000,0
1.850010000,1
1.851012000,0
1.852004000,1
1.852512000,0
1.853504000,1
1.854012000,0
1.854502000,1
1.855508000,0
1.856002000,1
1.857020000,0
1.857996000,1
1.858504000,0
1.859496000,1
1.860004000,0
1.860494000,1
1.861500000,0
1.861994000,1
1.862996000,0
1.863988000,1
1.864498000,0
1.864988000,1
1.865992000,0
1.866984000,1
1.867494000,0
1.867984000,1
1.869006000,0
1.869482000,1
1.870488000,0
1.870982000,1
1.871984000,0
1.872976000,1
1.873484000,0
1.873976000,1
1.874982000,0
1.875476000,1
1.876478000,0
1.877470000,1
1.877978000,0
1.878970000,1
1.879476000,0
1.879968000,1
1.880974000,0
1.947574000,0

I would attache the csv and logic 2 sal file, but I cant.

As far as I know, many electric scooters have CanBus and you should decode it using a Canbus shield and library (mine is a Vectrix VX1 and I know it's CanBus but I never tried to get data from it). To know exactly the protocol and data used, I think you should ask the scooter vendor.

I dont think its can bus in this example.
Neither the voltage level, the bitrate nor the ICs on the BMS would fit.

I've asked the chinese vendor, but he is not willing to help.

looks like bits periods are ~0.5 msec
without a clock, doesn't is need to be asynchronous? or is it machenster coding?

its async I guess. Probably its only 1-way communication so only transmit from battery to controller - no recieve. It wouldnt be a bus then.

asynch rquires start/stop bits because the timing needs to be resynchronized every ~10 bits.

i'm pretty sure it's manchester coding. all i see are puleses or gaps of 1 or 2 widths

I found something:

1920bits/s and 7n1

Async Serial	data	0.252778	0.004426	0x13	
Async Serial	data	0.257270	0.004426	0x52	
Async Serial	data	0.261762	0.004426	0x5A	
Async Serial	data	0.266254	0.004426	0x12	
Async Serial	data	0.270748	0.004426	0x52	
Async Serial	data	0.275242	0.004426	0x53	
Async Serial	data	0.279750	0.004426	0x52	
Async Serial	data	0.284226	0.004426	0x1A	
Async Serial	data	0.288720	0.004426	0x12	
Async Serial	data	0.293214	0.004426	0x12	
Async Serial	data	0.297706	0.004426	0x12	
Async Serial	data	0.302200	0.004426	0x12	
Async Serial	data	0.306692	0.004426	0x12	
Async Serial	data	0.311186	0.004426	0x52	
Async Serial	data	0.315694	0.004426	0x12	
Async Serial	data	0.320172	0.004426	0x12	
Async Serial	data	0.324664	0.004426	0x12	
Async Serial	data	0.329158	0.004426	0x12	
Async Serial	data	0.333650	0.004426	0x12	
Async Serial	data	0.338142	0.004426	0x52	
Async Serial	data	0.342634	0.004426	0x52	
Async Serial	data	0.347128	0.004426	0x13	
Async Serial	data	0.351622	0.004426	0x00	framing

what are the columns of #s? (no labels)

notice a pattern. last column sorted

Async Serial    data    0.351622        0.004426        0x00
Async Serial    data    0.266254        0.004426        0x12
Async Serial    data    0.288720        0.004426        0x12
Async Serial    data    0.293214        0.004426        0x12
Async Serial    data    0.297706        0.004426        0x12
Async Serial    data    0.302200        0.004426        0x12
Async Serial    data    0.306692        0.004426        0x12
Async Serial    data    0.315694        0.004426        0x12
Async Serial    data    0.320172        0.004426        0x12
Async Serial    data    0.324664        0.004426        0x12
Async Serial    data    0.329158        0.004426        0x12
Async Serial    data    0.333650        0.004426        0x12
Async Serial    data    0.252778        0.004426        0x13
Async Serial    data    0.347128        0.004426        0x13
Async Serial    data    0.284226        0.004426        0x1A
Async Serial    data    0.257270        0.004426        0x52
Async Serial    data    0.270748        0.004426        0x52
Async Serial    data    0.279750        0.004426        0x52
Async Serial    data    0.311186        0.004426        0x52
Async Serial    data    0.338142        0.004426        0x52
Async Serial    data    0.342634        0.004426        0x52
Async Serial    data    0.275242        0.004426        0x53
Async Serial    data    0.261762        0.004426        0x5A

Sorry, hope this makes it more clear:

Time [s]	        Value	    Framing Error
0.143426000000000	0x00		Error
0.227964000000000	0x00		Error
0.243800000000000	0x52		
0.248284000000000	0x1B		
0.252778000000000	0x13		
0.257270000000000	0x52		
0.261762000000000	0x5A		
0.266254000000000	0x12		
0.270748000000000	0x52		
0.275242000000000	0x53		
0.279750000000000	0x52		
0.284226000000000	0x1A		
0.288720000000000	0x12		
0.293214000000000	0x12		
0.297706000000000	0x12		
0.302200000000000	0x12		
0.306692000000000	0x12		
0.311186000000000	0x52		
0.315694000000000	0x12		
0.320172000000000	0x12		
0.324664000000000	0x12		
0.329158000000000	0x12		
0.333650000000000	0x12		
0.338142000000000	0x52		
0.342634000000000	0x52		
0.347128000000000	0x13		
0.351622000000000	0x00		Error
0.784486000000000	0x52		
0.788968000000000	0x1B		
0.793464000000000	0x13		
0.797956000000000	0x52		
0.802448000000000	0x5A		
0.806940000000000	0x1A		
0.811438000000000	0x5B		
0.815930000000000	0x52		
0.820440000000000	0x52		
0.824918000000000	0x1A		
0.829412000000000	0x12		
0.833906000000000	0x1A		
0.838400000000000	0x52		
0.842892000000000	0x12		
0.847388000000000	0x53		
0.851880000000000	0x12		
0.856392000000000	0x1A		
0.860870000000000	0x12		
0.865364000000000	0x1A		Error
1.364314000000000	0x00		Error

The pattern, which every frame starts with is:
0x52
0x1B
0x13
0x52
0x5A

don't see any 7s, Fs or 0s

dont know what you mean.
but I can upload the captured data now. 7n1 is a csv, the other file is Salea Logic 2 format.
7n1.txt (14,9 KB)
battery standalone.txt (25,5 KB)

Now I'm searching, how to send the frames, with wait time in between with an esp. Is anybody having an example?

normal data would be various binary values from 0x00-0xff.

for example, here's an hex dump of battery.txt that you posted, first column is the address and remaining columns data as 32-bit values. notice how each nibble (4-bit) is from 0-0xF

0000000 4b50 0403 0014 0008 0008 9c68 5899 0000
0000020 0000 0000 0000 0000 0000 000d 0000 6964
0000040 6967 6174 2d6c 2e30 6962 ad6e 37d2 6812
0000060 1147 e146 0916 0121 8455 0bd4 c2b0 ef09
0000100 d484 240f b0ac dbc2 0906 c4ef 340a 3901
0000120 185b 0202 4076 d040 a02b 5808 54c0 02b1
0000140 4076 a9e9 0b0f 4e60 dff4 7b9a 57ef 9c13
0000160 9f27 f87f b3dc 9f0f ea7d 88b1 3178 5e22
0000200 58d9 7c7f c3e3 ff7f efed f86f 63d3 4f11
0000220 fe3c d7d7 f3ff 7f99 fd3d 3fd8 f2fe 57a6
0000240 c5de af63 cffb 8f4b 5e1e cd78 89a3 afd8
0000260 88be 7d9e eaf0 83f9 bf3f d1f6 23c3 2232
0000300 fcf8 97e5 9939 ffff 8f37 51ce a28e c4a1
0000320 e79b 3352 dfff fedd 28a7 83da 5251 50d1
0000340 d14a 9650 a1a2 456c 6943 4345 8a39 1286
0000360 516f 437a af61 7dea 4a30 1a2a 294a ca1a
0000400 3452 ad94 2868 68ad 4728 50d1 ade2 6f4a
0000420 ec28 6f5d a4a3 a1a2 a294 2ca1 4345 8ad9
0000440 d286 868a 1472 250d a6de 86f4 dec2 36f5
0000460 2a4a 4a1a 1a29 52ca 9434 68ad ad28 2868

in your data, i just see a few values that often repeat. when i look at the data, i don't see start/stop pairs (a start is always a 1 and stop always a zero so that the start is always reconizable). I see a steady stream of data which also implies manchester encoding because it combine clock and data

ok, got it, thank you for explanation.

it looks like, a start is always low level, an end is always high.

It doesnt make sense to look at the battery.txt, because its proprietary Salea file - I dont know how it is coded.

where do you see that?

do you see a start before every N bits of data, along with a 1,2 stop bits after every N bits of data. And there's often a gap after the stop bit(s)

let me emphasis that it's just a start bit, not byte using to preface a meassage

red - start
green - stop

always 1 start bit, 7 data bits, 1 stop bit.

still, never more that 2 consecutive 1s or 0s (including the start/stop bits)

sure, at the end of each frame. but it cant be seen, because of the export format. Look at the time column, it describes how long the bit is.

look at your dots

sounds like you've made up your mind