PCM Diagnostics & Tuning HP Tuners | Holley | Diablo
Sponsored by:
Sponsored by:

Read and convert RPM with Arduino... how do I interpret the RPM?

Thread Tools
 
Search this Thread
 
Old 12-28-2017, 02:08 PM
  #1  
On The Tree
Thread Starter
iTrader: (1)
 
MEAN GTO's Avatar
 
Join Date: Jul 2007
Location: Southern MD
Posts: 180
Likes: 0
Received 0 Likes on 0 Posts

Default Read and convert RPM with Arduino... how do I interpret the RPM?

Hi everyone, I would like to take an RPM signal from my 2005 GTO and interpret it as the actual number of revolutions per minute that the engine is spinning. I will be running the signal into an Arduino, but I'm not sure what I'll need to do to convert that signal to true RPM.

The problem is, after reading various posts/threads in this forum, I'm still not sure what I need to do in order to convert that signal into RPM. I have a 24x reluctor, unlike most Gen IV engines, and I'm not sure if the signal will pulse twice per full rotation, 4 times per full rotation, or what. Can anyone clarify this for me, please?? Thanks everyone!

-Andrew
Old 12-28-2017, 02:14 PM
  #2  
Restricted User
 
JoeNova's Avatar
 
Join Date: Mar 2014
Location: Ohio
Posts: 7,194
Received 107 Likes on 89 Posts
Default

I made that mistake before.

Its way easier to read Cylinder 1 coil signal than it is to try and interpret the readings from the crank sensor. Tap into the coil signal from the cylinder 1 going to the PCM. Measure how fast the PCM cycles it per minute. Double that to get your RPM (it only fires every other revolution).
Old 12-30-2017, 10:51 AM
  #3  
On The Tree
Thread Starter
iTrader: (1)
 
MEAN GTO's Avatar
 
Join Date: Jul 2007
Location: Southern MD
Posts: 180
Likes: 0
Received 0 Likes on 0 Posts

Default

Originally Posted by JoeNova
I made that mistake before.

Its way easier to read Cylinder 1 coil signal than it is to try and interpret the readings from the crank sensor. Tap into the coil signal from the cylinder 1 going to the PCM. Measure how fast the PCM cycles it per minute. Double that to get your RPM (it only fires every other revolution).
Thanks for the help again Joe!!!! Silly question, but how would one measure how fast the PCM cycles the coil for cylinder #1 per minute?
Old 12-30-2017, 01:16 PM
  #4  
Restricted User
 
JoeNova's Avatar
 
Join Date: Mar 2014
Location: Ohio
Posts: 7,194
Received 107 Likes on 89 Posts
Default

Measure the time in between each pulse. There should be tutorials on basic counters out there for this. Then you can do the math to figure out how many times that period between pulses would fit into 1 minute, and you have your RPM.

If I were you I would do an average of a few pulses for accuracy. You don't really need it to update the RPM at every single pulse. You'll likely get some really weird results from signal noise, etc.

For pretty much anything automotive I use this smoothing code as a base.
https://www.arduino.cc/en/tutorial/smoothing
It will store X number of values and then average them (lets say 10).
Instead of just averaging 10 readings at a time, it will do a running average. It will store 10, give you an average. The next number comes in and it bumps out the oldest of the 10 and puts the new one in with the other 9 and then gives you an output. Works VERY well reading 5v signals with lots of signal noise on them (wideband, MAP, TPS, etc).
Old 12-30-2017, 11:12 PM
  #5  
TECH Veteran
iTrader: (1)
 
gametech's Avatar
 
Join Date: Sep 2004
Location: Stockbridge GA
Posts: 4,178
Likes: 0
Received 505 Likes on 355 Posts

Default

Originally Posted by JoeNova
Measure the time in between each pulse. There should be tutorials on basic counters out there for this. Then you can do the math to figure out how many times that period between pulses would fit into 1 minute, and you have your RPM.

If I were you I would do an average of a few pulses for accuracy. You don't really need it to update the RPM at every single pulse. You'll likely get some really weird results from signal noise, etc.

