1
\$\begingroup\$

We're converting an F150 to hybrid, and I'm working on having our system be able to tell when the truck is in PRND. Primarily, I'd like to know when it's in neutral - the others should come as a byproduct.

There may be a way to read this over the CAN bus. We've tried without success although we've read many other basic signals (engine RPM, throttle position) from the CAN bus. But for now we've identified that this signal is available through the transmission connector. It's a 16 pin connector and two of those pins are a PWM output and a return ground. Those pins are used to transmit the PWM signal from the transmission range sensor. Great, so this is the physical location of our signal. Now we need to read it.

Here's what we've tried:

  1. Oscilloscope - we verified the signal changes as you shift through PRND in accordance with the manual. I can get pictures later if they're helpful. Just trying to validate approach at the moment.

  2. Arduino Mega - okay, so we know the signal is there and now we're splicing off the transmission range sensor PWM output in the transmission connector directly to the Arduino Mega and using the analogRead() function. This set up draws too much power for the truck. The dash shuts off and the truck doesn't like it. Why's that? Is there something inherent about the Arduino that makes it power hungry?

  3. Add an opto-isolator - in an effort to isolate the two circuits (the truck's transmission range sensor and our Arduino Mega), we use an opto-isolator. This allows everything to run fine. But it doesn't send any useful data to the Arduino. Instead, it just outputs a constant 2.3 V to the Arduino side regardless of what gear we select with the shifter. This is odd... but it seems like the opto-isolator is working because the LED on the board is visibly working. Circuit diagram coming. enter image description here

  4. Voltage divider - trying to simplify we went with a voltage divider. The Arduino should be able to read PWM fine so perhaps it's just a matter of making sure we aren't pulling too much current from the transmission's circuit (?). A 10 Ω and 1 kΩ resistor which the truck didn't like, presumably because our circuit was drawing too much current. And finally, a 1 MΩ resistor which the truck was fine with but the Arduino reading is wacky with this set up. It reads 461-463 out of 1023 because the analog read uses a 10 bit ADC. But the voltage we're reading at the Arduino is .35V with multimeter but it's 1.07V at the transmission range sensor. I figure using a multimeter could be an incorrect way to measure it because it's a PWM signal but this is what we've tried.

enter image description here

My current thought is that we should try an RC filter. The transmission range sensor frequency is 124 Hz IIRC, will check. I think that means we'd need to design an RC filter that has that 10 MΩ resistor that didn't draw too much power from the truck. But I've been reading and trying to refresh my knowledge and I'm stuck on what criteria to choose to design the filter. Or even if I'm pursuing a workable solution.

I'm not an electrical engineer by training but I am an electrical engineer in training today. Your help is much appreciated.

\$\endgroup\$
3
  • \$\begingroup\$ The resistor values in your voltage divider ate far to high. Your Arduino's ADC input probably has an effective resistance somewhere in the 10k - 100k range, and that's placed in parallel with the 'Z2' in your divider. You'll nee to either lower the divider values substantially or use a high-impedance opamp buffer between the divider and the Arduino. \$\endgroup\$
    – brhans
    Oct 17, 2022 at 21:55
  • \$\begingroup\$ The optoisolator circuit should work (depending on sensible values for R1 & R2), but unless you smooth & filter the signal you'll not have much luck reading it as an analog value. If you want to measure the PWM duty-cycle directly without smoothing & filtering then you need to feed it into a timer input, not an analog input. \$\endgroup\$
    – brhans
    Oct 17, 2022 at 21:57
  • \$\begingroup\$ Oscilloscope traces would be very helpful. How does it vary with no load, 100k, 10k, 1k say. (Or just a few values across a wide range to see how much it is loaded . || Arduino analog in should not cause the problem you describe. If the PWM Vmax is > Arduino supply it will clamp the PWM to Arduino power supply rail via in-IC body diode which may upset the PWM. It is also quite likely to damage the Arduino. || Once you know the PWM Vmax and Vmin and affect of loading we can advise re an interface. \$\endgroup\$
    – Russell McMahon
    Oct 18, 2022 at 10:43

2 Answers 2

1
\$\begingroup\$

Okay, so we have a solution. As we were retracing our steps.. we realized that we had, at one point, been able to read the voltage with the Arduino. But at that time, adding the Arduino to the circuit drew too much power from the truck. So we re-did that with the 1M+1M voltage divider and plotted what the Arduino was reading. It was really noisy but seemed to indicate that we were reading the PWM too fast. 124 Hz signal. Arduino ADC has 9600Hz sampling rate. How to solve reading the signal too fast...?

Then it occurred to my teammate that we were no longer using the interrupt pin on the Arduino which is what had lead to successful, but power hungry, reading before. So we switched to the interrupt pin. Made sure we had solid connections and now we're reading PRNDL successfully.

tldr; voltage divider to draw less current and keep truck happy. Interrupt pin on Arduino to read PWM signal.

Thanks!

\$\endgroup\$
1
  • \$\begingroup\$ Bryon - Hi, Thanks for coming back with an answer to your question. In order to effectively mark the topic as solved, please consider "accepting" an answer (i.e. click the "tick mark" next to an answer - your answer or another one - to turn the relevant tick mark green). This shows that you don't need more help and future readers can quickly see that the accepted answer was the best solution. Thanks. (If you can add any waveforms to your answer showing the differences between PRND position, even better :) ) \$\endgroup\$
    – SamGibson
    Oct 19, 2022 at 20:35
0
\$\begingroup\$

I used this term: "PRNDL (term used by the industry) switch in F150" and a lot of information appears about replacement and replacements. Your are correct it is defined as a neutral safety switch that also gives transmission gear settings. This connects to the TCM but is model year dependent. The Ford F-150 TCM or transmission control module is located inside the transmission housing, under the hood of the car. This information is on one or more of the internal buses. A lot depends on the year. Your best bet is to find a service manual you might get lucky. This switch and module was designed for use only in the FORD system so getting the information probably will very difficult at best.

\$\endgroup\$
3
  • \$\begingroup\$ Thanks, Gil. We're aware we could probably try doing some more CAN bus sniffing to find the signal. That would be the cleanest solution but seems like the effort to investigate is more than tapping the physical wire. Because we need to figure out what the correct parameter ID is for the signal which is proprietary and requires some experimenting. We can do it, just prefer not to yet if we don't have to. Do you have thoughts on the reasons why reading the PWM signal isn't working? I've tried to describe how we tried doing it. Is there anything fundamental we're missing? \$\endgroup\$
    – Bryon
    Oct 17, 2022 at 19:54
  • \$\begingroup\$ Not that I know about but they also used a VPWM format. There is also a SCP protocol (somewhat like CAN but not compatible) that was about 10.4K. The SCP bus was fault tolerant and very robust requiring a special chip set. A lot depends on the MY (Model Year). These interfaces changed over the years. \$\endgroup\$
    – Gil
    Oct 17, 2022 at 22:43
  • \$\begingroup\$ There are many sources of CAN tools. Some may be able to do what you want but I am not current on them. When I worked with that stuff we had tables with all the code etc. You might be able to find them or some may be posted. I have seen some codes published by people trying to replace parts such as a cluster, clock, etc. Also realize there are three classes of messages you need to know. There is the OBDII, Dealer, and OEM messages, they are more complicated to get then just sniffing the bus. Many times the OBDII connector is connected to a gateway to isolate it from the real system and protect \$\endgroup\$
    – Gil
    Oct 19, 2022 at 4:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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