Shop OBEX P1 Docs P2 Docs Learn Events
Engine speed governor — Parallax Forums

Engine speed governor

rogerfriesrogerfries Posts: 11
edited 2010-12-29 21:38 in Propeller 1
I'm totally new to the world of micro controllers. I do have a programming background and some electronics knowledge. I still have a whole bunch of reading to do on this topic, but I was hoping for some direction.

My project, I have a massive log splitter that I built from scratch It works great except for the engine speed governor. It's the normal belt driven mechanical kind where you set the RPM and it holds it at that RPM. This is fine except that while I'm moving a log into position I want the machine to go 600 RPM Idle then when I hit the lever I want it to jump up to about 2,500 RPM and hold (with a variable engine load) while I'm splitting then go back to idle 30 seconds or so after the split lever is released. This will save fuel, noise and hydraulic temperature. This is significant as it's a 300 CI 6 cylinder engine moving 55 gallons per minute of hydraulic oil. It will also have a hydraulic generator on board which will require precise RPM while it's generating power to maintain 60 Hz. I'm not yet sure what that RPM will be.

So basically I want switches to control 3 selectable RPM's (Idle, Split and Generate). I already have switches mounted on the split lever, I plan to use a gear tooth sensor on the flywheel to determine the RPM and a servo of some type to adjust the engine speed. How difficult is this to achieve with the propeller? What's the beat way to determine the current RPM? I was thinking I'd count the pulses from the gear tooth sensor over say a 1/10 of a second divide that by the number of gear teeth and multiply out to get the RPM, or is there a better way?

Any head start you can give me will be much appreciated!! Again I'm totally new to this.

Here is a video of the machine in action if your interested:
http://picasaweb.google.com/lh/photo/HtEPqyO_BAQaOe0E441Xqg?feat=directlink

Here is my photo Album for this machine.
http://picasaweb.google.com/Roger.Fries/Splitter2002?feat=directlink

Thanks!
«1

