looking for a simple frequency trip program using 08m2 ? help

3142ron

New Member
Many thanks for your responce; Re-posted the question but not sure how to do this in the Forum?

Hi,

Looking for simple program for a frequency trip using the 08m2 chip. i/p around 3 volts frequency range 0 - 3000 hz, trip setting example 1000 hz & 2000 hz.

Many thanks

##################################################

21/03/2016


At present I wish to make a simple ferquency trip, via a "magnetic pickup which gives 3 - 12 volts a.c. depending on the air gap" the project requires to sense around 0 - 500 r.p.m. & 2020 r.p.m as an example to disconnect the starter and then also shut down when overspeed reached.

I'M o.k. with the circuitry and can test using a square wave generator with i/p of say 3v as I have used 08m2 chips for many projects; it's just the simple programming I get stuck with for the correct instructions and read to P.C. Screen.

Hope this makes some sense.

Regards

Ron
 

3142ron

New Member
In simple terms, I've used the 08m2 chip on several projects, but am interested in using the same chip to measure r.p.m. of a diesel
engine, displaying r.p.m. on my P.C. and to switch 2 outputs at say 500 & 2020 r.p.m.

The r.p.m. settings are just an example. Really I am just after a basic program I can experiment with which looks at a switching High / low input / displaying this input as "Hz" or "R.P.M." on P.C. via the PICAXE PROGRAM / and within the program will give an output to drive LED; at say 500 r.p.m. & 2020 r.p.m. . I know the pickup is a.c. but can convert this.... and have a d.c. pulse generator to test.

Hope this makes senes

Thanks Ron
 

westaust55

Moderator
Another option is the COUNT command.
Counting the pulses for 1 sec will give you a direct rpm value (assuming 1 pulse per rev) from your Diesel engine.
If you use a shorter time period then multiple accordingly - i.e. For 1/2 second multiply by 2 or for 1/4 sec multiply by 4.

EDIT (26Mar2916):mad:
As per comment by Circuit at post 9,

And multiply the result by 60 to change from revs per second to revs per minute
 
Last edited:

3142ron

New Member
Another option is the COUNT command.
Counting the pulses for 1 sec will give you a direct rpm value (assuming 1 pulse per rev) from your Diesel engine.
If you use a shorter time period then multiple accordingly - i.e. For 1/2 second multiply by 2 or for 1/4 sec multiply by 4.
That's what i'm looking for. Thank you I will investigate this. Can you write a very basic program I could try??? I'm o.k. with copying and modifying programs but trying to figure out the text, I get stuck with. Thanks again
 

Circuit

Senior Member
Another option is the COUNT command.
Counting the pulses for 1 sec will give you a direct rpm value (assuming 1 pulse per rev) from your Diesel engine.
If you use a shorter time period then multiple accordingly - i.e. For 1/2 second multiply by 2 or for 1/4 sec multiply by 4.
RPM = Revolutions Per MINUTE, NOT Revolutions per SECOND. I think you are a factor of x60 out here.
 

SAborn

Senior Member
You can try this code, its untested and just a quick throw together to get you started.
It should give you RPM on the screen every 1/2 second (500mS)

Code:
#picaxe 08m2

Symbol RPM =    w2

Symbol Pulses = w0


main:


count C.3, 500, Pulses

RPM = Pulses * 120

'%%%%%%%%%%%%%%%%%%%%%%%%%%%

if RPM =< 2020 then
high C.2
endif

if RPM > 2020 then
low C.2
endif

if RPM =< 500 and RPM > 2020 then
high C.1
endif

if RPM > 500 then
low C.1
endif

'%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Sertxd ("RPM =",#RPM,13,10,13,10)

Pulses =0

goto main

'%%%%%%%%%%%%%%%%%%%%%%%%%%%
 

3142ron

New Member
Wow. Thanks very much for this; works well on the PICAXE PROGRAMING EDITOR. Will try it for real soon.

Thanks again for your time.

Ron
 

3142ron

New Member
Tried your program and works perfectly. I did find using my frequency generator to simulate a magnetic pick up; that
would only work around 0.4 > 2.2 volts d.c. (square wave) A magnetic pickup usualy generates around 3 > 6v a.c.
I thought I may be able to use a 1.5v zenor diode on the pickup output to achive this voltage.

Again Thanks very much......
 

AllyCat

Senior Member
Hi,

A resistor of a few k ohms between the sensor and the PICaxe input should be good enough. The PICaxe's internal "protection" diodes will limit the voltage swing sufficiently. A "1.5 volt zener" usually contains just two forward diodes in series, but is likely to limit the swing excessively anyway.

Even the 08M2 has an on-chip comparator which can detect the crossing of any voltage threshold, but it is not supported directly by PICaxe Basic, so needs rather more "advanced" programming methods.

Cheers, Alan.
 

3142ron

New Member
Original Picaxe progamming editor

Hi Alan'

Can I still down load the Original Picaxe progamming editor?. I can only find new Version 6.
If so do you have the link?

Cheers
Ron
 

3142ron

New Member

SAborn

Senior Member
I also needed to search for PE5, its a pitty reved has chosen not to give an option in downloads for either software.
Pe6 is ok, but for basic tasks like kids I introduce to picaxe, PE5 is still my preferred platform of software.
 

hippy

Ex-Staff (retired)
Staff member
Silly Me, I have the Disk; I bought it from Rapid Elecronics with the Circuit and Programming Lead......
Check the version number as the disk may be an older version which has sat of the shelf for a while. I recall the latest PE5 is 5.5.6
 

hippy

Ex-Staff (retired)
Staff member
I also needed to search for PE5, its a pitty reved has chosen not to give an option in downloads for either software.
Both PE6 and PE5 are available from the software section of our website -

http://www.picaxe.com/Software

We have separate PE6 and PE5 entries rather than a single PE with an option to select which to download because that is less confusing that way, and PE6 is what we recommend for users.
 

SAborn

Senior Member
Ok, it is on the download list, just way down the list, I would expect it to be second following PE6 on the list and not far down the list lost in other stuff.
 

3142ron

New Member
BLOCKLY IF varA &quot;Help&quot;

can you help?

JUST STARTED USING BLOCKLY TO GENERATE A NEW PROGRAM, TO LOOK AT A VARIABLE RESISTOR &;
VALUE (varA) SAY 10 - 49 (PLAY TUNE 1) / VALUE (varA) SAY 49 - 199 (PLAY TUNE 2) /
VALUE (varA) SAY 10 - 50 (PLAY TUNE 2)

CANT SEEM TO FIND THE RIGHT BLOCK TO ALLOW THE FUNCTION:
IF (VAR) 10 > 49 THEN PLAY TUNE 1
IF (VAR) 49 > 199 THEN PLAY TUNE 2

ETC....... FOR ABOVE

ALL I FIND IS IF (> = < <>)

I managed to construct many blocks of; if varA = 10 / if varA = 11 / if varA = 12 ect...... then play tune.
it works but i'm sure theres a much simpler solution.

Mant thanks for any thoughts.....
 
Last edited:

hippy

Ex-Staff (retired)
Staff member
The ability to use "varA >= X AND/OR varA <= Y" is coming in an updated version of Blockly.

In the meantime it would be possible to use nested IF blocks ...

Code:
IF varA >= X THEN
   IF varA <= Y THEN
     PLAY tune
It would, as eclectic suggests, probably be easier to do this project with Basic.
 
Top