• Warning!!

    Riding a tuned or deristricted EMTB is not a trivial offence and can have serious legal consequences. Also, many manufacturers can detect the use of a tuning device or deristricting method and may decline a repair under warranty if it was modified from the intended original specification. Deristricting EMTB's can also add increased loads for motors and batteries. Riding above the local law limit may reclassify the bike as a low-powered bike, requiring insurance, registration and a number plate.

    Be aware of your local country laws. Many laws prohibit use of modified EMTB's. It is your responsibility to check local laws. Ignoring it, has potential implications to trail access, and risk of prosecution in the event of an accident.

    UK Pedelec Law

    Worldwide Laws

    We advise members great caution. EMTB Forums accepts no liability for any content or advice given here. 


MEGABOBRA: Bosch Smart System Derestriction for Rim Magnet - DIY Project with Support

megabobra

Active member
Jul 24, 2022
266
268
Australia
I understand you don’t want to give out all the details for good reason. But I am very curious how your V2 would work, keeping everything inside the motor area. Besides the screen wiring of course.
Will you be offering it without the screen option? Or I guess maybe it’ll be good to have the screen for at least set up mode, as I have no interest in having another screen on my bike.

Taking inspiration from Bosch, it'll just be a magnet on the rim with a sensor inside the motor area. Sound familiar? :)
Yes sure, the screen would be optional. My plan is just to attach the female socket to the device, allowing users to decide if they want the screen or not. Could even add the screen later if required, as there's no code change necessary, just plugs in.

The Bosch 2-wire wheel speed sensor is a hall sensor afaik - it uses a 2-wire hall sensor chip, similar to this one. (I've never taken one apart to check for certain which chip it uses, and they are potted, so it would be hard to see anyway). They are polarity sensitive (which a reed switch isn't) and are used commonly in automotive sensors (Bosch also makes a lot of those)

When I first encountered 2-wire hall sensors I thought they were black magic, but they are definitely a thing.

Ha! Yes that does look like magic! Thanks for pointing it out. So the third 'output' pin is joined direct to ground. Funny, in that spec sheet, it says the minimum magnet distance is 3cm. Funny, I would have expected a maximum of around that much, not minimum?

I'll do some research, as it'd be great just to snip off the reed and drop in something similar to this without the need to rewire the whole length.
 
Last edited:

AlumiPro

Active member
May 1, 2023
211
170
California
Taking inspiration from Bosch, it'll just be a magnet on the rim with a sensor inside the motor area. Sound familiar? :)
Yes sure, the screen would be optional. My plan is just to attach the female socket to the device, allowing users to decide if they want the screen or not. Could even add the screen later if required, as there's no code change necessary, just plugs in.



Ha! Yes that does look like magic! Thanks for pointing it out. So the third 'output' pin is joined direct to ground. Funny, in that spec sheet, it says the minimum magnet distance is 3cm. Funny, I would have expected a maximum of around that much, not minimum?

I'll do some research, as it'd be great just to snip off the reed and drop in something similar to this without the need to rewire the whole length.
Ah I wondered about that while I was installing your V1……thinking why couldn’t the Bosch rim magnet be utilized, but then you would have to make sure only the Megabobra unit is picking up the rim magnet and not the Bosch sensor.
 

aegidius

Member
Sep 30, 2023
50
28
brisbane
One way to check if it's a reed or a hall, is to see if it triggers with both poles of the magnet. The hall chips only work with one pole (like the south pole in the case of the TMAG5124). Or else just listen for the clicks :)
 

Sander

Member
Dec 29, 2022
56
29
NL
Little update on the display. Just about happy with the all the functions now. All the typical screens, current speed, max speed, distance (all true values of course), as well as total climb/descent. Additionally, there's a menu for the controls of the megabobra itself; setting the desired multiplier, units (metric/imperial), wheel circumference etc. I'm considering also adding an option to turn on/off distance catch up functionality, ie where the device keeps the trip running after being idle for a minute in order to clock up the true trip distance to the motor. Certainly not a feature I'd use, but some asked for it and it's only a few lines of code.

