1
\$\begingroup\$

I am attempting to use a 5v Arduino pro mini to display the current gear on a 2005 Kawasaki Ninja based on the ratio of the wheel speed and the engine RPM. The display is a single digit 7-segment display. The RPM input is coming from the 12v coil signal wire. The wire provides 12 volts and then goes to 0 volts to trigger the coil to fire. I have no problem reading the 12v-0v-12v pulses with the arduino. The Arduino groud is connected to the motorcycle's ground and the coil signal wire is going to digital pin 2 via a 1k ohm resistor.

The wheel speed is coming from a hall effect sensor provided with the TrailTech gauge pack I already have on the bike (http://www.trailtech.net/digital-gauges/vapor/752-300). The voltage difference in between the two wires is 3 volts except when the magnet passes by where is goes to 0 volts. I have been able to read the 3v-0v pulses by simply splicing two wires off of the sensor leads and connecting the positive wire to digital pin 3 and the other wire to the arduino's ground. With the sensor connected like this, the arduino can read the pulses from the sensor and the gauge pack can read wheel speed without any problem.

The problem comes in when trying to read both wheel speed and engine rpm. I have the coil signal wire and the wheel speed sensor connected as described above and am able to read the coil pulses but not the wheel speed pulses and the gauge pack is also not able to read wheel speed.

I believe this is because of a lack of isolation and the noise from the motorcycle's electrical system but I am not sure. My first thought is to use an optoisolator to send the wheel speed signal. My (possibly naive) thought process and limited understanding of optoisolators lead me to believe that I should be able to connect the two wires from the hall effect sensor to the input for the optoisolator and use the output from the optoisolator to trigger the arduino.

Can anyone tell me if my assumptions are correct? Are my issues reading wheel speed likely caused by a lack of isolation? Is an optoisolator the way to go?

\$\endgroup\$
  • 2
    \$\begingroup\$ You are feeding a 12V signal directly to the Arduino via a resistor.... That would be your first problem. How are you powering the Arduino? And a schematic would help a lot here.. \$\endgroup\$ – Trevor_G Apr 25 '17 at 2:13
1
\$\begingroup\$

You are correct in your assumption of how an optoisolator works.

Yes I believe your issues can easily be caused by lack of isolation. And direct connection to the bike's electrical will be "noisy" as opposed to a nice clean output from an optoisolator.

Yes I believe that is the way to go.

I would do it for both sensors.

Your title question mentions ground isolation. That may not be a problem, or it might be. Best is if your Arduino's power suppply is regulated if running from the bike's battery. I often use small 12v-to-5v converters (this is a search) to power my arduinos from noisy 12V sources like those types of batteries connected to trickle chargers. Bottom line is that a noisy power source can mess up a perfect program.

I did some searching and came up with this optoisolator that does not require the grounds to be the same on both sides. Optoisolator

It says long-distance, all that means is that the leads can be long enough for your purposes. We do not give shopping or specific purchasing recommendations on this site, but I am showing this to you just to give you an idea of the kind of unit you should look for.

If you can keep the grounds separate then by all means do so. No good reason to get the bike's magneto impulses into your circuits. Just running the wires will probably pick up some, so your optoisolator should be located next to the computer. Let it clean up any extraneous signals that come in on the wires.

Sounds like a fun project. Enjoy!

\$\endgroup\$
  • 1
    \$\begingroup\$ Thanks a bunch for the input. I am currently powering the arduino via the FTDI USB to Serial converter used to program the chip and communicate for debugging. The arduino pro mini has a raw input that will feed up to 12v through an onboard voltage regulator. I was planning on using a resistor to drop the voltage to a safe level (<12v even with the alternator running) and power the arduino that way. If this still causes issues then I was going to rip apart an old cigarette lighter usb charger and use its internals. \$\endgroup\$ – bvallerand Apr 25 '17 at 16:55
  • \$\begingroup\$ That is a good alternative. Sounds like you have a good handle on the project. \$\endgroup\$ – SDsolar Apr 25 '17 at 18:00
1
\$\begingroup\$

I read your question just before turning in last evening. When I started to answer it this morning I see that SDsolar hs made nearly all the points I had in mind. I agree with all he has said.

You may need some help with selection resistors for use with an optocoupler. The module SD linked to is not well documented so follows an appropriate design for your two signals should you use a common part, 4n25. It draws about 4 ma from your sensors. Make sure your wheel sensor can provide that much current while maintaining nearly 3 volt peak to peak swing.

You need a resistor in series with the input of each opto. Use 470 ohms for the wheel opto and 2.2k for the engine speed opto. Use the pullup resistors in Arduino for both opto outputs. They will be 20k or more.

Let me know if your wheel sensor can't provide the necessary current. We will find a solution for that.

Connections; plus wheel lead to opto input R, 470............. other end 470 to opto pin 1................. minus wheel lead to opto pin 2................ opto pin 5 to arduino digital in, wheel................ opto pin 4 to arduino ground............

plus rpm lead to opto input R, 2.2k.............. other end 2.2k to opto pin 1.................. minus rpm lead to opto pin 2............. opto pin 5 to arduino digital in, rpm.............. opto pin 4 to arduino ground...................

With best wishes from the Bitterroot

\$\endgroup\$
  • 1
    \$\begingroup\$ I was originally looking at something like the NTE3220 (nteinc.com/specs/3200to3299/pdf/nte3220.pdf) because it contained two isolators on one chip (and is available via prime shipping through everyone's favorite rainforest) but then I was concerned about the current draw as well. I have no way of knowing what kind of current the gauge pack can supply or what kind of current can be run through the sensor since they are both sealed and just labeled "TrailTech". \$\endgroup\$ – bvallerand Apr 25 '17 at 17:04
  • \$\begingroup\$ if you load the wheel sensor with a 1k resistor and the guage works normally it will also work with the circuit I described. \$\endgroup\$ – lle Apr 25 '17 at 23:02
0
\$\begingroup\$

I'd suggest you don't need to optically isolate both circuits or change your grounding to get reliable operation.

The sensing of the 12 V signal seems incorrect. If you have a simple single 1K Ohm resistor in series to the Pin(2) on your Arduino, then that is an incorrect way to interface. This means you raise the Pin(2) above the 5 V supply of the Arduino.
I'm not sure of your coil drive, but you are likely causing about 7 mA or so current flow into the Arduino Pin(2). Bad Juju.

Since your sensing of the Hall Effect sensor is working, and that voltage level is within specs for the Arduino (3 V) then I'd leave that as a solved problem.

For the 12 V sensor I'd suggest that you could optically isolate it if you want, but I doubt it will be required. I'd suggest something like this:

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
  • 1
    \$\begingroup\$ I had originally planned on using a voltage divider to drop the voltage of the coil signal to 3-5v but when I had that hooked up the arduino was not picking up the pulses. I agree that just hooking the coil signal wire directly to the arduino doesn't sound like a great idea but when I tried it, it worked so I just went with it. \$\endgroup\$ – bvallerand Apr 25 '17 at 16:59
  • \$\begingroup\$ I will give your circuit a try sometime this week. If I am still having issues then I think the APL-064L (digikey.com/product-detail/en/broadcom-limited/ACPL-064L-500E/…) might be a good option. The current draw is extremely low so it is unlikely that it would have any negative effect on the hall effect sensor. \$\endgroup\$ – bvallerand Apr 25 '17 at 17:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.