Zweiter Frühling für ION-Antrieb --- Sparta, Batavus, Koga ...

Diskutiere Zweiter Frühling für ION-Antrieb --- Sparta, Batavus, Koga ... im Nabenmotoren Forum im Bereich Fertig-Pedelecs; Yeah, great! With this we can refurbish many old bikes!!! (y) regards stancecoke
M

Mike747

Dabei seit
11.03.2021
Beiträge
203
Punkte Reaktionen
33
[10-4201-0900-f8] [0900] - PUT DATA - OK 00
Apparently it is the same message as was send to the dealers computer :)

read original display-code in motor:
send 10 01 43 08 40 5B 00 A8 received 10 42 0C 08 00 40 5B 08 07 39 00 00 00 00 13 81 C9
program display-serial in motor:
send 10 01 4D 09 40 5B 00 08 08 06 03 00 00 00 00 40 85 68 received 10 42 01 09 00 F8
read new display-code in motor:
send 10 01 43 08 40 5B 00 A8 received 10 42 0C 08 00 40 5B 08 06 03 00 00 00 00 40 85 7B
 
V

void-spark

Dabei seit
08.09.2021
Beiträge
219
Punkte Reaktionen
90
Ha! Awesome, it works! :D
The 10 42 01 09 00 F8 is just a 'Ok' from the motor I think, Target 04 (PC), Source 0 (motor), type 2 (reply), command 09 (so reply on your command), payload 00 which is probably just a code for 'ok' :)
 
V

void-spark

Dabei seit
08.09.2021
Beiträge
219
Punkte Reaktionen
90
Looking at CU3, guess I should put a logger in between :)
All the batteries we have either talk to CU2 or CU3, but none talks to both.
I expect the bike shop can swap the firmware between CU2 and CU3 though :)

1645889247238.png
 
V

void-spark

Dabei seit
08.09.2021
Beiträge
219
Punkte Reaktionen
90
Well, first attempt to log gave gibberish, I guess it does run at a higher baud :)
 
V

void-spark

Dabei seit
08.09.2021
Beiträge
219
Punkte Reaktionen
90
Note that the above log is without a motor connected! Just battery + CU3
Some observations:
- I see PING/PONG messages, and HANDOFF messages between the display and battery. So it's more actively part of the communication.
- Similarly, the display actually initiates commands too, at a guess it asks the battery for things like distance/trip/speed etc., where the CU2 only listens.
- I see an occasional crc error, that I blame on the OpenLog I use not being able to keep up with the higher baud rate (19200) :)
A faster SD card might well help.

Here's all the unique commands between the display and battery from the log, except the 08 'get data' replies from the battery, since the values change a lot so there's a lot and I wanted a small list :)

Code:
tgt:BT typ:1 src:DP [10-21c0-01-01] [01]
tgt:BT typ:1 src:DP [10-21c0-14-9f] [14]
tgt:BT typ:1 src:DP [10-21c1-1c00-2b] [1c00]
tgt:BT typ:1 src:DP [10-21c1-1c01-ba] [1c01]
tgt:BT typ:1 src:DP [10-21c1-1d00-d6] [1d00]
tgt:BT typ:1 src:DP [10-21c1-1d01-47] [1d01]
tgt:BT typ:1 src:DP [10-21c1-1d02-b7] [1d02]
tgt:BT typ:1 src:DP [10-21c1-1d03-26] [1d03]
tgt:BT typ:1 src:DP [10-21c2-08083b-5c] [08083b]
tgt:BT typ:1 src:DP [10-21c2-080880-de] [080880]
tgt:BT typ:1 src:DP [10-21c2-08088e-ba] [08088e]
tgt:BT typ:1 src:DP [10-21c2-081418-e2] [081418]
tgt:BT typ:1 src:DP [10-21c2-082894-1a] [082894]
tgt:BT typ:1 src:DP [10-21c3-08449a00-1c] [08449a00]
tgt:BT typ:1 src:DP [10-21c3-08489900-94] [08489900]
tgt:BT typ:1 src:DP [10-21c4-089418141a-77] [089418141a]
tgt:BT typ:1 src:DP [10-21c6-09088e00010fa4-bf] [09088e00010fa4]
tgt:BT typ:2 src:DP [10-22c0-04-61] [04]
tgt:BT typ:2 src:DP [10-22c0-17-5c] [17]
tgt:BT typ:2 src:DP [10-22c0-29-2c] [29]
tgt:BT typ:2 src:DP [10-22c1-2801-60] [2801]
tgt:DP typ:1 src:BT [10-c120-04-d3] [04]
tgt:DP typ:1 src:BT [10-c121-1704-ff] [1704]
tgt:DP typ:1 src:BT [10-c121-1705-6e] [1705]
tgt:DP typ:1 src:BT [10-c121-2916-b6] [2916]
tgt:DP typ:1 src:BT [10-c12d-2800000000000000000000000000-a8] [2800000000000000000000000000]
tgt:DP typ:1 src:BT [10-c12d-2800000800000000000000000000-84] [2800000800000000000000000000]
tgt:DP typ:1 src:BT [10-c12d-2800000900000000000000000000-20] [2800000900000000000000000000]
tgt:DP typ:1 src:BT [10-c12d-2801000800000000000000000000-97] [2801000800000000000000000000]
tgt:DP typ:1 src:BT [10-c12d-2802000800000000000000000000-a2] [2802000800000000000000000000]
tgt:DP typ:1 src:BT [10-c12d-2802000900000000000000000000-06] [2802000900000000000000000000]
tgt:DP typ:2 src:BT [10-c220-14-2d] [14]
tgt:DP typ:2 src:BT [10-c220-1c-ea] [1c]
tgt:DP typ:2 src:BT [10-c220-1d-7b] [1d]
tgt:DP typ:2 src:BT [10-c221-0900-f7] [0900]
tgt:DP typ:2 src:BT [10-c222-010202-03] [010202]
 
