Mega/Microsquirt to run engine & govern RPM (AC generator)

This forum is for the discussion of other projects on Megasquirt/Microsquirt hardware that don't fit into any of the other forums

Moderators: jsmcortina, muythaibxr

Post Reply
Two_Wheeler
Experienced MS/Extra'er
Posts: 159
Joined: Sat Dec 29, 2012 9:40 pm

Mega/Microsquirt to run engine & govern RPM (AC generator)

Post by Two_Wheeler »

I have a surplus engine and am looking at building a DIY 20-24KW AC generator. I need to govern the engine to exactly 1800 RPM. I'm looking for information as to if the MS products could do something like this. I ran a search here and the generator references I found dealt with tables.

Here are some design factors:
Engine: 1966 Corvair 2.7L 6 cylinder w/ 140 HP (4 intake pad) heads. Can easily adapt a 36-1 wheel onto the crank, and can replace the distributor with a shaft to drive the oil pump. I'm looking at adapting a fuel injection system from a 2.5L Subaru that uses a similar horizontally opposed cylinder engine layout with 2 port injectors per side and a central throttle body. The Subaru uses an electronic throttle body, so I would like to utilize it to govern the engine speed based on generator load. I know this can be done via an Arduino, but was curious if the MS line could do something similar.

Thanks for any help/info.
1981 Suzuki GS1000G & 1992 GSX1100G Microsquirt Projects
Adapting fuel injection mostly from a 2003 GSXR600
Hearing "It can't be done" is SOP around here.
ol boy
Super MS/Extra'er
Posts: 1532
Joined: Mon Sep 10, 2007 3:06 am
Location: Tucson, Az

