11 years, 2 months ago.

Detect a Square Wave Signal and check rpm

Hello

I want to detect the Wheelspeed of a Kart. I already got a Triggerwheel on one wheel, which gives me information about the wheelspeed. No i want to make a programm, that gives me the Wheelspeed on my display. but i dont have any idea how to realize it. is it necessary to work with interrupts? or is there a simple way to get my signal?

regards!

3 Answers

11 years, 2 months ago.

Hi,

There are a few ways you could do this. How many edges are you expecting per second? If it is no too many (maybe <1000) then you could do it in software as shown here, but if it is more then you need to use the hardware on the mbed as explained here

Either way if you were to set up a ticker to ready the encoder count at a regular interval and then took the difference between reading then you could work out velocity. In fact I think the M3 has a built in velocity register if you were to use the hardware implementation.

Martin

Accepted Answer
11 years, 2 months ago.

Hello Martin!

thx for the answer!

In worst case, i have to expect about 20kHz at my mbed controller. is this possible?

regards!

11 years, 2 months ago.

I wrote an interrupt-driven timer-reading program,
where the timer was started at any time,
a buffer filled with the microseconds read from the timer,
then doing some math to calculate specifics from the pulse-duration.
You could go similar ways.

Lerche