M

Mike747

Dabei seit
11.03.2021
Beiträge
203
Punkte Reaktionen
33
Great! Enough CU3 stuff there ;). Do you have a fully functional battery for CU3 or do they all give E0003?

Very interesting to see if the messages to the BMS somewhat make sense.

It might be worth a try to attach a toprun motor to see if the bow bus will operate on 9600 baud.
 
V

void-spark

Dabei seit
08.09.2021
Beiträge
219
Punkte Reaktionen
90
Only one CU3 mount though :) There's at least one functional battery.

Will need to make a test script to talk with the CU3, then it's easier to see what it sends and when, and how it reacts.
But my impression it works at a higher level, it doesn't send button presses, instead it sends commands, I wouldn't be surprised if 1d-00/01/02/03 tells the BMS to update the power level for example. 1c could set the light on/off similarly I guess :)
All the 08's are likely the display asking for data to display, km, trip, etc. That should be fun cause we can see which value is what :)
I certainly wonder what the 09 is, a set data from display to bms.

I'd have to replace a battery to see how it works with a Toprun, won't be doing that too soon :)
Might at some point, I do want to see what the throttle does :D
 
V

void-spark

Dabei seit
08.09.2021
Beiträge
219
Punkte Reaktionen
90
Ha! Paired the first (CU2) display on a full bike today, it works! :)
Meaning the bike actually assists :)

Had to power cycle the motor for it to pick it up after the command (just unplug it) :)

Read old value from motor:
tgt:MT typ:1 src:04 [10-0143-08405b00-a8] - GET DATA (405b00)
tgt:04 typ:2 src:MT [10-420c-0800405b081332100000001343-51] - GET DATA - OK (00405b081332100000001343)

Set new value in motor:
tgt:MT typ:1 src:04 [10-014d-09405b0008081527100000000666-a1] - PUT DATA (405b0008081527100000000666)
tgt:04 typ:2 src:MT [10-4201-0900-f8] - PUT DATA - OK (00)

Unplug/reconnect motor

Read new value from motor:
tgt:MT typ:1 src:04 [10-0143-08405b00-a8] [08405b00] - GET DATA (405b00)
tgt:04 typ:2 src:MT [10-420c-0800405b081527100000000666-b2]- GET DATA - OK (00405b081527100000000666)
 
V

void-spark

Dabei seit
08.09.2021
Beiträge
219
Punkte Reaktionen
90
666, really :ROFLMAO::ROFLMAO::ROFLMAO:

I shall switch some displays between 2 bikes this week then. by the way, an "OpenLog" has (finally) arrived ;).
Yeah, funny display that :)

Cool! Let me know if you have any questions about it :)
I run mine with a config.txt with this:
Code:
9600,26,3,0,1,1,1
baud,escape,esc#,mode,verb,echo,ignoreRX

Don't remember why exactly, but it works well :)
Best documentation is probably on the wiki of the firmware: Home · sparkfun/OpenLog Wiki
 
V

void-spark

Dabei seit
08.09.2021
Beiträge
219
Punkte Reaktionen
90
Well, the code that's on github now drives the (CU2) display, shows the speed, and lets you use the buttons to change assist level and do the calibraton (and turn on/off the display light.. :) ). It should show a 'trip' too, but not sure if that works, didn't drive far enough, and it resets when the motor powers down :)
Took bike out today around the block to test it all, so far looks good :)
 
V

void-spark

Dabei seit
08.09.2021
Beiträge
219
Punkte Reaktionen
90
I've attached a zip with todays build to this message. To flash it to a esp32 or such you need esptool (or something similar).
To flash on a new esp32 the command should be something similar to:
Code:
python esptool.py -p (PORT) write_flash 0x1000 bootloader.bin 0x8000 partition-table.bin 0x10000 ion1-nowifi.bin
To update a existing esp32 which already had the firmware just this should be enough:
Code:
python esptool.py -p (PORT) write_flash 0x10000 ion1-nowifi.bin

Flashing a esp32/using esptool is pretty well documented on the internet :)
And feel free to ask questions :)

What the command does is:
- Write bootloader.bin to flash address 0x1000 - Which places the Espressif bootloader, it doesn't change often so only needed for a first flash/install.
- Write partition-table.bin to flash address 0x8000 - Which places the partition table (where is which part in flash), which I haven't changed yet
- Write ion1-nowifi.bin to flash address 0x10000 - Which places the actual application