For pretty much anything automotive I use this smoothing code as a base.
https://www.arduino.cc/en/tutorial/smoothing
It will store X number of values and then average them (lets say 10).
Instead of just averaging 10 readings at a time, it will do a running average. It will store 10, give you an average. The next number comes in and it bumps out the oldest of the 10 and puts the new one in with the other 9 and then gives you an output. Works VERY well reading 5v signals with lots of signal noise on them (wideband, MAP, TPS, etc).
You are attempting to advise a guy on complicated programming and hardware, when his first post displays an obvious inability to do simple math. Why bother?
The following users liked this post:
Krom (11-19-2019)
Old 12-31-2017, 01:56 PM
  #6  
Restricted User
 
JoeNova's Avatar
 
Join Date: Mar 2014
Location: Ohio
Posts: 7,194
Received 107 Likes on 89 Posts
Default

Because 90% of the time I'm posting on here is when I'm sitting at work, done for the day, with nothing else to do.

The other 10% is when I'm sitting in my basement after a few beers and can't keep my thoughts to myself hahaha.
Old 01-01-2018, 08:01 PM
  #7  
On The Tree
Thread Starter
iTrader: (1)
 
MEAN GTO's Avatar
 
Join Date: Jul 2007
Location: Southern MD
Posts: 180
Likes: 0
Received 0 Likes on 0 Posts

Default

Originally Posted by JoeNova
Measure the time in between each pulse. There should be tutorials on basic counters out there for this. Then you can do the math to figure out how many times that period between pulses would fit into 1 minute, and you have your RPM.

If I were you I would do an average of a few pulses for accuracy. You don't really need it to update the RPM at every single pulse. You'll likely get some really weird results from signal noise, etc.

For pretty much anything automotive I use this smoothing code as a base.
https://www.arduino.cc/en/tutorial/smoothing
It will store X number of values and then average them (lets say 10).
Instead of just averaging 10 readings at a time, it will do a running average. It will store 10, give you an average. The next number comes in and it bumps out the oldest of the 10 and puts the new one in with the other 9 and then gives you an output. Works VERY well reading 5v signals with lots of signal noise on them (wideband, MAP, TPS, etc).
Thanks for the thorough explanation Joe! I'll look into reading the pulses from the Arduino and check out about smoothing so I can get that part figured out. Definitely wanting to incorporate not only TPS, but RPM in some of this for some new ideas Thanks again!

-Andrew
Old 01-01-2018, 08:12 PM
  #8  
On The Tree
Thread Starter
iTrader: (1)
 
MEAN GTO's Avatar
 
Join Date: Jul 2007
Location: Southern MD
Posts: 180
Likes: 0
Received 0 Likes on 0 Posts

Default

Originally Posted by gametech
You are attempting to advise a guy on complicated programming and hardware, when his first post displays an obvious inability to do simple math. Why bother?
Your misinterpretation of my first post displays an obvious inability of comprehension and reading skills. I'm brand new to Arduino and C+ programming, and was clearly asking if someone knew what circuit I needed to tap into, and how many pulses per engine rotation that circuit sees so I can write the conversion necessary for my conditional statements. I'm not aware of how to read pulses, nor how to write a program to count how many pulses a circuit sees in a given time-frame. That has nothing to do with simple math. Complicated programming, and/or complicated hardware should not discourage someone from putting their hands on something, unless catastrophic failure is a possible result.

Also, people interested in learning how to do things ask questions so they can learn-- not everyone in here has done C+ since birth, if your argument becomes that of me not knowing how to do the programming, now that you hopefully understand that my post has nothing to do with basic math concepts. Take your wanna-be condescending seld and go agitate some gravel, and also learn that to be a smart-*** with someone, you should first actually understand what you're attempting to make mockery of, rather than making yourself look foolish in the end. Go find something better to do.

Last edited by MEAN GTO; 01-01-2018 at 09:03 PM.
Old 01-01-2018, 09:33 PM
  #9  
TECH Veteran
iTrader: (1)
 
gametech's Avatar
 
Join Date: Sep 2004
Location: Stockbridge GA
Posts: 4,178
Likes: 0
Received 505 Likes on 355 Posts

Default

