Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Simple RPM Switch

Status
Not open for further replies.
Mike, you are the man!!! I'll have to play around with it tomorrow to see if I can get it to work. How did you connect the input to the Junebug? Did you use any capacitors or resistors? Which pin? Thanks again!!!!!!!
 
You can vary the variable RPM to fit your requirements but it can't be less than 240 without modifying the code. It will also need modifying if you use a faster clock speed than 8MHz.

Have fun.

Mike.
Mike, the other way to do it with out fancier tricks is to run the CPU off of a watch crystal. Well maybe not that low but, throttle down the operating frequency to make the low end input.

Dan
 
Unfortunately, I don't have an engine available to test it with and so I used a signal generator connected to PortB,0 which is pin 8.

Mike.
 
Unfortunately, I don't have an engine available to test it with and so I used a signal generator connected to PortB,0 which is pin 8.

Mike.
It is pretty straight forward actually. If you run your code on a 4MHz crystal it will report twice the speed since the timebase is now half the frequency.

Even with a motor you could not do it since you do not know the ratio of RPM to frequency of his and it could be anything. It is, however, likely to be somewhere around 10 RPM/Hz though.

Dan
 
Ubergeek,

Unfortunately, I missed your earlier post and was replying to the OP.

However, I made a few assumptions in my code,
The OP would want to use a reasonable instruction time as he has a lot of other stuff to do.
And, that I would get 1 pulse per rev. I.E 60 RPM/Hz.

My concern was that should the OP use a higher clock speed then the variable previous would no longer fit in the 16 bits it was allocated.

Mike.
 
I was thinking about which wire an after-market tachometer or electronic device connects to to get an rpm signal from the car. I realized it's not the crankshaft position sensor like I originally thought. That wire is shielded and it would probably be foolish to mess with it, since it's very important that the ECU gets an unmodified signal from the crank sensor. Most after-market devices actually connect to the signal wire that goes to the ignition system to control ignition timing. Since it is a single coil system, it's going to send 4 pulses per revolution (1 for each cylinder). Another way I could connect is to splice into an injector wire since that would be only 1 pulse per Rev., but the problem with that is that the car I want to test my first prototype on is a TBI system, meaning only 2 injectors instead of 4, and I have no clue how many times those get fired per rev. The car I plan on fully installing this on is Multi Point Fuel Injection, so it does have 4 injectors. The Ignition wire, however, is the same on both, so i think it would be the best one to use.

I'm curious to see what will have to be changed (besides mulitplying the activation rpm by 4) to make this work properly. Thanks guys!
 
Once you work out which signal you are going to use it will be fairly easy to modify software to fit the new situation. That is the beauty of microcontrollers, you can make the software work with almost any hardware.

Mike.
 
Ubergeek,

Unfortunately, I missed your earlier post and was replying to the OP.

However, I made a few assumptions in my code,
The OP would want to use a reasonable instruction time as he has a lot of other stuff to do.
And, that I would get 1 pulse per rev. I.E 60 RPM/Hz.

My concern was that should the OP use a higher clock speed then the variable previous would no longer fit in the 16 bits it was allocated.

Mike.
Pommie,

I might have misunderstood it myself as I was under the impression that there was not that much else to do.

Even so I would have recommended using a capture register to do the bulk of the work anyhow. It can go either way that way since longer times can be based on the sum of the capture and the number of overflows that would easily fit in an 8 bit.

Dan
 
I finally had the chance to do a little research and found the information I wanted. The tachometer signal wire, which is the same on several Honda's (including both cars I want to put this on), receives from the distributor a pulse rate of 200 pluses per minute for each 100 rpm of the engine! So, if I'm aiming for 350rpm, it would be 700 pulses per minute, right? Not entirely sure which part of the code to change for this. And I still wonder if I'll need some kind of resistor between the pic and this signal wire?
 
You would just change the line,
Const RPM=360
to
Const RPM=700

As for connecting it up, I would start with a 10k resistor in the signal line and a 0.01uF capacitor from the pic pin to ground. Do you have a scope to look at the signal?

@Ubergeek,
Using the capture facility would make a lot of sense especially with the capture every 4 pulses. If the OP has problems then that would be a sensible way to modify the code. As for the other requirements, see the OP's other thread however, looking at it now it could probably be done with a slower clock.

Mike.
 
Ideally you want to see a 0-5V signal. You will probably see a 1 to 5V (maybe 5.7V) signal. If the signal doesn't swing enough then reduce the capacitance. If it has noise then increase it.

Mike.
 
Connected the Lab Scope today, it pulses from 0 to 100 mV, roughly. The higher the rpm, the more frequent the pulse, but it never really exceeded 130 mV that I saw. I didn't count the pulses, but Honda says 200 pulses per minute per 100 rpm.
 
Last edited:
since it's not swinging from 0-5v, should I just use that signal to drive a transistor to switch the pic pin to ground? Would a transistor be fast enough for that?
 
I dont know of any resistor. The distributor has an "ignitor" inside that controls ignition timing and advance. That Ignitor has an output specifically for the tachometer and cruise control, and this is the wire I want to use. If there are any resistors, they are inside the ignitor, which is not serviceable.
 
Last edited:
There is something not right here. Nothing works with a 100mV signal and so I suspect something else is wrong. When you look at the original signal do you have the existing tachometer connected? I ask as the sensor could be a simple (transistor) switch to ground that requires a pullup in order to work.

To answer your question, no, a transistor will not be switched on by 100mV. It needs several times that voltage.

Mike.
 
Last edited:
yes, the original tachometer was connected. I'm going to do a little more research on this signal wire, as I know I have used it in the past for an aftermarket tachometer, and remote start RPM input once as well. Perhaps I was doing something incorrectly with the scope?
 
Last edited:
You have my curiousity now. What are you doing that needs to know when your engine is at 350 rpm?
And why not just use the AC comming from the alternator for a reference source? Just tap one of the windings before the rectifiers. you will have plenty of voltage to work with.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top