Need help re reading pulses from a coil picking up magnets on a wheel

I have installed a Rostra electronic cruise control on my motorcycle. I mounted 2 magnets on the rear wheel along with the Rostra pickup coil. For reasons I have never determined it would randomly cease to engage. After no small amount of testing I found that if I (1) came to a complete stop (2) Turned the ignition off (3) turned the key back on and (4) if the 'engaged LED momentarily flashed... it would start engaging again... for a while. Nothing else would work. (BTW, I have the same Rostra Cruise Control in a street rod I built. I swapped the units and the problem stayed with the bike). So I added an interface using an Arduino Mega and 3 relays (Pulse) (Set/coast) (Resume/accel).
I reasoned that since I had to come to a complete stop, if I kept the pulse circuit open until just before I hit the Set/Resume switches, then closed it and delayed 1/4 second, then closed the relay connected to the Set or Resume relay, it might help (I open the pulse circuit again when the brake is hit) . So I wired up and wrote the code. Waa-Laa, now it works like a charm! I would really like to understand 'Why' I had to do that but that question is secondary to my next one.
Now that I have all that working I would like to input the pulse signal to the Mega. But I am new enough to all this that I am not sure how to proceed. I think I just need an opticoupler between the pulse wire and the Mega. For bench testing I have cobbled up a 'poor mans' pulse generator (a spinning disk with a coupla magnets and a coil like the one on the bike) and hooked up a small LED. I found I didn't burn up the LED at higher RPM's but it did get very bright. I looked all over the web but I could not find an example similar to what I want to do.(I depend highly on example code!) So that was a long-winded way of asking... how can I safely connect that pulse wire to the Arduino and read the pulse count?

5V zener

Another approach is use a hall switch to detect the magnet, much easier to interface to.

Have you contacted customer service at Rostra?

It may be a simple problem, that they can advise.
Particularly if you are putting it on a motorcycle, there may be a problem with how you mount the pickup and magnets.

Can you post a picture of how you have mounted the magnets and pickup please.

Tom... :slight_smile:

Ted: Thanks, but not enough information.

MarkT: I had considered the idea of using a Hall switch but was concerned about how to mount it in the harsh environment it would have to ‘live’ in. As an example the “Sunfounder” unit I found on Amazon looks like a good choice. Maybe (1) desolder the transistor and remote it to the same location as the coil or (2) encase the entire unit in silicon or urethane and mount the entire unit near the coil.

TomGeorge: There is really no reason to change the current setup since the Rostra is working just fine as-is. In any case, it’s been my experience (as well as others who have mounted the Rostra on a M.C.), that Rostra Customer service will not advise anything once they find out you have mounted their unit on a M.C. They even warn against it in their documentation.

So I think (at 6 bucks a pop) I can afford to pick up a couple of the Sunfounder units and experiment with weatherproofing them and mounting them. I can see that, as MarkT states, using a hall switch pretty much eliminates any interfacing issues . I will post again in a few days with my results.

google - car hall sensor - images

OP’s original problem: I would expect you’re dealing with some type of low speed lock-out. Your relays are preventing slow pulses being seen until you press the engage button. The controller then sees an instantaneous jump in speed that satisfies the lock-out.

Have you calculated the pulse count from the tire outside diameter to check if you’re making anything close to the controller pulses per mile setting? You can always add more magnets so long as they are reasonably symmetrical around the wheel, they don’t need to be in pairs.

Wow... looks like the perfect choice. But it seems the minimum order would be 499 more of them than I need!

Thanks for posting but remember.. before I cobble in my Arduino interface, it might work just fine for any number of SET/disengage cycles. Then all of a sudden stop working. Also, just stopping would not reset it. Again, I would have to stop, turn off the motor, cycle the ignition swt until the 'engage' led flashed. Then (most of the time) it would work for a while.

Go to scrap yard, auto mechanic, many cars have 4 - one on each wheel


Can you post a picture of how you have mounted the magnets and pickup please.

Tom... :slight_smile:

I have attached an image of the rear wheel setup.

Ted, Thanks for the tip on the automotive type sensor. Since I have already ordered the Sunfounder sensor, and since it is made specifically for the Arduino, I think I will try'n stay with that technology initially. I am still pretty much a newbie to this Arduino environment and I have found over the years that unless I feel really comfortable with any new environment I tend to not try'n mix and match parts that were not specifically made to fit together. If I can get the Sunfounder unit to work good I feel confident that I can weatherproof it by constructing a small 2 part polyurethane container that I can machine on my CNC router, then encase the Sunfounder in it and epoxy the two parts together.