Re: Mega/Microsquirt to run engine & govern RPM (AC generato

Post by ol boy »

You might beable to use the CL idle control to run a larger Fidle or stepper motor air valve. You only need 35ish HP at 20KW.
306 SBFord, Torquer II EFI intake, 60 lbs injectors, 8 LS2 coils, VS Racing 7668 turbo, 4R70W, MS3x fw1.4 w/built in trans controller.
Two_Wheeler
Experienced MS/Extra'er
Posts: 159
Joined: Sat Dec 29, 2012 9:40 pm

Re: Mega/Microsquirt to run engine & govern RPM (AC generato

Post by Two_Wheeler »

Thanks. The data I read says it should make around 46 HP @ 1800 RPM, so I'm good for my power goal, plus it is a "free" engine sitting in my shop. :D

In additional reading I'm doing, :RTFM: it appears feasible to adapt a 2.5L Subaru fuel injection intake & throttle body to the motor since both are horizontally opposed motors of similar displacement, and I can add a 36-1 wheel fairly easily to the crank balancer. I am also learning about electronic throttle bodies and may be able to control one sufficiently with an Arduino micro controller. I'm using this as a sort of trial run since I have a couple of Corvairs that would benefit from MS. This forum was very helpful in getting my old Suzuki to run.

For reference (in case anyone reads this months or years later trying to do something similar), here's a forum post about one that is supposed to work, his code is in his post and his YouTube video is linked in his post:
http://forum.arduino.cc/index.php?topic=192944.0

Some further reading suggested using a Mosfet instead of the TIP120.
1981 Suzuki GS1000G & 1992 GSX1100G Microsquirt Projects
Adapting fuel injection mostly from a 2003 GSXR600
Hearing "It can't be done" is SOP around here.
ol boy
Super MS/Extra'er
Posts: 1532
Joined: Mon Sep 10, 2007 3:06 am
Location: Tucson, Az

Re: Mega/Microsquirt to run engine & govern RPM (AC generato

Post by ol boy »

Which hardware version of Arduino are you playing with? I'm currently playing with a teensy3.2 with good success. Aren't most of the TBW using CAN bus to send and receive commands? Can you post some links to others projects and example code?
306 SBFord, Torquer II EFI intake, 60 lbs injectors, 8 LS2 coils, VS Racing 7668 turbo, 4R70W, MS3x fw1.4 w/built in trans controller.
Two_Wheeler
Experienced MS/Extra'er
Posts: 159
Joined: Sat Dec 29, 2012 9:40 pm

Re: Mega/Microsquirt to run engine & govern RPM (AC generato

Post by Two_Wheeler »

I have a Uno I'll probably use, I'm focusing on the mechanical side right now of getting the Subaru intake ports matched to the Corvair carb openings. I used a Teensy 3 to power a combo gauge several years ago (I think it was oil and air temp), it came out fairly well until the ambient temp sensor quit working.

For some reason, the people posting YouTube videos rarely post or link their code :( . I was able to find the one I linked above after watching his YT videos and then googling his fly by wire Arduino terms. That lead me to the Arduino forum and his code.

Here is a YT video for a simple mechanical governor, his code is based upon a basic sketch, and he has a code screen shot near the end:
https://www.youtube.com/watch?v=5NnIUtBGIZY

He fixed his code by changing one value here, again no code other than a screen shot:
https://www.youtube.com/watch?v=sJ4znw8CWpg

Arduino forum, end result is a fully working posted PID code:
http://forum.arduino.cc/index.php?topic=230547.0

Here is a good discussion about a Subaru ETB with pinouts and functions:
http://forums.linkecu.com/index.php?/to ... ps-wiring/

That particular site has a lot of ETB discussion.

AFAIK, the CAN function only relates to retaining the original ECU. Most of the ETBs I have looked at use a combo of 12V for the motor and 5V for the TPS. Since everything I'll be doing involves an MS ECU, I'm only looking at those two voltages.

I hope this helps.
1981 Suzuki GS1000G & 1992 GSX1100G Microsquirt Projects
Adapting fuel injection mostly from a 2003 GSXR600
Hearing "It can't be done" is SOP around here.
ol boy
Super MS/Extra'er
Posts: 1532
Joined: Mon Sep 10, 2007 3:06 am
Location: Tucson, Az

Re: Mega/Microsquirt to run engine & govern RPM (AC generato

Post by ol boy »

Interesting.. So there is a CAN module for the DBW? Trying to wrap my head around this.

In the short: it's just a brushed motor driving some gears with feed back from one set of wipers. Other wiper is used for TPS value.

Is this the standard across all manufacturers?
306 SBFord, Torquer II EFI intake, 60 lbs injectors, 8 LS2 coils, VS Racing 7668 turbo, 4R70W, MS3x fw1.4 w/built in trans controller.
ol boy
Super MS/Extra'er
Posts: 1532
Joined: Mon Sep 10, 2007 3:06 am
Location: Tucson, Az

Re: Mega/Microsquirt to run engine & govern RPM (AC generato

Post by ol boy »

Forgot one thing. I did some CAN bus code with the teensy. I'm currently receiving CAN broadcast messages from an MS2 for a transmission controller and also push all the data into a micro SD card. No need to capture the tach output signal for rpm. Just get it over CAN.
306 SBFord, Torquer II EFI intake, 60 lbs injectors, 8 LS2 coils, VS Racing 7668 turbo, 4R70W, MS3x fw1.4 w/built in trans controller.
Two_Wheeler
Experienced MS/Extra'er
Posts: 159
Joined: Sat Dec 29, 2012 9:40 pm

Re: Mega/Microsquirt to run engine & govern RPM (AC generato

Post by Two_Wheeler »

ol boy wrote:Interesting.. So there is a CAN module for the DBW? Trying to wrap my head around this.

In the short: it's just a brushed motor driving some gears with feed back from one set of wipers. Other wiper is used for TPS value.

Is this the standard across all manufacturers?
All of the ones I've looked at have 6 terminals, so they have redundant wipers. I'll have to dig into some wiring manuals to go further.
1981 Suzuki GS1000G & 1992 GSX1100G Microsquirt Projects
Adapting fuel injection mostly from a 2003 GSXR600
Hearing "It can't be done" is SOP around here.
ol boy
Super MS/Extra'er
Posts: 1532
Joined: Mon Sep 10, 2007 3:06 am
Location: Tucson, Az

Re: Mega/Microsquirt to run engine & govern RPM (AC generato

Post by ol boy »

So I did some digging. Looks like a simple DC motor driving the inners of a DBW with a pair of pots providing feedback. I think your simplest solution would be a teensy3.2 receiving CAN messages at 20Hz. A pwm output driving a low side switch of the DBW DC motor with feedback for position (basically you made a hobby servo). I'm not sure a H bridge is even needed. Depends on how closed the internal spring gets the valve. One wiper output could be feed into the uSquirt box for TPS input. With some software trickitry you can double check the measured position of the main pot and the position that MS reports over CAN. The whole start up and shut down process can be programmed in the teensy.

I want to dig into DBW more anyways. Not sure on your C++ language level but I'd help do most of the code. I even have CAN to uSD card logging sorted on my car.
306 SBFord, Torquer II EFI intake, 60 lbs injectors, 8 LS2 coils, VS Racing 7668 turbo, 4R70W, MS3x fw1.4 w/built in trans controller.
Two_Wheeler
Experienced MS/Extra'er
Posts: 159
Joined: Sat Dec 29, 2012 9:40 pm

Re: Mega/Microsquirt to run engine & govern RPM (AC generato

Post by Two_Wheeler »

I'm attaching the PDF version of a file I'm working on that has notes and code from relevant forum posts as well as some graphics. The first part deals with picking up the RPM from the - side of the ignition coil. This would generate a number (862 in the code example) that would be used by the Arduino to control the ETB. I have not done much with this code as I have been focused on engine mechanical stuff lately.

I'm still doing a lot of research on this as my old engine will need more than I thought to run. It would be less costly to buy a late model used engine and then use HP Tuners to set the idle speed to 1800. I like the simplicity of the older engine, and since I have two others that I eventually plan to convert to EFI I'm still leaning towards using it. The big cost for it will be the uS box, everything else can be purchased a little at a time.
Attachments
Arduino sketch for servo.pdf
PDF document with notes, code, and graphics
(553.18 KiB) Downloaded 120 times
1981 Suzuki GS1000G & 1992 GSX1100G Microsquirt Projects
Adapting fuel injection mostly from a 2003 GSXR600
Hearing "It can't be done" is SOP around here.
Post Reply