Originally Posted by MEAN GTO
Your misinterpretation of my first post displays an obvious inability of comprehension and reading skills. I'm brand new to Arduino and C+ programming, and was clearly asking if someone knew what circuit I needed to tap into, and how many pulses per engine rotation that circuit sees so I can write the conversion necessary for my conditional statements. I'm not aware of how to read pulses, nor how to write a program to count how many pulses a circuit sees in a given time-frame. That has nothing to do with simple math. Complicated programming, and/or complicated hardware should not discourage someone from putting their hands on something, unless catastrophic failure is a possible result.

Also, people interested in learning how to do things ask questions so they can learn-- not everyone in here has done C+ since birth, if your argument becomes that of me not knowing how to do the programming, now that you hopefully understand that my post has nothing to do with basic math concepts. Take your wanna-be condescending seld and go agitate some gravel, and also learn that to be a smart-*** with someone, you should first actually understand what you're attempting to make mockery of, rather than making yourself look foolish in the end. Go find something better to do.
How many times a 24x reluctor wheel pulses per revolution, or how to determine how many times a coil fired per minute are both a matter of extremely simple math. This will be my last post on the matter, as it is no longer entertaining.
Old 01-02-2018, 07:35 AM
  #10  
On The Tree
Thread Starter
iTrader: (1)
 
MEAN GTO's Avatar
 
Join Date: Jul 2007
Location: Southern MD
Posts: 180
Likes: 0
Received 0 Likes on 0 Posts

Default

Originally Posted by gametech
How many times a 24x reluctor wheel pulses per revolution, or how to determine how many times a coil fired per minute are both a matter of extremely simple math. This will be my last post on the matter, as it is no longer entertaining.
It may be common sense to most, but I have absolutely no clue how many times a xx reluctor pulses per revolution. Nor how how many times a coil is fired per revolution, in order to calculate RPM from there. That's not basic math-- that's not knowing the sequence and mechanics of an electronic ignition system, in order to do the basic math. I don't care how entertained you are or aren't; I'm just looking forward to no longer reading your confused remarks.
Old 01-02-2018, 09:01 AM
  #11  
Restricted User
 
JoeNova's Avatar
 
Join Date: Mar 2014
Location: Ohio
Posts: 7,194
Received 107 Likes on 89 Posts
Default

Originally Posted by MEAN GTO
Thanks for the thorough explanation Joe! I'll look into reading the pulses from the Arduino and check out about smoothing so I can get that part figured out. Definitely wanting to incorporate not only TPS, but RPM in some of this for some new ideas Thanks again!

-Andrew
I have a nano based 2 step that uses coil 1 signal and TPS. Was a PITA to get working right, but it works. Just make sure you do some things to the coil signal before it reaches the arduino or it'll fry it. I use $3 nanos for almost everything so it wasn't too bad for me. I ended up spending $10 on random pieces of hardware until I figured something out because the coil signal was seeing crazy random volt spikes up to like 100+ volts.

So I have maybe $15 in a super basic 2 step.

I just started using arduinos last year with no previous programming knowledge. Using example codes and changing the variables helped me get some things done early on. Learning how to deal with multiple relays and 5v inputs was a major step too.

I'm still completely oblivious to the hardware aspect of things.
Old 01-02-2018, 09:04 PM
  #12  
TECH Veteran
iTrader: (1)
 
gametech's Avatar
 
Join Date: Sep 2004
Location: Stockbridge GA
Posts: 4,178
Likes: 0
Received 505 Likes on 355 Posts

Default

Originally Posted by JoeNova
I have a nano based 2 step that uses coil 1 signal and TPS. Was a PITA to get working right, but it works. Just make sure you do some things to the coil signal before it reaches the arduino or it'll fry it. I use $3 nanos for almost everything so it wasn't too bad for me. I ended up spending $10 on random pieces of hardware until I figured something out because the coil signal was seeing crazy random volt spikes up to like 100+ volts.

So I have maybe $15 in a super basic 2 step.

I just started using arduinos last year with no previous programming knowledge. Using example codes and changing the variables helped me get some things done early on. Learning how to deal with multiple relays and 5v inputs was a major step too.

