Re-program Bosch mid drive (classic line) microcontroller

oostenrb

10 µW
Joined
Nov 23, 2021
Messages
5
Dear all,

I have received an old classic line (2013, I think) Bosch mid drive motor unit. The battery of the bike is not present. I would like to use this mid drive in a future bike build, but I am aware that these systems are built heavily integrated, so that only Bosch parts can be used for things to work. I would therefore like to convert the motor software or hardware to be more accessible. I have considered re-designing the PCB, but would rather attempt to re-program the microcontroller first. Before I dive into this project, I would like to get an estimation of the difficulty and overall plausibility of this plan.

1. Does it seem plausible to re-program the microcontroller with adapted open source (sensorless) BLDC control software (such as presented here: https://endless-sphere.com/forums/viewtopic.php?f=30&t=36479)?
2. Would there be other individuals that would be interested in the know-how of such a conversion, so that I know I am not doing this just for this project, but rather helping others on the way as well?

I have started reverse-engineering the PCB in the motor, see the schematics in the attachment (not completed). I have focused on the motor drive rather than sensor readout. I am not very worried about the display functionality at the moment, it is not of highest priority.

Thanks in advance for your advice,
Bart

Some technical details:
The BLDC sensorless motor is switched by 034N06 FETs, driven by an MC33937 FET driver, which is controlled by a STM8AF52A9TC microcontroller (24 MHz, 128 kB flash, 6 kB RAM, 2048 B EEPROM. See more information here: https://www.st.com/en/microcontrollers-microprocessors/stm8af52a9.html.
The PCB is a 3+ layer board, partially covered in a conductive epoxy (where the board is close to the gearwheels).
 

Attachments

  • Bosch_classic_line_middrive_prel_schematics.pdf
    171.4 KB · Views: 25
  • annotated_PCB.png
    annotated_PCB.png
    1 MB · Views: 589
Seems like a tough hill to conquer, but wouldn't it be wiser to get the little details about the drivers as you did and just make a whole new controller based on a detailed analysis of the motor and what that requires to spin, and if anything above and beyond is needed go back to figuring out the controller. The motor just seems simpler but I have had a hard time figuring out the simplest of basics for t/s electronics.
 
Dear Calab,

Thank you for your reply. I agree that the less 'steep' method would be to start designing a new PCB, with similar components as used in the Bosch motor. This was my first thought as well. However, there are some disadvantages to take into account:
- Quite some electronic components are thus far impossible to identify. The writing on the component is very faint, or not found online. These components seem to be involved in the sensor signal manipulation, so I am not sure if I can manage to reliably re-build the sensor readout electronics. If I keep the original board, I should thus first make sure the sensors can be read at the micro-controller.
- The board uses a couple of non-standard connectors, so I would have to remove them without damaging, which is in this case quite a challenge (I speak from bad past experiences...).
- In either this board, or a newly-designed one, I will have to tune the software parameters for the motor, which I am afraid is the most challenging part of this project.
- 'For the community'-aspect: In the past, I have built a (DC) motor controller board for another e-bike motor (see here: https://tinkertalkingb.art.blog/2021/10/21/e-bike-tinkering-sanyo-cmu-overview/). Looking back at that project, I have learned a lot, but will quite unlikely help anyone else with what I have done. These (prototype) replacement boards are still relatively expensive, and require some difficult soldering actions (as mentioned above). So, I don't see many people take that risk. On the contrary, re-programming a micro-controller could be a lot easier when the software and a short instruction is available.

Still, I agree that it will either way not be an easy project, and that getting this motor to run smoothly will take a lot of pain. I think my next step will be to 'power up' the board (36V to poles), to try to see how the sensors are read out using an oscilloscope. This will hopefully advance the understanding of this board and help make a decision. I will keep you posted!

By the way: what do you mean with t/s elecronics?

Thanks again for your reply,
Bart
 
Dear avandalen,

Thank you for your response. I understand your suggestion, and it could be a good solution when the hardware is damaged. However, this is not the case here, and I would like to use only the hardware that is there now: All of that is nicely waterproof packed in the casing, so my preference goes to using it.
In the meantime I have figured out where the pedal sensor is read out from. I should still find the port to read out the mains voltage and the torque sensor pins.
My following steps from there would be to attempt to write my own 'dummy' code on the STM8 MCU, to see if I am able to do that.
I have been looking for available software to use. ST has developed sensorless BLDC drive firmware, found here: https://www.st.com/en/embedded-software/stsw-stm8020.html#overview. I hope I can use that. Otherwise, people might know of other software open source available?

Best regards,
Bart
 
Back
Top