Page 1 of 1

rev counter

Posted: Sun Jul 21, 2013 10:21 am
by siliconchip
hi all is it possible to build a rev counter using a pic and lcd as a display, has anyone attempted this in the past, I would appreciate some advice and be pointed in the right direction to attempt this,

Re: rev counter

Posted: Sun Jul 21, 2013 10:37 am
by kersing
Have you tried to search the forums? There are several messages concerning this subject. Search for 'rev counter' or 'rpm'...

Re: rev counter

Posted: Sun Jul 21, 2013 11:07 am
by brandonb
input the amount of teeth on tone wheel at the top

Code: Select all

//------------------------------------------------------------------
// #define crank 120
// #define cam   60
tonewheel = 1 //number of teeth on tone wheel
then type in if its cam or crank driven here

Code: Select all

count = (100000 / count) * crank //tachometer calculation
cam is a constant =60
crank is a constant=120
it works by measuring the amount of time in 10u/s increments for a rotation

Re: rev counter

Posted: Sun Jul 21, 2013 11:29 am
by siliconchip
hi forgot to point out that the rev counter would be for a 50cc 2 stroke

Re: rev counter

Posted: Sun Jul 21, 2013 12:26 pm
by brandonb
i rigged it up for lcd, the digits change for the position as it should be, *** i had to add variable rpm and its a float to increase resolution as it should
it doesn't matter as a two stroke because the crank is still gonna be whats measured, inthis case your gonna get a firing for each cylinder every crank rotation instead of cam rotation
is your rpm higher than 10,000? and how many pulses? how are you implimenting the circuitry?

Re: rev counter

Posted: Sun Jul 21, 2013 12:56 pm
by brandonb
i was playing around with accuracy and wanted to add this one so you can play with this in the simi or on hardware with your signal generator, in this flowchart its currently set up for 8 pulse crank wheel,
on the bottom line it shows the counts of the tmr for one rotation of (cam or crank) which ever you selected
the math---> rpm = (100,000 / number it shows)*120 for crank or 60 for cam
you'll see that the resolution and update speed is very good! keep in mind that it does hog up the processing power with the 100k interrupt
TACHOMETER with counts.fcf
(24.79 KiB) Downloaded 508 times

Re: rev counter

Posted: Sun Jul 21, 2013 3:36 pm
by siliconchip
hi the red line is 10500 rpm, not sure how to implement it yet was thinking of trying to attatch some thing to the HT lead to trigger the circuit rather like when you connect a strobe light to check your timing

Re: rev counter

Posted: Sun Jul 21, 2013 4:25 pm
by brandonb
thinking of trying to attatch some thing to the HT lead to trigger the circuit rather like when you connect a strobe light to check your timing
no don't do that, i created a neat injector stobe light thingy about 5years ago with a ignition timing light http://www.youtube.com/watch?v=8JxgWZWyLyQ but the point is it takes minimum 66volts kickback to get the timing light to flash!!!, i would imagine this would kill the pic directly, i would try using a npn darlington transistor hooked to a pnp transistor to safely do it.... darlington will trigger off of ignition wire and pnp will flip the signal, on the pnp base you will need a 1K pull down to get a square wave coming out of it

Re: rev counter

Posted: Sun Jul 21, 2013 7:18 pm
by siliconchip
do you mean the single ignition wire on the primary side of the ignition coil that comes from the CDI module

Re: rev counter

Posted: Sun Jul 21, 2013 7:31 pm
by brandonb
do you mean the single ignition wire on the primary side of the ignition coil that comes from the CDI module
i thought you men't secondary, does it have electronic ignition or points, the way i designed the rpm deal is that it hooks to a hall effect sensor or can make a circuit to hook to a variable reluctance sensor, i'm sure there is someway to make it work

Re: rev counter

Posted: Mon Jul 22, 2013 11:47 am
by siliconchip
hi I have electronic ignition with one wire coming from this to the primary side of the ignition coil , one idea I have is to use some sort of PIR sensor monitoring the flywheel ? if I put a reflective marker on the flywheel at say a point when the piston is top dead center this could count the revolutions but its from here im at a standstill as to get this to some sort of code in the pic :oops:

Re: rev counter

Posted: Mon Jul 22, 2013 4:27 pm
by brandonb
if I put a reflective marker on the flywheel at say a point when the piston is top dead center this could count the revolutions but its from here im at a standstill as to get this to some sort of code in the pic
no worries, the code that i posted for second flowchart can do any combo of trigger for a engine, you tell it "cam" or "crank" then tell it how many pulses you have on your tonewheel, in this case how many peices of tape and it does the rest because it works on counting the time it takes in 10u/s increments to pass the number you selected for teeth plus 1.... check it out here is the full version that you can set all parameters on http://www.youtube.com/watch?v=BAEJS0CZ5IE

Re: rev counter

Posted: Mon Jul 22, 2013 5:06 pm
by siliconchip
thanks brandonb much appreciated I now have something to go on many thanks

Re: rev counter

Posted: Mon Jul 22, 2013 6:43 pm
by medelec35
I just had a thought:

Can a single wire be wrapped around the HT lead.
This wire can then go to an i/p of Microcontroller.
You may need to experiment with a high value pulldown resistor, and you may even require a 5V zener between the ADCi/p and GND for addition protection as I do not know what the voltage will be induced, but it use to be done this way with transistors years ago.

Not sure it it will work or not its only theory.

Re: rev counter

Posted: Mon Jul 22, 2013 7:39 pm
by siliconchip
hi martin on that note do you see a possible problem with PIR sensors near the fly wheel, the biggest problem I could see with this is heat on the PIRs as it does get very hot in this area, any input would be appreciated

Re: rev counter

Posted: Mon Jul 22, 2013 7:52 pm
by kersing
PIR as in passive infra red detector? Those work by detecting temperature changes, so reflective tape will not be detected. Also most sensors divide their view window into some sort of grid and require at least two cells next to each other to have a difference to prevent false triggers.
Using a led and a photo detector might be better. (check http://stab-iitb.org/wiki/Contactless_Tachometer for an example circuit)

Re: rev counter

Posted: Mon Jul 22, 2013 8:23 pm
by medelec35
I would agree with kersing,
I don't believe PIR is way to go.

Either what I said or LED transmitter and receiver all in one like this:
http://uk.rs-online.com/web/p/photoelec ... s/6165709/
Or hall effect transistor and magnet.
You can get stick on flat magnets not much different than sticking on tape.

Martin

Re: rev counter

Posted: Mon Jul 22, 2013 9:28 pm
by medelec35
Hi I have been asked to post this on behalf of Steve001 since he can't post in V5 section:
Steve001 wrote:Hi Martin,

Could you please post this for me ?

http://www.kasensors.co.uk/

They make all sorts of sensors for motorsports they list a high speed hall effect crank sensor
Don't know of the price range though

Steve

Re: rev counter

Posted: Fri Jul 26, 2013 10:40 am
by siliconchip
after looking at the ignition system on the bike I have a sensor behind the flywheel which when the magnet passes over it induces a voltage that is then used to trigger the cdi (capacitor discharge ignition) any thoughts whether this signal could be used to trigger the second flow chart from brandonb on this thread ????

Re: rev counter

Posted: Fri Jul 26, 2013 11:58 am
by dazz
Hi Silicon chip
What bike is it??
different bikes use different types of sensing depending on age

Regards
Dazz

Re: rev counter

Posted: Fri Jul 26, 2013 12:27 pm
by siliconchip
the bike is a Honda MT50 from 1986 vintage

Re: rev counter

Posted: Fri Jul 26, 2013 2:26 pm
by dazz
HI
Changed post as i was thinking of an earlier model, blue/yellow should be your pick up wire so try measuring the outputs with a multimeter,(high voltage ac first, don't disconnect pulse coil put meter lead into connector block, check voltage as you kick it over , if low voltage try checking whether its ac or dc, i would probably use an opto isolator and use that as a trigger to a rev counter, )as i think yours is the self generating CDI system , i used to have all the test data for bike pickups but i can't find any of it grrrrr
Regards
Dazz