Actually, since neither touches the spiffs partition where I store the calibration data, might as well always use the long command :)
 

Anhänge

  • build.zip
    149,6 KB · Aufrufe: 20
V

void-spark

Dabei seit
08.09.2021
Beiträge
219
Punkte Reaktionen
90
And if you don't want to install esptool this should also work from Chrome on Windows:
Adafruit MagTag :)
Just use the same files and addresses:
0x1000 bootloader.bin
0x8000 partition-table.bin
0x10000 ion1-nowifi.bin
 
V

void-spark

Dabei seit
08.09.2021
Beiträge
219
Punkte Reaktionen
90
Thinking how to add a battery indication, right now it's just shows a fixed value, would need to measure the battery voltage. Maybe something like a mcp3421 – Kaufen Sie mcp3421 mit kostenlosem Versand auf AliExpress version, and another voltage divider with two resistors? Would have to be calibrated though, depending on how accurate the resistors are (and/or how accurate we want the result to be :) ). Also would need some curve to calculate from voltage to remaining capacity, I don't think it's linear :) Would also need a bigger breadboard to fit it :D
 
V

void-spark

Dabei seit
08.09.2021
Beiträge
219
Punkte Reaktionen
90
So using this (in Chrome or Edge): Adafruit ESPTool

It should be configured like this:
1647274432443.png


And after flashing (pressing program, don't use erase unless you have problems):
1647274498493.png


It doesn't give a good way to check if it's correct, but there's another very similar page: ESP Tool
That one has a console, after you click start under the Console header (and maybe resetting the ESP32), you should see something like:

1647274741572.png

The bit about Calibration file found might be missing, same for 'Wakeup!'. Seeing the two 'BUTTON: Registering button input:' messages is a good sign though :)
And 'Project name: ion-nowifi' is a good sign too, and for the version posted above (build.zip) it should show 'App version: 0d629a4-dirty'
 
M

Mike747

Dabei seit
11.03.2021
Beiträge
203
Punkte Reaktionen
33
Thinking how to add a battery indication, right now it's just shows a fixed value, would need to measure the battery voltage. Maybe something like a mcp3421 – Kaufen Sie mcp3421 mit kostenlosem Versand auf AliExpress version, and another voltage divider with two resistors? Would have to be calibrated though, depending on how accurate the resistors are (and/or how accurate we want the result to be :) ). Also would need some curve to calculate from voltage to remaining capacity, I don't think it's linear :) Would also need a bigger breadboard to fit it :D
Does the ESP have no ADC onboard? something like this is designed as a battery gauge:
https://www.ti.com/product/BQ34Z100...O8iGaP573JETf3B2rnYaAjPJEALw_wcB&gclsrc=aw.ds
 
V

void-spark

Dabei seit
08.09.2021
Beiträge
219
Punkte Reaktionen
90
Does the ESP have no ADC onboard? something like this is designed as a battery gauge:
https://www.ti.com/product/BQ34Z100...O8iGaP573JETf3B2rnYaAjPJEALw_wcB&gclsrc=aw.ds
It does, but the ADC on the ESP is pretty bad. Newer ESP32's seem to have some calibration to help with that, but older ones would need manual calibration, and code to deal with the non linear response :)

Hmm, never looked at chips like that, no idea what they do exactly, could be interesting! Don't think they do a breakout board with them for me to experiment though :)
 
Thema:

Zweiter Frühling für ION-Antrieb --- Sparta, Batavus, Koga ...

Zweiter Frühling für ION-Antrieb --- Sparta, Batavus, Koga ... - Ähnliche Themen

Sparta ION Akku defekt?: Hallo zusammen, ich bin neu hier, vielen Dank für die Aufnahme...und ich komme gleich mit einem Problem/Frage. Meine Frau fährt (wenig, da sie...
Sparta Ion, Hercules emove, Batavus, Koga auf Li-Ion Akku umbauen reparieren.: Ich bin Besitzer zweiter solcher Bikes und habe diese nach einem Akkudefekt erfolgreich umgebaut. Gleich vorweg, es ist zeitaufwendig, man sollte...
Sparta M7e ion Antrieb von 2016: Hallo Leute, kurz zu mir: Ich bin seinerzeit mit einem Bausatz aus China angefangen (mit dem ich mich entsetzlich auf die Nase gelegt habe), dann...
verkaufe Koga E-Runner, Rh 47cm, ION-Antrieb, wie neu, super ausgestattet: Schnäppchen: Koga E-Runner, nur EUR 2.050,-/Neupreis EUR 3.000,- muß wg OP leider verkaufen, Fahrrad kaum genutzt, Heck-Motor ION-Antrieb (33 Nm)...
erledigt E-Bike SPARTA Blackline ION mit Garantie: BeschreibungHalle verkaufe hier ein E-Bike von Sparta, Model Black Line kompl. mit Ladegerät. Das E-Bike war ein Ausstellungsstück und hat das...
Oben