I'm still completely oblivious to the hardware aspect of things.
Damn. I was irritated when I needed to use a 12v sensor on a 5v input and had to rig a simple voltage divider with a couple of resistors. You would need to smooth the hell out of 100v spikes to keep from frying an arduino input. Arduinos typically are not made to anything resembling "automotive" grade reliability. Hobbyists such as ourselves can get away with a lot, but there are limitations.
Old 01-03-2018, 08:55 AM
  #13  
On The Tree
Thread Starter
iTrader: (1)
 
MEAN GTO's Avatar
 
Join Date: Jul 2007
Location: Southern MD
Posts: 180
Likes: 0
Received 0 Likes on 0 Posts

Default

Originally Posted by JoeNova
I have a nano based 2 step that uses coil 1 signal and TPS. Was a PITA to get working right, but it works. Just make sure you do some things to the coil signal before it reaches the arduino or it'll fry it. I use $3 nanos for almost everything so it wasn't too bad for me. I ended up spending $10 on random pieces of hardware until I figured something out because the coil signal was seeing crazy random volt spikes up to like 100+ volts.

So I have maybe $15 in a super basic 2 step.

I just started using arduinos last year with no previous programming knowledge. Using example codes and changing the variables helped me get some things done early on. Learning how to deal with multiple relays and 5v inputs was a major step too.

I'm still completely oblivious to the hardware aspect of things.
That's really cool, actually! How does the Arduino 2-step you made physically control the ignition system? I have a Lingenfelter LC-001 I bought about 10 years ago, and it has factory-style coil pack harness connectors that connect right up the PCM-side and coil pack-side of the coil pack wiring. Works well, but I would certainly be interested in paying you something reasonable for your program, if it can replace my launch controller. Can you also retard the timing with your setup? Can you adjust the rate at which it kills the spark?

Thanks for the heads-up on the coil voltage... did you just end up doing some sort of 5v regulator? I'm not really seeing any regulator that can handle up to 100 volts input, let alone over 100.

Multiple relays can be fun. I've done some car projects with latched relays, latched and timered relays, etc. All the additional programming I've been doing with this Arduino has been fun too, as I've been learning. Recently learned to do some switch case programming based on states, and how to trigger multiple outputs to do different things simultaneously. Definitely a hell of a lot more to learn, but I'm only mainly interested in learning things that I want to apply. Once I get done with this project I think I'm going to try to use an Arduino with a Wi-Fi shield to remotely control the digital climate control in my car from my phone (I'll create an Android app), and from a web app. That way I can adjust the fan speed, temperature, turn the unit on/off, stuff like that. That'll be another learning curve for sure, but shouldn't be too bad

Do you have a way I can reach you directly? I'd be happy to shoot you some $ for your time and knowledge, and if you're willing to share your two-step program (if it has the capabilities to replace my LC-001) I would definitely like to discuss buying that from you, since you've put so much time and trial/error into it
Old 01-03-2018, 10:08 AM
  #14  
Restricted User
 
JoeNova's Avatar
 
Join Date: Mar 2014
Location: Ohio
Posts: 7,194
Received 107 Likes on 89 Posts
Default

It can't do timing retard. I pass the pink 12v power from the fuse panel going to the ignition coils through a normally closed relay controlled by the arduino, so the coils have power when the relay is off, and turning it on cuts their power. The arduino just pulses the relay at a certain duty cycle killing power to all of the coils. 70% duty cycle seems to do the trick.

The arduino does RPM readings, and the math to figure out how long each rotation takes. 60000/RPM = the milliseconds it takes to do 1 rotation.

I'm at work so I'm just going to wing a very basic code to give you an understanding(definitely not a useable code).

Code:
float dutycycle = 0.7;
int cycletime = 60000/RPM;
int relayon = dutycycle x cycletime;
int relayoff = cycletime - relayon;
int hardlimit = 3000;
int softlimit = 2800;

void Loop()
{
if (RPM > softlimit && RPM < hardlimit)
{
digitalWrite (coils,HIGH);
delay(relayon);
digitalWrite (coils,LOW);
delay(relayoff);
}
}
So lets say you have a 3000 RPM 2 step limiter.

