Shop OBEX P1 Docs P2 Docs Learn Events
RPM sensing project...need assistance — Parallax Forums

RPM sensing project...need assistance

llemallema Posts: 10
edited 2008-11-02 03:49 in Propeller 1
Hello all,

I am new here. Just found this place. I have a project which consists of reading RPM of a 2-stroke engine's coil (grounding lead) and subsequently operating a common RC servo. The RPM range is 0-20000. I need the servo to modulate at certain RPM ranges. For example I want the servo to start to move (close a valve) at say 10000 and have it completely closed by the time it reaches 12000 RPM. The numbers are theoretical as testing will be required for optimal performance, but that is the basics of what I need to do. The model in which this is to be used will have an onboard 6.0v DC supply so that shouldn't be a problem.

Can someone point me in the right direction as the which controller I should be looking into and what would be needed as far as hardware addons to accomplish sure a project? You assistance would be greatly appreciated as I am a beginner here. My background is in robotics and industrial instrumentation, but in all honesty I am a little rusty and these new controllers are all new to me! [noparse]:)[/noparse]

Thanks,

Marc.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.modelgasboats.com - The Online Magazine Devoted to Gas Powered Model Boats!

Post Edited (llema) : 10/15/2008 3:05:27 PM GMT

Comments

  • parskoparsko Posts: 501
    edited 2008-10-15 15:09
    Since you've posted in the Prop forum, can we assume the conroller you are using is a Prop?

    If so, you should be able to accomplish this will a transistor input hooked up to said ground. It could look something like this:

    circuit.gif

    You may be able to gleen some info from this post:

    http://forums.parallax.com/showthread.php?p=691869

    I never got things working completely, but I did try that circuit above, and the LED did blink.

    Let us know how you progress.

    -Parsko
  • llemallema Posts: 10
    edited 2008-10-15 15:12
    Thank you for the prompt reply! I will read the post you linked.

    FTR, I have not chosen a controller yet...This is part of the assistance I need. What would be the best choice for this simple application?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.modelgasboats.com - The Online Magazine Devoted to Gas Powered Model Boats!
  • parskoparsko Posts: 501
    edited 2008-10-15 15:23
    llema said...
    What would be the best choice for this simple application?

    Not sure. It's a personal decision one must make for themselves that will depend on cost, ease of use, etc... All ucontrollers should do you fine for this kind of application. BUT, the Prop is one of the easiest, IMHO. Though, code may already exist for other ucontrollers out there to do just this. If this is your first ever ucontroller project, I'd recommend the Prop, as I think it has a great capacity for future upgrades and projects. But, a PIC, or Stamp, or whatever will do you just fine.

    -Parsko
  • Mike GreenMike Green Posts: 23,101
    edited 2008-10-15 15:39
    I would recommend using a Propeller. As usual, it has advantages and disadvantages.

    1) It's a powerful, fast microcontroller that's certainly capable of doing what you've stated

    2) It can easily provide a display on a TV or VGA monitor of the various parameters used in your program like RPM, servo position, various calculated values, etc.

    3) You could easily attach a PS/2 keyboard for setting parameters and controlling the experiments.
    This and the display require minimal external components.

    4) The Propeller is relatively new compared to the Stamps and many other microcontrollers.
    It doesn't yet have the huge body of educational material available for the Stamps.
    There are some very good tutorials provided for the Propeller Education Kit which are usable with most of the Propeller boards and modules.
    There are some other tutorials on-line in these forums.

    5) Conceptually, the Propeller is quite different from other microcontrollers since it has 8 independent processors with individual and shared memory.
    This simplifies some otherwise very complex applications where several things have to be going on at the same time. In your case, one processor
    would just be measuring RPM and another would just be controlling the servo. A third would be the main controller taking the RPM data and adjusting
    the servo position based on whatever criteria you need. A fourth could be generating the video output and a fifth could be managing a PS/2 keyboard.
    All of this could be done with a page or two of code (plus library routines for the video, servo, and keyboard) depending mostly on how fancy you want
    the display and keyboard to be.

    You might browse this and the Completed Projects forums. Some other people have described projects to control engines using RPM information.
    Mostly they've been motorcycle engines. I don't have any links, but browsing should also give you some ideas about what can be done.
  • parts-man73parts-man73 Posts: 830
    edited 2008-10-15 17:39
    My vote would also be for the Propeller, If this was going to be mass produced and you were going to make 1000's of them, I would change my answer, as a $2-3 processor is certainly capable. but the rapid prototyping ability of the Spin langauge, with it's readily available objects, and the multi-cog architecture lends itself nicely to monitoring with one cog and controlling with a different cog, as Mike talked about.


    I was thinking about a similar project (so many ideas, so little free time) My idea was to use an inductive or magnetic type of sensor. Look at this Hall effect sensor for example www.parallax.com/Store/Sensors/PressureFlexRPM/tabid/177/CategoryID/52/List/0/Level/a/ProductID/90/Default.aspx?SortField=ProductName%2cProductName
    In the automotive industry, this how RPM is measured, although your method my work, I see the Hall Effect sensor as a better way.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Brian

    uController.com - home of SpinStudio - the modular Development system for the Propeller

    PropNIC - Add ethernet ability to your Propeller! PropJoy - Plug in a joystick and play some games!

    SD card Adapter - mass storage for the masses Audio/Video adapter add composite video and sound to your Proto Board
  • llemallema Posts: 10
    edited 2008-10-15 18:01
    My reason for not wanting to use the hall effect sensor is the fact that it would have to be installed close to the flywheel to be in close proximity with the magnets in the flywheel. That, or using another magnet on the shaft somewhere, but both solutions would make it too complicated for switching the setup from one motor to another.

    My application is for RC boats with 2-stroke gasoline engines. The "kill" or grounding lead from the PICKUP coil is commonly used to plug in an onboard tachometer such as a Tinytach, etc. Being able to simply plug into this lead would be SO much easier! Would there be any possibility of plugging this directly into the Propeller?

    From what I gather so far I need to convert the pulse from the coil to a pulse that can be inputted into the Propeller...correct? Would the above circuit accomplish this?

    I have been reading an awful lot on the propeller and trying to figure out how I could get this all done! Seems like it's doable but I don't know where to start!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.modelgasboats.com - The Online Magazine Devoted to Gas Powered Model Boats!

    Post Edited (llema) : 10/15/2008 6:46:07 PM GMT
  • llemallema Posts: 10
    edited 2008-10-15 19:40
    Well,

    I basically spent all afternoon trying to find sample of RPM sensing projects using the Propeller and can't seem to find anything remotely similar to my project....if anyone cares to help out, please feel free to do so! [noparse]:)[/noparse]

    Thanks for putting up with this newbie BTW! [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.modelgasboats.com - The Online Magazine Devoted to Gas Powered Model Boats!
  • Joel RosenzweigJoel Rosenzweig Posts: 52
    edited 2008-10-15 20:01
    Separate the problem into two phases, 1) determining the motor RPM and 2) controlling the servo based upon the RPM.

    There are a multiple ways of determining the motor RPM.· If this is a gas-engine with a coil, then you can use a product such as the "Stator Gator" that will output a single TTL level pulse for every pulse in the coil.· Every pulse in the coil corresponds to 1 revolution of the motor.· You can build your own inductive pickup, but the commercially available Stator Gator does a really nice job with gassers.· If you don't want to inductively read the pulse, then you can consider an optical pickup.· Use an IR transmitter / receiver module and focus the beam on any rotating part (flywheel, clutch, propellor shaft) and attach reflective tape to bounce the beam back.· In either case, your microcontroller would measure the time between the rising edge of the pulse train (for example)·to determine RPM.· I built on-board tachometers for RC Helicopters using these techniques.·

    Controlling the servo based upon the RPM is fairly straight forward, and quite separate from determining the RPM.· You need to decide what your transfer function looks like that will be responsible for computing what the servo position should be for a given RPM.· You'll learn what this function looks like from testing.· I'm sure you have some ideas already.· In the end, your function will take an RPM value as input, and will compute a corresponding pulse width (1000us at one extreme, 1500us neutral, 2000us at the other extreme).· Another function can then use this value and drive the output for the servo.· On a PROP, you could use one COG to measure the pulse train from the RPM sensor and compute the RPM and servo position, and another cog to control the output of the servo.· I've done this on a larger scale for another R/C helicopter project.· The PROP is a great micro to use for this project, but you could certainly do it with very tiny and less expensive controllers.· I've taken both approaches for different products.· The PROP is an excellent piece of hardware and is easy to use.·

    FYI - a standard·R/C servo needs a pulse every 20ms (50hz).· Your code needs to output a pulse of the duration you want, every 20ms, regardless of whether or not a change in position is desired.· There are objects in the object exchange which will drive servos.· I haven't used these objects, but they should provide a good starting point for you.·

    Joel-


    ·
  • StefanL38StefanL38 Posts: 2,292
    edited 2008-10-15 20:28
    Hello Ilema,

    every journey starts with the first step.
    As this is an electronical and software-journey you can start at different points

    the starting point will be there where you would like to start

    a.) this could be hardware: testing the circuit with an oscilliscope
    b.) this could be software a little demo-program configuring an IO-Pin as input and then detecting low/high-level on the Pin
    c.) asking a concrete question like
    1.) "how can I measure RPM and display it somewhere for testing it"
    1b.) can somebody post a commented little demo-program how to measure frequencies of 0-20.000 Hz ?"
    2.) "is there any ready to use code for controlling a servo ?" answer: yes there is !

    see the obex

    obex.parallax.com/objects/search/?q=servo

    this search-result could lead to another concrete question like "which servo-code would you recommend for my application ?"


    In the Appication-note 001 there is a small democode for frequency-measuring

    www.parallax.com/Portals/0/Downloads/appnt/prop/AN001-PropellerCountersv1.1.zip

    It uses a VGA-display as output. But it will be very easy to change the output to a TV or a serial-connection
    to a terminalsoftware on a PC

    Some other objects from the obex that might be interesting as they do measuring times/frequenecies

    obex.parallax.com/objects/276/

    obex.parallax.com/objects/236/

    obex.parallax.com/objects/98/

    As long as you ask CONCRETE questions or ask for SMALL demo-programs I think the forum-members will
    help a lot

    best regards

    Stefan

    Post Edited (StefanL38) : 10/15/2008 9:13:51 PM GMT
  • Capt. QuirkCapt. Quirk Posts: 872
    edited 2008-10-15 22:38
    Sounds like your going to control a fuel valve or exhaust valve (power-valve). It's a simple project with an SX chip. There is already code for rpm measurement, that is very accurate. The SX is the least expensive of all the Parallax products and nearly as simple to code as the Basic Stamp.

    If you need a display, use a Parallel LCD, not a slow Serial LCD. Plenty of code examples for that too.

    Piece of cake!yeah.gif

    Is it a Zenoah? (20,000 rpm is G260 range) or small bore·Kart or MX bike?

    Post Edited (Capt. Quirk) : 10/15/2008 10:47:40 PM GMT
  • llemallema Posts: 10
    edited 2008-10-16 02:11
    Yes,capt quirk, the application is for Zenoah 260 style engines. Any idea what is needed to use the signal from the coil black lead? You seem to know the Zenoahs.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.modelgasboats.com - The Online Magazine Devoted to Gas Powered Model Boats!
  • Erik FriesenErik Friesen Posts: 1,071
    edited 2008-10-16 02:39
    I don't know specifics about the zenoah but if it is a battery driven spark I would use a npn transistor pulled up with about a 5-10k. Put the coil wire to the base through a 10K or so resistor. Better yet feed the pulled up output through a schmidt trigger. You may have to play with these values to get a reliable reading.
  • Joel RosenzweigJoel Rosenzweig Posts: 52
    edited 2008-10-16 03:54
    The Stator Gator is designed for this engine and is already conditioned perfectly. I highly recommend it for this application.

    Joel-
  • llemallema Posts: 10
    edited 2008-10-16 04:23
    Did some research on the stator gator and that's exactly what I need to do, but buying it would make the project non cost-effective. So I guess I need to figure out how to take the signal from the coil and make it into a usable pulse for the PROP. At least I know now that it's doable as the gator seems to do just that!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.modelgasboats.com - The Online Magazine Devoted to Gas Powered Model Boats!
  • Capt. QuirkCapt. Quirk Posts: 872
    edited 2008-10-16 07:16
    Are you talking about the Red and Black primary wires? or the secondary wire that leads to the spark plug?

    I·prefer using a Melexis Hall Effect Sensor ·on the output shaft side of the crank. A very small neodymium magnet super glued or jb weld to the collet within a small 1/8" x 1/8"·counter·sink. Mount the·hall·sensor from a single bolt·bracket from the 4 bolt·motor mount bracket.

    Another way is like what Parsko recommended, it's similar to what I have seen in a few inductive pick-ups for small tachometers. Another way I have seen it done on timming lights and cars·is a spark plug wire going through a ferrite torrid similar to this· on page 29 & 32.

    If you are interested in the ignition timming, I would use both methods. That way you can accurately measure the time between·ignition and TDC and not bother with a timming light and degree wheel.






    Post Edited (Capt. Quirk) : 10/16/2008 7:21:36 AM GMT
  • llemallema Posts: 10
    edited 2008-10-16 13:18
    I am thinking of taking the signal from the BLACK wire of the primary (source) coil.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.modelgasboats.com - The Online Magazine Devoted to Gas Powered Model Boats!
  • Beau SchwabeBeau Schwabe Posts: 6,560
    edited 2008-10-16 16:38
    Take a look at the documentation on the QuadRover in the·link below. You will find a Tachometer circuit used for detecting the engine speed that might help.

    http://www.parallax.com/Portals/0/Images/Prod/2/281/28195-QuadRover-v1.4.pdf

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • llemallema Posts: 10
    edited 2008-10-16 17:05
    Thank you for that info Beau... The board used in this case is said to be p/n: #28205. I can't seem to find this board anywhere on the site. It looks like the coil wire can be plugged directly into this board. Am I mistaking or is this the case? I am assuming there is a circuit built in this board to convert the coil signal to a usable signal for the PROP? From the info I have gathered on the Zenoah coil we could be seeing anywhere from 10kv - 28kv. I am assuming this cannot be used "as is" with the PROP correct? I have been away from this kind of electronics stuff for many years now as you have all certainly noticed! Trying hard to figure this all out! [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.modelgasboats.com - The Online Magazine Devoted to Gas Powered Model Boats!
  • Beau SchwabeBeau Schwabe Posts: 6,560
    edited 2008-10-16 17:15
    llema,

    The attached image was taken from·page 9 of the PDF.· I was not the one that designed this circuit, but I will forward this post to him.· He might be able to provide more information such as how much voltage the magneto produces, so that you may compare that to the 10kv to 28kv·that you are seeing.




    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
    675 x 497 - 41K
  • llemallema Posts: 10
    edited 2008-10-16 17:25
    I must be blind...I blew right over that schematic...thank you for pointing it out! I appreciate your help!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.modelgasboats.com - The Online Magazine Devoted to Gas Powered Model Boats!
  • David CarrierDavid Carrier Posts: 294
    edited 2008-10-16 19:00
    Marc,
    I don't remember for sure what voltage I was getting from the magneto on the GXH50 engine that the QuadRover uses, but I think it was around 5Kv. The 470KΩ and 220KΩ resistors form a voltage divider, the 3.3nF capacitor and 10KΩ resistor form an RC filter, and the diodes in the BAT54S clamp voltages less than zero or over 3.3 to protect the Propeller. I tuned the circuit by placing a scope probe where the I/O pin would go (labeled "Tach" in the schematic Beau posted) and adjusting the 470KΩ and 220KΩ resistors. The amount the voltage is divide by is determined by the ratio of those two resistors, and the impedance is determined by their sum. Because the magneto produces low current at a high voltage, your sensing circuit needs to be relatively high impedance.
    Try building the circuit Beau posted, attached to a scope probe instead of a Propeller pin, and modifying the resistors until you get the waveform you want. You will essentially get a short high-going pulse once per revolution.

    - David Carrier
  • Capt. QuirkCapt. Quirk Posts: 872
    edited 2008-10-16 20:33
    If you've been boating for a long time, you should know these are 2 completly different types of ignition systems. If it was a regular G230RC or G260RC, it would be close to the Honda. But not the water cooled engine.
  • Joel RosenzweigJoel Rosenzweig Posts: 52
    edited 2008-10-17 13:55
    Can you define your budget so that we can help you with better advice? It wasn't obvious from your description that a $40 Stator Gator was going to exceed your budget. It's not clear how much money you are willing to spend on the parts to achieve what you want to do. It's also not clear if you are trying to make a one of a kind project, or if it's something that you want to commercialize. The approach to creating either can be quite different. The one of a kind solution probably doesn't need to meet the same stringent requirements on cost, manufacturability, reliability, etc. as a commercial product would. All of these factors will influence your final design.

    The other thing you need to figure out is what you are trying to get out of the project. If you want to learn how to make an RPM sensor, then you have one path to follow. If you simply want to make USE of an RPM sensor, then you have another path to follow. If you want to learn how to create your own circuit for the microcontroller, that's another branch. And if you simply want to get up and running with an existing design, then that's yet another branch.

    Joel-
  • Sniper KingSniper King Posts: 221
    edited 2008-10-17 20:13
    I have to say, if you are using a Zenoah engine with a magneto, adding a hall effects sensor to the side of the Coil with some CA an baking soda or even a few layers of E-tape·would be uber easy! This would give you the simplest RPM measurement you could find.· The magnet is already there! The pulses would come every revolution.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·- Ouch, thats not suppose to be hot!··


    Michael King
    Application Engineer
    R&D

    Check out Project: PSAV Persistent Sailing Autonomous Vehicle
  • jhirschjhirsch Posts: 2
    edited 2008-10-31 19:46
    Howdy! I am new to the forum but have been playing with the BS2 for a year or so. My latest project involves sensing RPM for an automotive engine.
    As you all have pointed out there are many ways to get a 1 / rev signal. I am working on old school stuff so I think I just need a 100K resistor in front of a 4.7V zener on the coil primary. This should clip the 12 volts nicely without causing problems. Remember that all these coils, for magneto, CD, or points and condenser ignitions are just transformers. One should be able to pick up a signal off the primary at a reasonable voltage level. Most of the two cycle stuff I have seen in recent years have a small hall effect coil with some type amp to trigger the primary of the spark plug coil. Back in the mid 90's I built a rpm sensor from an IR module that worked real good. However, now I am lazy and want to hook right to the coil. So we all know we can get a signal to measure one way or another. My question is how to code the frequency sampling on a BS2. I know I am knot in the right forum for this but maybe someone could send me somewhere for some sample code.

    Thanks

    Jim
  • P!-RoP!-Ro Posts: 1,189
    edited 2008-11-02 02:34
    Doesn't the magneto only measure up to 7500 rpm? Llema said "The RPM range is 0-20000." This would mean the rpm is way too high for the magneto. Personally, I would go back to plan A with the coils.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Pi Guy
  • pemspems Posts: 70
    edited 2008-11-02 03:19
    i didn't read all the replies, but i come from automotive crowd and have seen solutions for similar problems on cars.
    in particular, for RPM pickups 'off' a coil, an optoisolator is a very good idea - this will guarantee a protection from high voltage spikes that may potentially kill a microcontroller

    see attached schematic of RPM pickup (look at the part of schematic specific to 4n25s optoisolator).
    The schematic is of a proven to work engine management system.
    1549 x 1150 - 74K
  • P!-RoP!-Ro Posts: 1,189
    edited 2008-11-02 03:49
    Are you sure you don't want to try the coil system? 1. it seems easier to implem
    ent, 2. it would be cheaper to use.

    If you would like, I have a 5 horse engine and a good-as-broken prop to use. The reason I don't mind ruining it is I can no longer use the external resonator on it, so it is incapable of many tasks. Perfect for seeing how dangerous this project is for it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Pi Guy
Sign In or Register to comment.