Cortina74
Posts: 3
Joined: Sun Jul 27, 2014 2:46 pm

Pulse counting / outputing

Sun Jul 27, 2014 2:58 pm

Hi guys,

I'm completely new to all of this Raspberry Pie business. I've done a little C++ programming previously and I now wish to under take a project. I'm looking at using a Raspberry Pie to read a square wave pulse signal produced from a Hall Effect sensor. I would like to increase or decrease the frequency of the sampled wave form by a few percent and output it with little delay.

Before I start... Do you guys think that this is possible.

Thanks for your help :)

Duane Degn
Posts: 55
Joined: Thu Jul 10, 2014 6:30 am
Location: Idaho, USA

Re: Pulse counting / outputing

Sun Jul 27, 2014 5:17 pm

Cortina74 wrote:Before I start... Do you guys think that this is possible.
It will depend on the frequency. I don't know enough about the Pi to answer your question other than to say yes it is possible at low frequencies but to get a real answer you'll need to let us know what sort of frequency your hoping for.

Are you planning to program with C?

User avatar
joan
Posts: 14985
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Pulse counting / outputing

Sun Jul 27, 2014 5:26 pm

I'm curious as to why?

A Hall Sensor wouldn't normally produce a square wave (a wave of equal periods of on and off). It would normally provide a short pulse as it passes the magnet. So if you had a 100 pulses per minute the total pulse-time might be 1/10th of a second against 59.9 seconds of no pulse.

How much do you want to vary the frequency, how much of a delay, and how accurately?

Cortina74
Posts: 3
Joined: Sun Jul 27, 2014 2:46 pm

Re: Pulse counting / outputing

Sun Jul 27, 2014 7:45 pm

Hi thanks for your replies,
I'm looking at switching at around 500Htz maximum. I want to read an rpm sensor which is triggered by a wheel with equal cut outs in it. So I believe that it should produce a square wave with 50% on /off. The gearing (located after the sensor) will be changed slightly from time to time and I want to adjust the pulses to suite the changed output speed. I will calculate the percentage change in speed and hopefully use these calculations to change the frequency. I'm using this as a college project so I really want to do this without help, but before I dive in too deep I just wanted to make sure that it is possible to undertake. I would also like the user to be able to interact with the system and input the new gearing ratio to which the system would adjust the frequency to match. Does the Pie have the capability to allow the user to program new parameters. For example, fit a LCD screen and buttons with a built menu to interact with.

I plan to use C if possible as this is what I have used before. I would like the out put frequency to be accurate to the real RPM within 3%. The frequency would need to be changed at a maximum of 20% and the delay isn't as critical, it needs to be minimal but I'm not talking tiny figures . A Rpm display will show the speed in real time. As long as this keeps up to represent what's happening I'm happy
I hope that I have explained this OK..
Once again thanks for your help.

User avatar
joan
Posts: 14985
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Pulse counting / outputing

Sun Jul 27, 2014 8:05 pm

Can I just clarify.
  1. You have a square wave input, say IN, which may vary in Hz up to say 500 Hz.
  2. You want to generate a square wave output, say OUT, to track the square wave input. Such that OUT Hz = IN Hz * factor, where factor is a user input which may be dynamically entered.
If so that is perfectly feasible.

The devil is in the detail, e.g. how accurately do you want the output to track the input, how responsive to input rev changes etc.

Cortina74
Posts: 3
Joined: Sun Jul 27, 2014 2:46 pm

Re: Pulse counting / outputing

Sun Jul 27, 2014 8:33 pm

That's exactly correct. Glad to hear its possible, it may be a bit of a pain but at least its possible. Thanks for your help, Ill make a start!!

Duane Degn
Posts: 55
Joined: Thu Jul 10, 2014 6:30 am
Location: Idaho, USA

Re: Pulse counting / outputing

Sun Jul 27, 2014 10:11 pm

There are probably lots of inexpensive microcontrollers which could do what you want at 500Hz.

I think there are mainly two reasons one would want to use a Raspberry Pi for something like this. One reason would be you already know how to use the Raspberry Pi and it will save you time even though it's overkill for the project. The other reason I see for using a Raspberry Pi for this sort of project is you want to learn to use the Raspberry Pi either because you think you may have a project where it will really be needed or you just think the Pi is cool.

If these reasons don't apply to you, then you'd probably be better off with a microcontroller. My favorite microcontroller is the Propeller but again, the Propeller is overkill here and a $4 Arduino clone would probably do the job just fine.

rgrbic
Posts: 128
Joined: Thu Jun 12, 2014 1:07 pm
Contact: Website

Re: Pulse counting / outputing

Mon Jul 28, 2014 10:37 am

You can do it with lm331. Something like:
frequency to voltage ->multiplier ->voltage to frequency
At 127.0.0.1
Twitter: @rgrbic
IoT-projects.com

Return to “Automation, sensing and robotics”