I have some reed contacts in the exact same package as shown in #5, the difference is the third wire. That's yet another option for you.

Magnet + coil: voltage you see will indeed depend on the speed at which they pass. At too slow a speed maybe not enough of a pulse to detect. Also when you get a positive pulse with the magnet approaching, won't you get a negative pulse as the magnet moves away from the coil? The negative probably less than the positive but there should be something due to losses.

One circuit I can think of is an OpAmp that amplifies the signal from the magnet. Set it to 10x or even 20x amplification and you should be able to read all but the super slow speeds. To stop it from damage by overvoltage add a diode pointing the correct direction - this limits the voltage to the forward voltage of that diode, as the coil is basically shorted out, that's about 0.5V. A small current limiting resistor adds extra protection. Maybe also a second diode to short the negative pulse of the coil.

I have attached an image of the rear wheel setup.

Thanks for the image, I assume the mounting in in aluminium.
Have you thought of increasing the distance between the magnets and sensor?
The disk everything is mounted on is steel?
The car sensors are reluctance type, they sense metal teeth not magnets.
Tom... :slight_smile:

Thanks for the image, I assume the mounting in in aluminium.
Have you thought of increasing the distance between the magnets and sensor?
The disk everything is mounted on is steel?
The car sensors are reluctance type, they sense metal teeth not magnets.
Tom... :slight_smile:

Tom, yes, the magnets are mounted in aluminum brackets. And no, I never considered increasing the distance. But since my band-aid fix seems to be working well I am probably not going to bother to alter any of that part now.
BTW, the reason I want to obtain the pulse count is... the Rostra allows the bike to slowdown about 3 mph up a typical hill and speed up the same going down. Just for fun I want to see if I can fine tune those numbers and maybe get it down to +- 1 mph. My plan is to capture the pulse count on SET, then when it varies up/down more than say, 1 mph, programmatically issue Accel/Coast commands accordingly. While this would hardly be necessary, it sounds like a lot of fun to try' see what I can achieve.

Thanks for posting. Again, I now plan on trying to get the Sunfounder sensor to work for me. If I can make that work... end of story. If not, I will consider the option you suggest. But as I write, there is a lot in your suggestion I really do not understand.

For reading the coils with your Arduino, the problem you have is indeed the different voltage that the coil produces at different speeds. This circuit will output 5V for any input of 0.45V up to 100V or so. Or more, as long as R1 and D2 can handle the current. As an Arduino will detect high at about 2.5V, the lower limit of the input for a high signal output is even less, about 0.25V. I was thinking of a circuit like this:
D2 limits the voltage on the positive input of the OpAmp to 0.5-0.7V - the forward voltage of the diode, regardless of what the coil really produces.
R2 limits the current through the diode. Maybe this value is way too high. Would need experimentation.
U1/R2/R3 is a regular non-inverting OpAmp, 11x gain. Ignore the part number, I just needed the symbol. Increase R3 (or decrease R2) for less gain.
D3 protects against reverse voltages, limiting it to about -0.5V.

EMF may be an issue, providing false triggers. Filtering caps on the OpAmp's input may help against this.

You said in your first post you wanted to understand why it didn’t work correctly. Putting a band-aid on the problem with an Arduino and relays may fix the issue but provides zero understanding. Sooner or later, the band-aid turns into the x-y problem and that’s where you are now.

That fact that the device can only maintain +/-3mph stability suggests you don’t not have enough pulses per mile to provide an accurate speed measurement which also speaks to the overall intermittent behavior.

Whats wrong with approaching the problem logically? The controller manual says the lowest pulse per mile setting is 2000. Are you even close to that?

Measure the circumference of your rear wheel in feet (or the diameter and multiply by pi). Divide 5280 by that circumference and multiple by two. That’s how many pulses per mile your arrangement generates. Is it less than a thousand? If so, that’s probably too low for the controller. Add some magnets, problem solved.

Some much much smarter than me once said the best solution is the simplest solution. Finding the root cause of a problem is the only way to provide the simplest solution.

You could try this . - actually designed for amplifying the ripple on an alternator to make a revcounter.

Works well from 100mV p-p upwards.


revpre.pdf (18 KB)