-cycle time will be 60000/3000 = 20ms.
-relayon is the time the relay is turned on to cut coil power. 20ms x 0.7 = 14
-relay off is the remainder of the cycle (other 30%). 20ms - 14ms = 6ms.

It will turn the relay on for 14ms, and then off for 6ms, which will cut power to coils 70% of every revolution.
Old 01-03-2018, 11:52 AM
  #15  
Restricted User
 
JoeNova's Avatar
 
Join Date: Mar 2014
Location: Ohio
Posts: 7,194
Received 107 Likes on 89 Posts
Default

Originally Posted by gametech
Damn. I was irritated when I needed to use a 12v sensor on a 5v input and had to rig a simple voltage divider with a couple of resistors. You would need to smooth the hell out of 100v spikes to keep from frying an arduino input. Arduinos typically are not made to anything resembling "automotive" grade reliability. Hobbyists such as ourselves can get away with a lot, but there are limitations.
It wasn't so bad once I found help lol. A few guys pointed me in the right direction of what to buy. Was just a few small pieces that I basically have no idea what they do.
Old 01-03-2018, 07:17 PM
  #16  
TECH Senior Member
iTrader: (25)
 
truckdoug's Avatar
 
Join Date: Nov 2013
Location: Portlandia
Posts: 6,331
Received 526 Likes on 356 Posts

Default

i wish basic electronics was a highschool requirement
Old 01-10-2018, 09:46 PM
  #17  
On The Tree
Thread Starter
iTrader: (1)
 
MEAN GTO's Avatar
 
Join Date: Jul 2007
Location: Southern MD
Posts: 180
Likes: 0
Received 0 Likes on 0 Posts

Default

Thanks for the explanation on the launch controller Joe, I understand that that wasn't a usable code, but I follow how you're achieving it a little better.

I definitely take advantage of my launch controller's timing retard function to help the turbos spool before launch, so I may just keep that in place for now

Also, may I ask the reason you opted to get signal from the circuit going to an ignition coil, versus signal from the crank position sensor? Trying to keep things fairly simple and was thinking pulses divided by 24 would be a simple, low-voltage solution for me to read something that can be converted to RPM. Am I missing something on that? Thanks Joe!
Old 01-14-2018, 11:06 AM
  #18  
TECH Senior Member
iTrader: (25)
 
truckdoug's Avatar
 
Join Date: Nov 2013
Location: Portlandia
Posts: 6,331
Received 526 Likes on 356 Posts

Default

if i may be a butt-insky,

a 24-1 crank wheel doesn't get 24 pulses per crank rev. it's 720*/24 =one pulse per 30* crank rotation.

joes way is easier since all you need is the coil trigger signal times 2 for RPM.

it's just probably easier from a computer programming standpoint.


also i'm no mathemagician so if i'm wrong please call me out so i can learn the correct math for this
Old 01-14-2018, 04:58 PM
  #19  
On The Tree
Thread Starter
iTrader: (1)
 
MEAN GTO's Avatar
 
Join Date: Jul 2007
Location: Southern MD
Posts: 180
Likes: 0
Received 0 Likes on 0 Posts

Default

Hi Doug! I appreciate you butting in, for sure

So damn, I was better off going back to not thinking 24x meant 24 times per revolution when I started this thread lol. I've been trying to find how to take pulse from the circuit going to the coil pack of any one cylinder, and tamping it down to be no more than 5 volts, but the guys on the Arduino forum have me running around chasing after devices that don't seem to do what I need. I've gotten everything else worked out for my fail-safe, just can't seem to figure out where I'm going to read the pulses from, and how I'm going to safely read them.

So if you don't mind me asking a stupid questions-- does the "*" you put in your equation signify degrees? Thanks again Doug!
Old 01-14-2018, 05:39 PM
  #20  
TECH Senior Member
 
G Atsma's Avatar
 
Join Date: Jun 2016
Location: Central Cal.
Posts: 21,226
Received 3,153 Likes on 2,460 Posts
Default

I can speak for him on this- "*" does mean degrees here, because computers don't have the little bitty circle you put above and to the right of the numbers that normally means degrees.


Quick Reply: Read and convert RPM with Arduino... how do I interpret the RPM?



All times are GMT -5. The time now is 04:34 PM.