Arduino stepper/servo control of generator throttle

I know this is an older thread, but is there anyone else out there who is trying to govern an engine that has no mechanical governor by using a crank signal and potentiometer as inputs and a servo to control the throttle? I have an old (~2006) Generac generator engine that I’m adapting to my zero turn lawnmower, and the engine is currently stepper controlled (5-wire so I’m assuming it’s a 4 phase unipolar stepper). I have other Arduinos, but I’m hoping the 328 chip will do the trick. If you could help me, I think it would help others who have failed/no mechanical governors. I’m fairly new to Arduino programming, but I’m trying hard to learn… PLEASE HELP!! :slight_smile: Thank you!!! :smiley:

Here’s what I’ve got so far:

1: Arduino Pro Mini 328 - 5V/16MHz

2: Reflective IR Phototransistor module for crank signal (digital signal output 0v, 5v) with
reflective tape to place on the crankshaft.

3: 10k Potentiometer to set/adjust desired RPM

4: Standard 5v 180 degree Hobby Servo to connect to carburetor throttle

If you know how to program, I would think the code could be quite simple using the servo library and mapping the potentiometer input. It’s a gasoline engine, so it will need to start out with the throttle open then close it as the RPMs come up, and I’m guessing it would benefit from PID or at least PI tuning. Could the Proportional and Integral be controlled by additional mapped Potentiometers to make such a device more universal and more easily adjustable? I found an EFI setup that used pots for PI tuning, but couldn’t find code… Any thoughts or input would be greatly appreciated. Thanks again!!!

I can't see anything useful to your problem in the older Posts so I am suggesting to the Moderator to move your Post to its own Thread.

dodgenet:
and the engine is currently stepper controlled (5-wire so I'm assuming it's a 4 phase unipolar stepper).

If the engine is already controlled with a stepper motor I don't understand why you want to change that.

Did you write the program for the stepper motor control system?

Have you got the reflective speed detection working reliably?

...R

Hello, the current controller is made for a Generac generator, and a lot of the wires were cut by the previous owner who was trying to install the 33HP engine into a skid steer.. I couldn't find much info on the controller, but apparently it governed 120/240v AC frequency (60Hz) by RPMs through the stepper motor. I don't know how to trick the controller into throttling up.

I have bipolar stepper drivers, but no unipolar ones for the 5-wire setup, although I do have some hobby servos and 3D Printer steppers around. I'm going to test my IR pickup for proper function through the engine's operating range later this week, as I am waiting for a working display to arrive.. I am somewhat capable of understanding/editing code, but I haven't written any yet. Again, thank you for any help you can offer. Take care! :slight_smile:

I had no idea you were using a 33hp motor - I was assuming maybe 1 or 1.5hp.

I am not going to advise about 33hp because there is too much risk of injury if my advice is wrong, or wrongly applied.

...R

Looking at someone on Utube playing with such a governor shows the wire are all color coded, so why can't you splice the wires back together. There are not that many.

Paul

My generator control panel wires are all dark blue with numbers on the wires that are intact. I have no idea what the model of the generator is, as I bought the engine used. The previous owner told me it was part of a mach up and hadn't been used yet, and Generac isn't able to help unless the model/serial of the Generator is known. My Generac controller is a 0G0024-B, but Generac cannot even look up schematics without the model/serial number of the Generator.

I will continue learning Arduino programming and hopefully I'll learn enough to make a responsive governor using a hobby servo controlled by an Arduino. I have a 4-cycle string trimmer engine I could start with before adapting to the 33HP V-Twin.

Do you have all the mechanical linkages and brackets?

Paul

Hi. I have verified that my reflective IR crank input is accurate. I tested it with the engine at idle (~1,250 RPM) against a known good RPM sensor and they both got the same reading with one strip of reflective tape at the crankshaft. I also verified that the sensor is good/accurate up to 15,000 RPM on my router. I only need to read up to 3,600 RPM or so, so I think the input is plenty good. I don’t have an oscilloscope…

I can design and 3D Print or otherwise fabricate mounts for the sensor and servo, but no, I don’t have brackets yet. I may cobble some temporary brackets up until I know the system functions properly.
Getting the old 4-stroke string trimmer engine running might be a challenge, but I’ll work on that a bit today.

I’m a total noob when it comes to programming, but I’m learning Arduino quickly by watching tutorial videos and building simple circuits. Any/all input is/will be greatly appreciated! Thanks again! :slight_smile:

A Google search for "Add-an-Arduino-based-Optical-Tachometer-to-a-CNC-R" should lead you to good tachometer code to sense RPMs and display the reading in Analog and Digital on a .96" I2C OLED display. I had to comment out some lines having to do with display dimming to get it to compile properly, but the code works great! Do any of you on here know of a resource that teaches how to combine code from different Arduino projects properly? Thanks! :slight_smile:

dodgenet:
Do any of you on here know of a resource that teaches how to combine code from different Arduino projects properly? Thanks! :slight_smile:

Most will tell you that doing programming in this manner is a recipe for disaster.

dodgenet:
A Google search for "Add-an-Arduino-based-Optical-Tachometer-to-a-CNC-R" should lead you to good tachometer code to sense RPMs and display the reading in Analog and Digital on a .96" I2C OLED display. I had to comment out some lines having to do with display dimming to get it to compile properly, but the code works great! Do any of you on here know of a resource that teaches how to combine code from different Arduino projects properly? Thanks! :slight_smile:

If you properly wrote the code so almost all logic is contained in functions, then you can copy the function code. All otherwise you can just copy the logic, if the code actually does what you want.

If you just find stuff and have never tested it, then there is no point. You will have to debug it anyway.

Paul

And remember to ‘fail safe’ when an exception occurs.