Discussion in "Project Help" started by    TB    Aug 9, 2008.
Sat Aug 09 2008, 05:14 PM
I'm using a DS89C450

I need to monitor a +7V input with variable frequency - is it possible to sample the frequency on a 8051 without additional hardware?

I need this to log revolutions of an engine. Output is as said +7V, when the engine is idling output is 26Hz (approx. 750rpm). So basically I need to translate the frequency of the input to a given value. Is it possible?

EDIT: Can I use the external interrrupt and a counter to solve this? eg a timer that resets a counter every one second, and then the external interrupt incrementing the counter? So the value of the counter equals the frequency when reset?

[ Edited Sat Aug 09 2008, 05:17 PM ]
Tags frequency conversionvariable frequencyrevolutionstimer
Sat Aug 09 2008, 05:33 PM
hi TB,
u would need only two timers for the task. use the first timer as a counter and connect the input to the corresponding counter input pin( e.g. if u are using timer0 as the counter , connect the input to the T0 pin of the uC. The second timer can be used to create the fixed time interval and just read the counter value when the timer overflows (i,e when the second timer interrupt occurs.
As for the +7V, better check the datasheet of the uC whether this level ( which is greater than the usual +5V level) can be safely used as the input directly to the uC . Else, u can always use a voltage divider/5.1V zener to reduce the level to required +5V level.

P.S. using the internal counter doesnot interrupt ur program flow so it is recommended. Ur idea of using external iterrupt also holds good but would affect other tasks of ur uC , as ur frequency of input increases generating an interrupt on every input transition which might reduce the efficiency/timing of ur other coding.

[ Edited Sat Aug 09 2008, 05:38 PM ]
Tags voltage dividertwo timersfirst timertime intervalinput pin
Sat Aug 09 2008, 06:03 PM
Ahh good point on the external interrupt - just didn't think that thought to an end
There is absolutely no need to run an interrupt handler every single time.

I'l look at that diode - I guess it's better than using a resistor?
Tags resistordiode
Sat Aug 09 2008, 07:16 PM
definitely TB, a zener is always preferred to a simple voltage divider because it would clamp the input to a max. voltage to 5V even if ur signal voltage accidentally rises a few volts above above 7V during measurement.
Tags simple voltage dividersignal voltagemax voltagezenervolts
Sun Aug 10 2008, 03:31 AM

Hi TB,

As our friend pdi33 has put it rightly, you are basically building a freq.counter/meter.

i would suggest to go with 1 sec sampling period, which gives accuracy of 1 Hz.

also what is the max freq./rpm of the engine ?

you can also use a normal NPN transistor like BC547 for connecting the input voltage,
feed the +7V to the base of transitor via a suitable value resistor (4k7/10k) and the collector is connected to the micro's pin( with a pullup) and emitter to Gnd

one more thing ( i think you already know this), you have to common the Gnd of the Micro circuit with the Gnd of engine circuit

all the best !

Arun
Tags npn transistorsampling periodbc547micro circuitsuitable value
Sun Aug 10 2008, 11:24 AM
If it's an inductive pickup being used to derive the rpm pulses,a Schmitt trigger before the micro would be helpful,else there could be lots of false triggers for the counter.

Tb,what are you using for the input signal .. magnet-coil,Hall effect sensor,...?
pdi33 like this.
Tags magnet coilinductive pickuphall effect sensorschmitt triggerinput signal
Sun Aug 10 2008, 02:04 PM

Hi TB,

are a attempting a tachometer, to know the RPM of engine ?

Arun
Tags tachometerrpmtb
Sun Aug 10 2008, 05:53 PM
@ TB,
as shashi bhai so rightly pointed out ( a very critical point in RPM measurement which i forgot to mention),a schmitt trigger would be highly useful especially when ur signal is not purely digital.
Tags schmitt triggerbhaicritical pointrpmmeasurement
Sat Jan 17 2009, 05:24 AM
I'm working on a tachometer- and what occurs to me is that there are two ways to do a tach with a high speed mcu:
1. Count the pulses from the engine (I assume an ignition engine since this is what my tach is for...) over some known time period. Then you'd multiply this number by some constant to get the rpm (or Hz)
2. Use the engine ignition pulses as defining the time period, then count the 5mHz (F_osc = 20mHz)counter pulses in this time period. Divide F_osc by this number, multiply by 60 to get rpm. It may seem like a lot of math, but using integer and binary division by just shifting things right to divide, left to multiply, I think it's do-able... The good thing is the much faster response time- you don't have to wait a second or so to get a result , and it's a hell of a lot more accurate, even with all the integer math... What do you guys think?

The second thing I was wondering is the best way, with a pic to get the enging pulses in. I'm planning on using an inductive input, a wire wrapped around the spark plug wire, the other end to engine ground, thru some small coax, and this will be fed into the PICs ECCP input, after conditioning by some means...

For this conditioning, I was thinking about first checking the signal with a scope, to find its peak, then put the signal thru some resistor, and maybe a small capacitor to keep the spike within the limits able to be handled by the PIC. Of couirse, a little hysterisis network would also make the PIC read the signel more reliably. Any thoughts as to how this wopuld work?

### Information

Powered by e107 Forum System

#### Conversation

Wed Apr 15 2015, 05:07 PM
@Bibek.. and everyone. Create threads if you need help. The chat box is just for chat
Wed Apr 15 2015, 05:06 PM
@mohd atif ..login..create a post/thread,then I can post a copy of the missing file
Mon Apr 13 2015, 07:03 PM
mohd atif
@experimenteruk I didn't get you
Sun Apr 12 2015, 04:18 AM
Bibek
hello, i have made a digital clock using rtc DS12887 and AT89S52 with date n callender. Now i want to add alarm features to it.....can any body help me with the code in assembly language
Sun Apr 12 2015, 03:22 AM
SANJU123
Hello, I am planning to do simulaton of the ' 4-way traffic controller'. As a first stage of the project, I tried to compile the code given in this website in keil microvision which controls 4-way traffic . I am using AT89C51. But when I am trying to compile the code it shows an error " Device is not supported by Toolchain". Can u please help me...
Sat Apr 11 2015, 02:06 AM
Suryamoy Mondal
There is a little bit confusion to connect the rs232 connector to max232 ..By continuty test i cant able to find , which wire from the other side of the RS232 connector , i connect to max232..is there any colour coding?
Fri Apr 10 2015, 06:19 PM
@Suryamoy, The PC control software is provided within the package. Follow the steps to install and test it.
Fri Apr 10 2015, 05:24 PM
Suryamoy Mondal
my final year btech project is pc remote control..i have made the hardware and microcontroller prograaming from yours project..bt i cant able to implement in PC..so wht kind of software need for pc to access this..please sir reply me ..i need your help
Wed Apr 08 2015, 04:46 PM
@mohd atif If you create a thread, I may be able help
Tue Apr 07 2015, 03:59 PM
mohd atif
i am working on a project evm. i download the evm project from this site named Electronic Voting machine with Managed Control Unit . i face problem in this when i am trying to simulate this on proteus . there is an error " could not open MODDATA initializer file mem.bin" please help me to get out this problem

### Recent

#### Comments

lumines
Sat Apr 18 2015, 11:30 PM
[email protected]
Sat Apr 18 2015, 05:02 PM
arvindarunoday
Sat Apr 18 2015, 04:26 PM
samarhbk
Sat Apr 18 2015, 12:57 PM
chitty789
Tue Apr 14 2015, 06:14 PM
yaseenshaikh
Tue Apr 14 2015, 03:41 PM
sanju123
Mon Apr 13 2015, 03:51 PM
mohanadelnokaly
Wed Apr 08 2015, 07:02 PM

#### Online

Guests: 35, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 37626
Newest member: lumines
Forum Activity
##### Posted By ajay_bhargav
Sun Apr 19 2015, 06:50 PM
Please zip and attach the code in future. You forg...
##### Posted By ajay_bhargav
Sun Apr 19 2015, 06:48 PM
It is really hard to say which course and/or insti...
##### Posted By sanju123
Sun Apr 19 2015, 04:56 AM
Thanks rickey...I have reinstalled version.. Pro...
##### Posted By lumines
Sun Apr 19 2015, 12:19 AM
Dear everyone,We are currently looking for an embe...
##### Posted By [email protected] /* <![CDATA[ */!function(){try{var t="currentScript"in document?document.currentScript:function(){for(var t=document.getElementsByTagName("script"),e=t.length;e--;)if(t[e].getAttribute("cf-hash"))return t[e]}();if(t&&t.previousSibling){var e,r,n,i,c=t.previousSibling,a=c.getAttribute("data-cfemail");if(a){for(e="",r=parseInt(a.substr(0,2),16),n=2;a.length-n;n+=2)i=parseInt(a.substr(n,2),16)^r,e+=String.fromCharCode(i);e=document.createTextNode(e),c.parentNode.replaceChild(e,c)}}}catch(u){}}();/* ]]> */
Sat Apr 18 2015, 05:07 PM
I want this code to be programmed in arduino uno b...
##### Posted By gaurav7577
Fri Apr 17 2015, 03:26 PM
thanks ajay for ur concern .....passed out B.E.......
##### Posted By ajay_bhargav
Fri Apr 17 2015, 12:49 PM
can you post screenshot or a picture of CRO output...
##### Posted By ajay_bhargav
Fri Apr 17 2015, 12:45 PM
are you in a college or working?
##### Posted By ajay_bhargav
Fri Apr 17 2015, 12:44 PM
GSM modem needs a power supply with minimum 2A pea...
##### Posted By ajay_bhargav
Fri Apr 17 2015, 12:41 PM
check it on CRO with 10x probes, you will see a si...