Some snips below to show comparison of trip distance reported by the bosch display vs the true distance on the megabobra display. Bosch shows 22.1km vs true distance of 31.06km. I'm running a 1.4 multiplier (for max assisted speed = 35kph), so 22.1 * 1.4 = 30.94km, or within 0.3% of what the megabobra shows. I'm happy with this tolerance!

Just waiting on some new cabling before I tidy up the display and install it in its housing. For now, it's attached with velcro :)

View attachment 130542 View attachment 130543
The controller with screen, is that one from Bosch? I own the originale led controller with the bars, but yours looks neat ;-) Btw still running the first Bobra with original code ;-) I guess 2000km now. Bobra rules!
 

Sander

Member
Dec 29, 2022
56
29
NL
The controller with screen, is that one from Bosch? I own the originale led controller with the bars, but yours looks neat ;-) Btw still running the first Bobra with original code ;-) I guess 2000km now. Bobra rules!
Purion200 it is!
 

megabobra

Active member
Jul 24, 2022
266
268
Australia
The controller with screen, is that one from Bosch? I own the originale led controller with the bars, but yours looks neat ;-) Btw still running the first Bobra with original code ;-) I guess 2000km now. Bobra rules!

Niiice 2000km, well ahead of me!
Yep, it's the Purion 200. Nice change from the LED remote. Sure, it's super bulky, but only a little larger than the LED, so it was already wasted space. PS don't believe the requirement that you need to take the bike to a dealer to setup the new display - you can do it yourself at home without issue.
 

aegidius

Member
Sep 30, 2023
50
28
brisbane
PS don't believe the requirement that you need to take the bike to a dealer to setup the new display - you can do it yourself at home without issue.
That is interesting, in light of some comments I've seen that the Bosch displays and batteries are keyed to the motor and need dealer SW intervention to make them work together. It opens the door a bit to motor swaps.

Good too that the algorithm of changing the multiplier over a very short time (5 wheel revs) has been proven over 2000km. The default multiplier of 1.4 happens to be very close to two gear steps (on my rear cluster at least). I have been playing with a smaller multiplier 1.18, which is one gear step, and gives me a 30km/h cutoff.
 

manu.w

Member
Aug 5, 2023
95
40
belgium
Is there a reason why not choosing a multiplier of 2?
It is so much easier to calculate the real distance and speed 🤔
 

megabobra

Active member
Jul 24, 2022
266
268
Australia
Is there a reason why not choosing a multiplier of 2?
It is so much easier to calculate the real distance and speed 🤔

I just don't need assistance over 35kph, and to reduce unnecessary risk of detection. When you start pushing such high levels of assistance, the current draw from the battery will be significantly higher than what's 'typical', whereby I'd expect Bosch has accumulated SIGNIFICANT data around what's sensible power consumption and what's unusual.
 

aegidius

Member
Sep 30, 2023
50
28
brisbane
Bosch have a patent (mentioned upthread) that covers detection of gear ratios in use, but collecting data points on cadence and wheel speed (as measured by sensor) and making a histogram. The resulting histogram will have well-defined sharp peaks corresponding to the gear ratios. From this they can detect arbitrary bending of the speed sensor data, and whether extra peaks appear (more than the number of cogs on the cluster). If they are using this algorithm, then you want the multiplier to correspond to existing gear ratios and not make new ones.

The power draw is the obvious way to detect artificially low speed readings, and indeed Volspeed (I think) warn you to not set the cutoff too high in case of errors creeping in. Curiously, there is a patent on this detection scheme using an accelerometer to cancel out the effect of hill climbing on the power measured - but it is not Bosch! It was granted to SRAM. So I'm not sure how (or if) Bosch is avoiding this patent.
 

megabobra

Active member
Jul 24, 2022
266
268
Australia
Bosch have a patent (mentioned upthread) that covers detection of gear ratios in use, but collecting data points on cadence and wheel speed (as measured by sensor) and making a histogram. The resulting histogram will have well-defined sharp peaks corresponding to the gear ratios. From this they can detect arbitrary bending of the speed sensor data, and whether extra peaks appear (more than the number of cogs on the cluster). If they are using this algorithm, then you want the multiplier to correspond to existing gear ratios and not make new ones.

