Need a Tach converter...
Jeff Redington
Posts: 10
In advance I want to say thank you, if you can help me with this...
I want to create a program, which I don't know how to do...
I have a pulse that varies from 0 to 7000 RPM coming from a· tachometer...
The pulses at 800 RPM are on for 5ms and then off for 20ms.
I want to read this with the Stamp and send out another pulse that is scaled...· the convertion needs to be·thus:
For every 3 pulses I need 2·· · "3 to 2"
- I had thought maybe counting the high and low pulse, so every three pulses, I would get 6 counts... then send that to a second counter... and every three counts it would send out a· pulse.· But this does not really measure the frequency and will be differently spaced at the RPM's of the motor goes up and down.
So I am hoping for, Frequency in, measured, scaled, then correct pulses out.
Thanks again,
Jeff R.
I want to create a program, which I don't know how to do...
I have a pulse that varies from 0 to 7000 RPM coming from a· tachometer...
The pulses at 800 RPM are on for 5ms and then off for 20ms.
I want to read this with the Stamp and send out another pulse that is scaled...· the convertion needs to be·thus:
For every 3 pulses I need 2·· · "3 to 2"
- I had thought maybe counting the high and low pulse, so every three pulses, I would get 6 counts... then send that to a second counter... and every three counts it would send out a· pulse.· But this does not really measure the frequency and will be differently spaced at the RPM's of the motor goes up and down.
So I am hoping for, Frequency in, measured, scaled, then correct pulses out.
Thanks again,
Jeff R.
Comments
http://www.discovercircuits.com/DJ-Circuits/divider1.htm
If your basic equation is correct, then the actual formula is quite simple:
result = variable * 2 / 3
which merely adjusts the formula to work with whole numbers, since the Stamp will only work with whole integers and not with fractionals.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
How can I get this to put out all the time, and still do the measurements in the background, without interupting the pulse flow. Is it possible to do this with some more direct control, (if this then that) and get the math to work it out. Without using these little programs, which have to be waited upon??? See program below:
' {$STAMP BS2}
' {$PBASIC 2.5}
readfreq VAR Word
freq VAR Word
adjfreq VAR Word
Setup:
HIGH 0 ' make P0 high
Main:
COUNT 7, 50,readfreq 'read freq over 50 ms
freq = readfreq * 20 'reading * 20 would be pps
adjfreq = freq * 2 / 3 'adjusted freq for pulses out
DEBUG HOME, DEC3 freq,CR
DEBUG DEC3 adjfreq
FREQOUT 0, 950, adjfreq
GOTO Main
I think that would work at low RPMs, but it will have trouble at high RPMs. If the output is 20ms off and 5 ms on at 800 RPM, that corresponds to a frequency of 40 Hertz, or 2400 pulses per minute, which means there are 3 pulses per revolution (=2400/800). All the above code is going to take around 5 milliseconds to execute on a standard BS2, so it is going to stop working somewhere around and above 800 RPM. You could use a faster Stamp, but that would not get it up to 7000 RPM. There would be no problem though if you implement it in SX/B on an SX chip, or in assembly on an SX or PIC.
I recently had a similar problem, to make a piece of equipment think its input was coming from one brand of anemometer when it was really coming from a different one, a spoof, involving a real time scaled frequency translation. The ratio was not simple like 2:3, but 134/213. That kind of translation takes an numerical accumulator, using logic which can handle any ratio:
N = N + 41229 ' word variable, output pulse whenever there is a carry out. 41229 = 134*65536/213.
The propeller counter module is very suited to that kind of thing. For a ratio of 2:3 using that kind of logic, you would do,
N = N + 43691 ' pulse out on carry from word accumulator, ratio 2:3.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Thanks,
·Yes, I need to work at higher speeds,·if I get the propeller kit, what would that program above look like for it???· Would it be similar, enough that I can understand it?
See attached chart...· I should be clear here... it must be a 3:2 conversion...
I just ordered the Propeller... kit...
Can you tell me where to get the SPIN programming software, seems to be hidden somewhere, will it come with the kit I just bought, it seems from what I read it will be similar to Pbasic... and will be programmable that way.·· With the eight processors, seems that I can measure the freq. and do the conversion, one processor handling the input freq., another handling the output freq. and the rest all going for it on the conversion and handling the math...·and so forth...
I had the development kit already for the Basic, so I just got the BS2, seems I should have listened to my "gut" and ordered this Propeller to start with.
Am I stupid or what?· But this Propeller seems to be something else, like out of this world tech., to have 8 processors in it.· Seems I could use it to control a whole machine, do stepper control, and write letters with an ink pin, and still have processors left over to pour the coffee.
Should have the kit by Monday, and hope again for a· little help.· Got to get this going,· have already got the "low down" on the input and out 3.3 to 5volt conversion issues, should be able to handle that end, the programming I am not to scared of, with a little help from my friends... thanks.
Post Edited (Jeff Redington) : 5/18/2007 7:38:49 PM GMT
See the one to one correspondence with the Basic? The Spin operator <# is like the Pbasic operator max, and in this case it causes the expression in (N <# 1) to equal 1 when N is either 1 or 2, and 0 only when N is zero.
The code assumes too that the input signal is absolutely clean and does not need debouncing. Also, makes short pulses on the output pin, a1, but I see you want specific widths in mind to track RPMs. That would require some extra doing.
Propeller Spin is, like Pbasic, a tokenized code and takes quite a speed hit compared to machine code. But on the Propeller, it is easy to throw one cog at generating the tachometer frequency conversion, and if it turns out not to be fast enough to keep up with your RPMs in Spin, there is the option to do it in assembly at blinding speeds, not much more complicated. You can find plenty of help in the Propeller forum.
edited parentheses for order of precedence.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Post Edited (Tracy Allen) : 5/19/2007 4:52:27 PM GMT
Here though is another approach using PBASIC on the Stamp, that outputs 2 pulses for every three at the input. It might even be fast enough to do up to near 7000 RPM. This program has an advantage that the output pulse duration is 1.5 times the input pulse duration as in your chart. The pulses are staggered, so it repeats (rest, tick, tick) at the output, like this:
...00001000010000100001000010000100001000010000100001... input
...000000000010000100000000000000100001000000000100001.... output
I don't know which timing parameters are important for you application. On the Prop, you have a lot of flexibility, taking advantage of the built in system counter and one or more of the 16 peripheral counter modules.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Post Edited (Tracy Allen) : 5/21/2007 12:22:25 AM GMT
Was wondering whether a micro-controller was necessary?
Attached is a schematic for a two IC solution --·yields two out
for every three in.·
The Frequnecy has to be at CMOS levels and·input conditioning etc.
not included.
Update --
Drat, I messed up.· So, don't use this circuit, because it lets "2" through when Freq is Low.· Woe is me for I am undone.· Most humbling.
A corrected circuit is provided a few posts down.
Post Edited (PJ Allen) : 5/26/2007 1:42:51 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
The system sending this tach information is a 6 cylinder engine distributer.· Thus the Distributer is the sender, which sends·its·pulses based on the RPM of the engine, the PW will change as the Engine runs higher RPM's, what does not change, is the percentage of the Pulse on and Pulse off,· that is what I am trying to explain in my chart.· 100% would equal the leading edge of the pulse, then the next leading edge of a pulse, the higher the RPM the less this becomes.·
What does not change is the division of the 100%, the PW will be 20% of that total time, and the remainder will be the delay, till the next pulse.· So when looking at the chart, if the PW is 5ms on the signal, the delay till the next pulse is 20ms, this is at 800 RPM.
I believe some of what is described above will not work, because the 20% pulse and the 80% Delay is not considered.· This will always be changing, and possibly could need to be a part of the equation?
Does this make since or have I lost you?
I didn't analyse it super carefully, but my hunch is that the delay in CASE 1 would make it naturally miss the third input pulse. For example, after a 5 millisecond DW pulse, in CASE 1, it would delay 12.5 milliseconds before starting the output pulse, plus the 7.5 millisecond pulse, puts it too late to detect the input pulse that occurs at the 20 millisecond point. I don't know how high the Stamp could go in frequency with this, but it would be dicey due the the interpreter overhead.
Similar logic would have no problem on the Propeller, where it could be synced to the system clock and more than one thing can happen at once.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
I have bought the Propeller, it should be here tomorrow.·
I am putting a new post over on the Propeller Forum Section, so will see what they come up with there.· After all this, I think I can explain what I want better.
I really want to measure the Freq. In, Convert, and Freq. Out.· This will need to be able to read down to .5ms (500us) when operating at 7000 RPM.
See my new post over on the Prepeller Forum.....
I do believe that the code above stated for the Propeller, by Tracy Allen, may work.· And I may use this.
However, the Propeller if it works as advertised, should be able to do multiple task all at once, and that with different cogs, thus not influencing the outcome of the other cogs as far as timing.
Thanks you,
- Jeff Redington
For shame!
Well, I've attached a Revised schematic, still uses only two ICs (the 3 NANDs are part of a "Quad" pkg.)
Karnaugh map:
···· f··/f
·2·· 0·· 0
/2·· 1·· 0
Post Edited (PJ Allen) : 5/21/2007 11:55:11 PM GMT
http://forums.parallax.com/showthread.php?p=651534
As this is the Basic Stamp Section.
I am not really interested in non-processor control, as I have learned several years ago that if you need more than 1 timer and 2 relays, you are better off with a processor,·then all you do is the programming.· The interface is much better, and the design time is less.
Thanks,
Jeff Redington
http://www.dakotadigital.com:80/index.cfm/page/ptype=product/product_id=127/category_id=287/home_id=59/mode=prod/prd127.htm
The system sending this tach information is a 6 cylinder engine distributer. Thus the Distributer is the sender, which sends its pulses based on the RPM of the engine, the PW will change as the Engine runs higher RPM's, what does not change, is the percentage of the Pulse on and Pulse off, that is what I am trying to explain in my chart. 100% would equal the leading edge of the pulse, then the next leading edge of a pulse, the higher the RPM the less this becomes.
What does not change is the division of the 100%, the PW will be 20% of that total time, and the remainder will be the delay, till the next pulse. So when looking at the chart, if the PW is 5ms on the signal, the delay till the next pulse is 20ms, this is at 800 RPM.
I believe some of what is described above will not work, because the 20% pulse and the 80% Delay is not considered. This will always be changing, and possibly could need to be a part of the equation?
Typically a 50% duty cycle is all a tach needs. The frequency is what sets the output.
Since the frequency can be calculated using an interrupt (on a tiny13 for example) from rising edge to rising edge it is a simple matter to measure the length of time of a single pulse, divide by 1/2 and add that time to the original.
I would setup an interrupt to detect rising edges.
Start a timer on the first rising edge
stop the timer on the second rising edge.
calculate the time
stuff a second timer with the time. The second timer outputs the frequency set in its compare registers.
The main program would simply loop and the hardware timers and interrupt code would take care of everything.
If you like, I could whip one up and send you one, the chip is only $1.25
You would need 5V dc though so an additional regulator should be used as well as a small capacitor for the chip and capacitors for the regulator.
I have a frequency doubler design for some older model tach outputs to use the newer tach guages. It simply doubles the frequency. I also have a voltage doubler for 6V cars that want to use the newer 12V tach guages.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think Inside the box first and if that doesn't work..
Re-arrange what's inside the box then...
Think outside the BOX!