Comments

  • StefanL38StefanL38 Posts: 2,292
    edited 2010-12-21 05:52
    Hi Roger,

    cool machine. Does the hydraulic have enough power to split it into six pieces at once?

    Welcome to the forum and the propeller-world.
    Very good introduction telling right in the first posting what your knowledges are.
    (Most new users do not include such info)

    Surely the propeller-chip can measure and control the rpm

    As this is a machine that is used under rough conditions the rpm-measuring should be very robust.
    With the hardware-counters of the propeller-chip a precise measuring of frequencies is possible.
    There are pre-programmed code-modules (called "objects") in the object exchange
    for
    - measuring frequencies
    - controlling standard RC-servos
    and a lot of more things.

    Most work of the coding is done but you still need a basic understanding of the programming-language SPIN
    to use these objects.

    If you start the forum-members here will help you.
    You will get a lot of help if you ask concrete questions and include your programs as attachments

    You can ask as many questions as you like as long as we (the other forum-members) can see you made a try on your own and are now stuck somewhere.

    As you are new to microcontrollers at all I would recommend to start working through the PE-Kit Labs to get a basic understanding of SPIN
    In parallel you can play around with the demos delivered with the several objects.

    Two very usefuls things are the FullDuplexSerial-driver which you can use to send debug-info back to the PC using the same cable as for programming the propeller-chip
    an alternative is the EZLog.EXE from www.hannoware.com with which you can watch and even log the values of variables almost in realtime while your program is running
    on the propeller.

    best regards

    Stefan
  • rogerfriesrogerfries Posts: 11
    edited 2010-12-21 07:45
    Thanks Stefan!

    Yes this absolutely splits 6 ways at once, if the video link works you need to see the video to fully appreciate how good this actually works.

    I'll start searching on measuring frequency. I had been searching on tachometer & RPM without success. Perhaps frequency is the correct electronics term.

    I definitely want to start with test projects. The only problem is the proto board I purchased has only solder connections, so I'm a little hesitant to mess it up. I should have bought one of the ones with the solderless breadboard. Perhaps I should buy one of those for testing. I have a bunch of other uses for micro controllers once I get the hang of it. I hear there is a propeller 2 coming out. Need to look into that also.

    Thanks!
  • Cole LoganCole Logan Posts: 196
    edited 2010-12-21 08:09
    Heres a link that will allow you to get the most out of your proto board.

    Propeller Protoboard Designs for the Beginner
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-12-21 08:40
    Actually a tachometer just counts the number of pulses in a given amount of time. So you really need a 'pulse counter'. You take the pulse info off the distributor coil. To get RPM, you have to consider how many spark plugs you have and if the engine is 2 or 4 cycle. Factor these items in and you get a true RPM reading at any point in time.

    Frequency is a more formal term - from radio. But since frequencies go way beyond your useful range, you might find a 'pulse counter' rather than a 'frequency counter' offers a more useful example.

    To hazard a guess - 2500 RPM on an 8 cylinder 4 cycle engine would be 8000 pulse ( 2500x8x4), but I could be wrong about how to factor in 4 cycles.
  • Cole LoganCole Logan Posts: 196
    edited 2010-12-21 09:17
    For a 4 cycle 6 cyclinder engine at 2500 rpm you would have 7500 pulses (2500x6x0.5) it would be times 0.5 because there 2 crank rotation for every 1 firing of a cyclinder. On a 2 cycle this would not be the case because there are only 1 rotation for every firing of a sparkplug.
  • HShankoHShanko Posts: 402
    edited 2010-12-21 09:29
    rogerfries,

    Unless I'd missed it being mentioned, also look at AN001, an app note on the Prop counters. Sometimes it doesn't explain quite enough, but does help get on into each of the options on the counters.
  • rogerfriesrogerfries Posts: 11
    edited 2010-12-21 11:26
    Thanks all! I want to use the gear tooth sensor on the flywheel because at some point I plan to swap in a diesel engine which of course would not have a distributor. I did already purchase the gear tooth sensor that should work with this gear and the propeller I'm told. I think I have a pretty good handle on the hardware, I just need to figure out how to write the program. My thought was also that the gear teeth would give me a lot of pulses per revolution for quick adjustments as load increases. Any flaw in my logic? Sometimes what seems to be a good idea in theory to the layman turns out to be a bad idea in practice. I use the saying "Common sense will not be tolerated"
  • Cole LoganCole Logan Posts: 196
    edited 2010-12-21 12:11
    I would say that using the gear tooth shouldn't be a problem at all. I would think that if all modern fuel injected motors are using them then there got to be something right about it.

    do you have a link to the sensor that you will be using.
  • edited 2010-12-21 12:25
    Parallax has a book called Process Control (Item Code 122-28176). Chapter 8 is titled Proportional-Integral-Derivative Control and has some information that you might find useful. It's written for the Basic Stamp but the concept is there. You would have to rewrite the code in Spin. This might be a 'nontrivial' task depending on your knowledge of Spin.
  • rogerfriesrogerfries Posts: 11
    edited 2010-12-21 13:27
    Cole,

    I plan to use Digikey part# 620-1326-1-ND. This was recommended by a friend who knows something about this stuff I did not pick it out so there is a good chance it will work, but if I need to use something else no big deal. I just want this thing to be perfect. As I always say, my budget is: "As little as possible, but as much as necessary"

    http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=620-1326-1-ND


    I also like the idea you sent about adding the pin headers. Too bad Radio Shack does not have hardly any parts anymore. I'll have to mail order the pin headers, Gerrrr.

    Thanks to you all! I've added the other suggestions to my required reading list. I have next week off hopefully I can get through some of the reading
  • bsnutbsnut Posts: 521
    edited 2010-12-21 14:40
    Too bad Radio Shack does not have hardly any parts anymore.
    I agree with you 100% and its to bad.

    Here is one suggestion that I would do for the engine governor and that is have an mechical overspeed governor to electriclly connected to shut down down the engine, when the engine overspeeds. I have this feature for my Detriot diesel genset, which uses a Woodward speed control on a old ship that I am helping to restore.
  • bennettdanbennettdan Posts: 614
    edited 2010-12-21 15:07
    rogerfries,

    I don't know if i would use that sensor for the actual RPM sensor due to it being used in a outside and messy environment. I would look for a chevy crank or cam sensor they are 5 volt sensors usually or look at this one from Jameco.
    http://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_512401_-1
    it would be easy to mount into a simple L bracket and is 5 volt tolerant and not to pricey.

    One question how much force does it take to pull the throttle open on your motor? If you can measure it or it very light then a hobby servo might be able to control it.
    Also if you are just trying to maintain the hydraulic pressure would you not want to control the motor based on how much PSI your hydraulic pressure is?
    RPM control might be a stable enough control to maintain the pressure you just need to try it and see.

    Here are a few object from the OBEX that might get you started.
    http://obex.parallax.com/objects/98/
    http://obex.parallax.com/objects/387/

    Also look for the Count pubs in the link below
    http://obex.parallax.com/objects/30/

    Hope this helps..by the way I love the machine.
  • rogerfriesrogerfries Posts: 11
    edited 2010-12-21 21:28
    As to how much force to operate the throttle, as long as I can ditch the mechanical governor it takes almost no force to move just the throttle. My first stab at this was trying to work with the mechanical governor and have just 2 speeds idle & split controlled by a solenoid, but the governor took more force than I find a solenoid to handle. Now with the addition of the generator I really think I need/want a more precise means of controlling the speed.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-12-21 21:53
    Admittedly, I was a bit off with my math - though the concept of calculating RPM was realistic.

    One additional point - Frequency is measured in cycles per Second and RPM is revolutions per Minute. Regardless of how you take off a reliable pulse, the Propeller is fast enough to count just about anything the engine can put out.

    While there are hardward counters (two) on each Cog of the Propeller, it might actually be easier to creat a software counter for a first effort. Many hardware devices can be emmulated in software if the processor runs at a fast enough rate. And often, the software model is easier to first understand.
  • bennettdanbennettdan Posts: 614
    edited 2010-12-21 23:34
    rogerfries,
    Might I suggest a test bed take your sensor and use a variable speed drill to spin a gear or sprocket and then read that first, then wire a RC servo and then watch as you speed the drill the servo should react to the change.
  • bsnutbsnut Posts: 521
    edited 2010-12-22 01:23
    Rogerfries,

    The best way to monitor RPM on a engine that, you have is to use a Hall Effect switches. They are used on car engines to do same thing that you are wanting to do.

    Now, for the speed control part. They make electrically controlled throttles for your engine and I know this because our Detriot genset has one on it. Make sure that you adjust it so the engine cannot go in a overspeed condition. I don't think you want to kill your engine.
  • AJMAJM Posts: 171
    edited 2010-12-22 05:16
    Rogerfries,

    Great project, I am actually working on something very similar.
  • pgbpsupgbpsu Posts: 460
    edited 2010-12-22 06:35
    Cool project! If you decide to use a Hall Effect sensor keep in mind that Parallax stocks (and kinda recommends) one:

    You may find some code that supports this one more easily but I don't know if it will respond fast enough for your application. Maybe someone with some experience with this device can answer that.

    Welcome to the forum, best of luck, and keep us posted.
    Peter
  • yarisboyyarisboy Posts: 245
    edited 2010-12-22 18:22
    The engine appears to have a standard down draft carb on it. Since you really want electronic control and obviously have good fabrication skills I would opt for a drive by wire throttle body servo such as found on either of my late model Toyotas. You are looking for a throttle body that will allow it's shaft actuator and feed-back position sensor to be grafted to your carb. As for the speed sensor, you would like a magnet on the pump coupling. With that, a standard hall effect sensor such as Parallax sells will provide a speed signal pulse. I'd use two magnets to retain balance for the rotating assembly. Once you have the specs on a throttle servo and feed back device post them here and watch the circuit design types give you a good interface parts list/schematic. These guys are also cracker jack at Spin and will help out there too. They have for me.
  • kwinnkwinn Posts: 8,697
    edited 2010-12-22 19:11
    I would suggest a different approch to measuring and controlling speed. Rather than measuring the number of pulses from a toothed gear or RPM pulses from the engine for a unit of time I would measure the time between those pulses using the propeller counter. The reason for this is two fold.
    As RPM decreases the accuracy decreases with a fixed time interval for measurements. For instance, at 600 RPM the output is 10 pulses per second or one pulse per 0.1 second, and only 10 pulses per 0.1 second at 6000 RPM. Increasing the time per reading increases the accuracy but has the effect of making the response to a change in speed much slower.
    Counting the number of clock cycles of the propeller clock (at 80MHz) per revolution results in a count of 8,000,000 at 600 RPM and 800,000 at 6000 RPM. This provides a more accurate speed measurement and allows for a much faster response to a change in speed.
  • bsnutbsnut Posts: 521
    edited 2010-12-23 05:55
    So, what you are saying is, for every pulse per revolution that the hall effect sensor is making is around a count of 8,000,000 at 600 RPM and 800,000 at 6000 RPM using the propeller clock. So, when the hall effect sensor is going true on every revolution, is the propeller clock resetting and start counting again?

    I can say it is vary good idea and sounds like a reliable one.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-12-23 06:29
    The Propeller normally clocks at 80Mhz with PPL and can go higher, say 100Mhz. There is a Nyquist stability Criterion that says you should sample at least twice as fast as your desired result. I wouldn't worry too much at error increasing as you slow down. What you really want is optimal control at your optimal performance rate - the other speeds are useful, but exact control is somewhat trivial.

    http://en.wikipedia.org/wiki/Nyquist_stability_criterion

    It seems you are getting way over the top with high resolution measurement of RPM at 8000000 counts per second or per minute. Please sort out what you are counting in minutes and what you are counting in seconds.

    From what I do understand, you can use a Hall Effect Sensor and a single neodymium magnet affixed to either the fly wheel or the pulley on the front of the engines crankshaft in order to count merely each revolution. And sure, you can add more magnets to gain higher resolution - but I really wonder why.
  • rogerfriesrogerfries Posts: 11
    edited 2010-12-23 07:36
    As for resolution, my goal is to be able to quickly sense load and adjust for it. The geartooth sensor sounded good to me as long as the propeller can keep up. My flywheel should have 164 teeth on it. 164 teeth x 3,000 RPM Max would be 492,000 pulses per minute / 60 sec in a min and I should have 8,200 pulses per second.

    Can a propeller reliably read 8,200 pulses per second?

    I really like the idea of mounting magnets at the pump coupling. This would help if/when I decide to change the engine to a diesel.

    I feel I need the extra resolution because this engine does see varied load at idle. This machine is self propelled so when I maneuver it usually I do it at idle speed as this is no Corvette. I could I suppose make a star wheel with a bunch of teeth and press it onto my lovejoy coupling then I can decide on a more reasonable number of teeth. I have a CNC milling machine so making a custom gear is no big deal for me.

    As for toyota servo, it would certainly be a quality part, but sounds expensive and I don't think I need feedback. Iny idea why I would need or how I would use the feedback?

    I also like the idea of measuring the time between the teeth rather than counting the number of teeth over time.

    I'm sure there are some nice industrial controls just for this, but this is more fun and I learn something in the process.

    Thanks you all! there are a lot of great ideas here
  • AJMAJM Posts: 171
    edited 2010-12-23 07:59
    rogerfries wrote: »
    As for resolution, my goal is to be able to quickly sense load and adjust for it. The geartooth sensor sounded good to me as long as the propeller can keep up. My flywheel should have 164 teeth on it. 164 teeth x 3,000 RPM Max would be 492,000 pulses per minute / 60 sec in a min and I should have 8,200 pulses per second.

    Can a propeller reliably read 8,200 pulses per second?

    All day long.

    Have a look at the following object in the OBEX. I use this object to measure engine and vehicle speed all the time: http://obex.parallax.com/objects/479/
  • kwinnkwinn Posts: 8,697
    edited 2010-12-23 10:12
    With a 164 tooth gear the approach I suggested may not be required, even though it would work. The 164 tooth gear would give 1,640 pulses per second at 600 RPM and 16,400 pulses per second at 6000 RPM. Even if you wanted to update the throttle position 10 times per second there is enough data ( 164 pulses at 600 RPM ) for an accurate speed measurement.

    For the measurement of speed by the number of Prop clocks between gear pulses, at 3,000 RPM or 8,200 pulses a second there would be 121.95 uSec between the start of each pulse. In that time the Prop counter would count 9,756 clocks at 80 MHz and at lower RPM the count would be higher so no problem with resolution or accuracy.

    Regardless of what method you use to measure speed you will have to take in to account the inertia of the engine itself. No matter how much you change the throttle position, it will take time for the engine RPM to stabilize for that load/throttle setting. You will need to do some experimenting here, but I expect the change in throttle position will need to be proportional to the difference between the actual and set RPM.
  • Capt. QuirkCapt. Quirk Posts: 872
    edited 2010-12-23 13:40
    I suggest to wrap a spark plug wire with a piece of solid copper wire. Or cut a slot in a torid and mount the melexis hall sensor there. Either way an inductive rpm source would be a simple answer.
  • bennettdanbennettdan Posts: 614
    edited 2010-12-23 17:29
    rogerfries
    The senors and rings part numbers below are from a corvette crank the rings press on the crankshaft so all you would need to do is attach them close to your lovejoy coupling. These are made for an automobile and should handle the vibration and weather you will have your machine in. The a ring and senor from either year are both only about 40 to 50 dollars and would be a time saver over machining your own. And the propeller can read either one and easily. 58x ring at 4000RPM is only 232000 pulses per minute which is 3867 pulses per second. Now if you want to update your throttle 10 times a second then that is 387 pulses that you would have to read each 100 milliseconds and then make a change.The prop can handle that easily. Also you can use a stepper motor to control the throttle ( Dodge uses steppers on their EFI Idel air controls) most of the time you can find a larger stepper for less than a large servo. The hobby servo might be able to control the throttle though. Look up a local hobby shop and see if they have any used servos my local shop has them buy the dozens for cheap.

    http://www.gmpartsdirect.com
    From a 97 to 03 year vette
    12559353 wheel 24x 24teeth on ring
    12560228 sensor 24x
    From a 04 up year vette
    12586768 58x ring 58 teeth
    12585546 58x sensor
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-12-23 22:25
    I realize that you want to go to diesel eventually, but as long as you have a spark plug -- you can first develop you control with that pulse. Later modification is rather easily done to the tach code. But if you want to talk about the 'best' solution, we can kick it around forever. The real problems of finding a 'best' solution depend on where is the the best place to attach the sensor to an existing engine. Since you don't have your diesel engine yet, how can we know, how can you know, and how can we really help you?

    Just rest assured that the Propeller can easily count and calculate the RPM from all the pulses that you are likely to throw at it.
  • rogerfriesrogerfries Posts: 11
    edited 2010-12-24 05:59
    Ok,


    Some decisions have been made. I am going to use a gear tooth sensor suggested by bennettdan because of it's nice adjustable mount.
    http://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_512401_-1


    I am going to make a gear and press it on to my lovejoy pump coupling as suggested by yarisboy. This is a very easy place to modify and much easier than trying to work with the bell housing. This also totally divorces this from the engine which probably will change soon as soon a donor is located.


    The GM gear suggested is a good idea and it's cheap, but I can't find any dimensions for it. I may spend more time modifying this gear than just cutting my own. Any suggestions on how many teeth I should put on my gear? My thought is the more the better, but it seems like it really does not matter.


    Now I just need to start wiring this thing up and learn Spin.


    I'm going to start with this program that AJM linked in.
    http://obex.parallax.com/objects/479/


    It seems programming the PID logic is going to be where the real challenge is after trying to read http://en.wikipedia.org/wiki/Nyquist_stability_criterion posted by Loopy Byteloose I needed a drink. All of those formulas are over my head.


    I'm going to start experimenting by adding the pin headers to my proto board as suggested by Cole Logan.
    http://ucontroller.com/Propeller%20Protoboard%20Designs%20for%20the%20Beginner.pdf


    Thanks all. Many good suggestions in this thread even the ones I'm not using right now may get used on my next project.


    Happy Holidays!
  • AJMAJM Posts: 171
    edited 2010-12-24 07:58
    It's nice to see someone else doing this. I promise I won't hijack this thread but, as mentioned above, I am virtually working on the same type of system with the propeller. The only difference is mine involves controlling vehicle speed instead of splitting logs :smile:
Sign In or Register to comment.