The power draw is the obvious way to detect artificially low speed readings, and indeed Volspeed (I think) warn you to not set the cutoff too high in case of errors creeping in. Curiously, there is a patent on this detection scheme using an accelerometer to cancel out the effect of hill climbing on the power measured - but it is not Bosch! It was granted to SRAM. So I'm not sure how (or if) Bosch is avoiding this patent.

The relationship between cadence and rpm really only becomes an issue at slower speeds, being the main reason the megabobra drops back to 1:1 reporting at this point. Reasoning is, for a given rpm, there's only so slow you could realistically be traveling with typical gear ratios. eg If you're pedaling at 90rpm with a 30t front ring and 52t rear, the slowest your could possibly be moving is ~7kph (29" wheel). If you report a slower speed, then pretty obviously it's being manipulated.

At higher speeds though, a higher cadence can be explained away by a lower gear ratio. eg:


CadenceFrontRingRearRingTrueKphReportedKph
70341033.2723.77
90321233.5523.97
110341632.6823.34
130321832.3123.08

Approximately the same speed is possible despite the nearly doubling of cadence. Of course the pedal torque would differ, but that would also differ depending on gradient and rider weight. Frankly I think it'd be next to impossible for Bosch to reliably detect manipulation using this approach alone. Maybe by looking for dramatic changes from historical trends in that histogram... but again, that could be explained away by selling the bike to a new owner.

Thoughts?
 

manu.w

Member
Aug 5, 2023
95
40
belgium
IMO, you over estimate Bosch doing over complex rider behavior analysis. And if they do, it would be a disaster! External context, wind, mud , sand, downhill, breaking, etc. should be included to decide to shut down the assistance, not just cadence and torque and speed…
I am riding at ratio of 2, only had errors on fast long downhill without pedaling 🤔
Must be my program logic or reed sensor…
 

megabobra

Active member
Jul 24, 2022
266
268
Australia
IMO, you over estimate Bosch doing over complex rider behavior analysis. And if they do, it would be a disaster! External context, wind, mud , sand, downhill, breaking, etc. should be included to decide to shut down the assistance, not just cadence and torque and speed…
I am riding at ratio of 2, only had errors on fast long downhill without pedaling 🤔
Must be my program logic or reed sensor…

Completely agree! It'd inevitably accuse legitimate riders of manipulation = explosion in the Pinkbike comments section.
 

aegidius

Member
Sep 30, 2023
50
28
brisbane
Frankly I think it'd be next to impossible for Bosch to reliably detect manipulation using this approach alone.
Agree. What the histogram method could detect is an arbitrary mapping between input speed and output speed - like a sort of nonlinear speed-dependent gear-ratio. One of the commercial ones (Volspeed, speedbox?) does a smart-system derestrictor that maps speed 1:1 up to 22km/h, then divides by 10 after that to use the last two digits to indicate the true speed, so a displayed 22.3 is 23, 22.4 is 24, and so on. This would totally mess up the histogram, so I'm not sure how they get away with that (but maybe they don't, and they'll be found out eventually!)
At higher speeds though, a higher cadence can be explained away by a lower gear ratio.
You're only going to apply a multiplier at higher speeds, therefore in higher gears. So it will map higher gears onto lower ones.
 

manu.w

Member
Aug 5, 2023
95
40
belgium
If they "impose" us to pedal at a certain candance for a given speed, that makes no sense...
on a horizontal track:
deep sand : i will be in higest gear, high cadance, looow speed
asfalt: lower gear, same cadance, hiiiigh speed
so i pedal at the same cadance, and the speed difference is huuuge...
...and i put same efford / watts for both
 
Last edited:

manu.w

Member
Aug 5, 2023
95
40
belgium
Routed a 5 wire cable to the motor 😃

IMG_5009.jpeg
 
Last edited:

Sander

Member
Dec 29, 2022
56
29
NL
Niiice 2000km, well ahead of me!
Yep, it's the Purion 200. Nice change from the LED remote. Sure, it's super bulky, but only a little larger than the LED, so it was already wasted space. PS don't believe the requirement that you need to take the bike to a dealer to setup the new display - you can do it yourself at home without issue.
True! I had a crash ones and the led controller broke down. Just bought a new one, deleted the old one in the flowapp and paired the new one. Easypeasy🚀
 

mybrainhurts

New Member
Dec 14, 2023
12
8
Poland
Preview of one of the new pieces I'm working on. The OLED display and buttons will show the true speed, true distance, reported speed etc, as well as providing the user options to set their own multiplier, change units, wheel circumference etc. It'll be set in a 3Dprinted case to suit either mounting on handlebars or top tube.

Other works in progress: new tiny electromagnet, hall sensor, no LPP.

View attachment 129945
Does it mean you will offer complete packages (box + instruction) for sale here?
 

Marvin2Shoes

New Member
Dec 12, 2023
18
4
Townsville, Australia
I am fast coming to the conclusion that we need to throw the Bosch controller in the trash and design a new one that has none of the nonsense attached to it. No phoning home via app, no errors generated by gps-controller speed differential, no inbuilt speed limiting (or at least a user pre-settable one).
Once my CX is out of warranty I will not be interested in having my bike hamstrung by this nonsense.
Maybe it'd be just easier to fit a different motor?
 
Last edited:

aegidius

Member
Sep 30, 2023
50
28
brisbane
I am fast coming to the conclusion that we need to throw the Bosch controller in the trash
Have been thinking the same lines myself. The Bosch geartrain is great, and the power electronics are good too. We don't need to re-invent those. What might be a good line of inquiry is to identify the signals going to the motor controller (3-phase bridge) chip, and the raw signals coming from the torque and cadence sensors. Then remove the existing CPU and replace it with something from the Arduino family (or similar). Have it outside the motor case so BLE signals can get to phone displays. We would not be able to use Bosch batteries, unless someone can decipher the CAN bus signals the BMS needs to work.
 

Marvin2Shoes

New Member
Dec 12, 2023
18
4
Townsville, Australia
Have been thinking the same lines myself. The Bosch geartrain is great, and the power electronics are good too. We don't need to re-invent those. What might be a good line of inquiry is to identify the signals going to the motor controller (3-phase bridge) chip, and the raw signals coming from the torque and cadence sensors. Then remove the existing CPU and replace it with something from the Arduino family (or similar). Have it outside the motor case so BLE signals can get to phone displays. We would not be able to use Bosch batteries, unless someone can decipher the CAN bus signals the BMS needs to work.
Or we kill the comms and just buy an off-the-shelf bms? CAN isn't required to charge Lithium batteries. CAN, in my experience, has always been about crippletronics. The rumour is the replacement for CANbus will be encrypted... Try to circumvent these over-the-top nanny state limitations then....
 
Last edited:

aegidius

Member
Sep 30, 2023
50
28
brisbane
The difficulty with my cunning plan is that there are so few spare Bosch motors with blown/bricked PCB's or otherwise available for parting out. As a first step, I'd like to see a good clear pic of both sides of the PCB, in order to identify chips. I know there's a Gen 3 teardown out there but haven't seen the Gen 4.
 

Marvin2Shoes

New Member
Dec 12, 2023
18
4
Townsville, Australia
With the hall effect conversation a few replies back.... May I ask, would you be referring to these components:
A hall effect sensor (3 or 4 wire)
If the device has a connection to ground as well as two other connections then that is classed as a three wire device and will usually output a logic level square wave (digital signal).
An example of a two wire sensor is the variable reluctance (VR) sensor which outputs a purely analogue signal which increases proportionally in amplitude with revs, but decreases with increase in distance between sensor and magnet.
The reed switch I have used in the past is for detecting the opening of a window/door for alarm systems and is NOT designed to be used at wheel rotation frequency.
Are these the components being talked about or have I misunderstood the conversation?
BTW If you need any signals looked at, I have an oscilloscope here and a CANbus hat to suit my Raspberry Pi if you need to sniff any CAN signals.
I have been through all this with my BMW R1200RT motorcycle which I have removed the crippletronics from already. It is now at the start & idle stage.
 
Last edited:

aegidius

Member
Sep 30, 2023
50
28
brisbane
There are two-wire Hall sensors (not VR). See here for an example. I can't prove it but the Bosch spoke magnet sensor appears to use this or a similar one. From the motor it sinks ~1mA when the magnet is present, otherwise it's open circuit. It can be reliably read by an Arduino pin with a pullup 3.3k to the +3.3V supply.

Of course you could use a 3-wire one just as well, I just used the Bosch one because it's nicely packaged for mounting on the bike.
 

Marvin2Shoes

New Member
Dec 12, 2023
18
4
Townsville, Australia
There are two-wire Hall sensors (not VR). See here for an example. I can't prove it but the Bosch spoke magnet sensor appears to use this or a similar one. From the motor it sinks ~1mA when the magnet is present, otherwise it's open circuit. It can be reliably read by an Arduino pin with a pullup 3.3k to the +3.3V supply.

Of course you could use a 3-wire one just as well, I just used the Bosch one because it's nicely packaged for mounting on the bike.
Definitely happier seeing a hall effect sensor detecting the wheel magnet than a reed switch! Can you tell me... How is the original sensor inside the motor detecting the B field... is there a ferrous slug protruding/flush with the alloy case picking up the flux?
 

aegidius

Member
Sep 30, 2023
50
28
brisbane
Mine is the spoke magnet and wired sensor version (Gen 4 CX non-Smart), so I don't know if it even has the pickup inside the motor casing.
 

FRANK56

Member
Nov 5, 2023
14
7
Sardegna, Italia
Good morning everyone and happy 2024. I congratulate megabobra for having designed and made available the project to create the device to unlock the speed limit of the smart system with rim magnet. Following the guidelines of the post, I created the device with a Xiao rp2040 seeduino, adapting the project to the voltage of 3.3v and a hall effect sensor to detect wheel revolutions. Performing bench tests, the device seems to work well, but one of its features leaves me perplexed. When I simulate a wheel speed of about 6 km/h, the megabobra switches to a 1/1 ratio, but the duration of the output pulses after about 5 wheel revolutions goes from about 140ms to about 1200ms for one pulse, then it starts giving again short pulses. In practice it is as if the wheel stopped on the magnet for 1200 ms. I don't know yet if this feature can cause problems on my bike, I haven't tried mounting the megabobra on the bike yet. Has anyone encountered problems at low speeds?
 

megabobra

Active member
Jul 24, 2022
266
268
Australia
Good morning everyone and happy 2024. I congratulate megabobra for having designed and made available the project to create the device to unlock the speed limit of the smart system with rim magnet. Following the guidelines of the post, I created the device with a Xiao rp2040 seeduino, adapting the project to the voltage of 3.3v and a hall effect sensor to detect wheel revolutions. Performing bench tests, the device seems to work well, but one of its features leaves me perplexed. When I simulate a wheel speed of about 6 km/h, the megabobra switches to a 1/1 ratio, but the duration of the output pulses after about 5 wheel revolutions goes from about 140ms to about 1200ms for one pulse, then it starts giving again short pulses. In practice it is as if the wheel stopped on the magnet for 1200 ms. I don't know yet if this feature can cause problems on my bike, I haven't tried mounting the megabobra on the bike yet. Has anyone encountered problems at low speeds?

Hi Frank,
Good to hear your build went well.
When traveling slow, the pulse is 1:1 as you found. Then over the next five wheel revolutions the pulse duration will gradually increase each time as dictated by the multiplier value. However you should not see anything like 1200ms.
It's really the duration between pulses which will increase most noticeably, as while you're increasing speed the pulse itself (ie the time the magnet is visible to the hall sensor) will be getting shorter and shorter.

To test whether the 1:1 firing is required, the device tests the duration between pulses on each firing, including as the multiplier is being introduced in those five revolutions. If the reported speed becomes too slow as the multiplier increases, the device will revert back to 1:1.

It could be that in your test, the device started introducing the multiplier then reverted back to 1:1 due to insufficient speed, and waited for the next hall sensor magnet pickup, causing the 1200ms pulse?

Best way to test for real behaviour is to ensure you increase your speed sufficiently through those five revolutions. eg start from stopped then speed up to 20kph - you should see a quick speed pickup at 1:1 initially, then a slowing as the multiplier comes in, then a stable speed once it's running at full multiplier.

Hope this helps?
 

FRANK56

Member
Nov 5, 2023
14
7
Sardegna, Italia
Ciao Frank,
È bello sapere che la tua creazione è andata bene.
Quando si viaggia lentamente, il polso è 1:1 come hai trovato. Quindi, nei successivi cinque giri della ruota, la durata dell'impulso aumenterà gradualmente ogni volta come indicato dal valore del moltiplicatore. Tuttavia non dovresti vedere nulla come 1200ms.
In realtà è la durata tra gli impulsi che aumenterà in modo più evidente, poiché mentre aumenti la velocità l'impulso stesso (cioè il tempo in cui il magnete è visibile al sensore Hall) diventerà sempre più breve.

Per verificare se è necessaria l'accensione 1:1, il dispositivo verifica la durata tra gli impulsi a ciascuna accensione, anche quando il moltiplicatore viene introdotto in queste cinque rivoluzioni. Se la velocità riportata diventa troppo lenta all'aumentare del moltiplicatore, il dispositivo tornerà a 1:1.

È possibile che durante il test il dispositivo abbia iniziato a introdurre il moltiplicatore, quindi sia tornato a 1:1 a causa di una velocità insufficiente e abbia aspettato il successivo pickup del magnete del sensore Hall, provocando l'impulso da 1200 ms?

Il modo migliore per testare il comportamento reale è assicurarti di aumentare sufficientemente la velocità attraverso queste cinque rivoluzioni. ad esempio, inizia da fermo e poi accelera fino a 20 km/h: inizialmente dovresti vedere una rapida ripresa di velocità a 1:1, quindi un rallentamento quando entra in gioco il moltiplicatore, quindi una velocità stabile una volta che funziona al moltiplicatore completo.

Spero che questo ti aiuti?

Hi Frank,
Good to hear your build went well.
When traveling slow, the pulse is 1:1 as you found. Then over the next five wheel revolutions the pulse duration will gradually increase each time as dictated by the multiplier value. However you should not see anything like 1200ms.
It's really the duration between pulses which will increase most noticeably, as while you're increasing speed the pulse itself (ie the time the magnet is visible to the hall sensor) will be getting shorter and shorter.

To test whether the 1:1 firing is required, the device tests the duration between pulses on each firing, including as the multiplier is being introduced in those five revolutions. If the reported speed becomes too slow as the multiplier increases, the device will revert back to 1:1.

It could be that in your test, the device started introducing the multiplier then reverted back to 1:1 due to insufficient speed, and waited for the next hall sensor magnet pickup, causing the 1200ms pulse?

Best way to test for real behaviour is to ensure you increase your speed sufficiently through those five revolutions. eg start from stopped then speed up to 20kph - you should see a quick speed pickup at 1:1 initially, then a slowing as the multiplier comes in, then a stable speed once it's running at full multiplier.

Hope this helps?
Thanks for the clarification, from the tests carried out the device behaves as you describe, but the problem of switching on the electromagnet for a complete wheel revolution remains, from the instrumental tests just carried out, the frequency in which what described happens is around 1Hz which corresponds to 8km/h considering a wheel circumference of 2300 mm. This it does every five revolutions at that specific frequency. I'm thinking it might be a defect in my seedling, later I'll try to change the output pin of the electromagnet. Until I see consistent behavior, I will not mount the device on the bike. I wouldn't want the Bosch anti-tuning software to generate an error when it sees a permanent signal for a wheel revolution while the pedals continue to rotate.
I will do further testing and keep you updated. Thank you and sorry for the comments.
See you soon, have a nice day.
 

EMTB Forums

Since 2018

The World's largest electric mountain bike community.

559K
Messages
28,287
Members
Join Our Community

Latest articles


Top