Pages: [1]   Go Down
Author Topic: WVO Fuel System Controller  (Read 2654 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I built a MegaSquirt engine management controller a few years ago and am now undergoing a diesel to waste vegetable oil (WVO) conversion on my truck.  Would the Arduino work well as a system controller for this project or would it be simpler to use a 555 timer and some switches?

Essentially the controller needs four inputs and four outputs.
Inputs: System power on/off (switch in cab), purge bypass on/off (switch in cab), oil temperature sending unit, oil pressure sending unit.
Outputs: WVO pump relay, diesel pump relay, purge solenoid valve relay, auxiliary heater relay.

When system power is present, the controller should monitor the oil temperature.  Upon reaching a certain temperature it should turn on the WVO pump and begin monitoring oil pressure.  Upon reaching a certain pressure it should close the purge solenoid and turn off the diesel pump.  It should also continuously monitor oil pressure and reverse the process should the pressure drop below a certain value.

Upon turning the vehicle off, the WVO pump is turned off, the diesel pump is turned on and the solenoid valve is opened for a set period of time before killing the engine.

Additionally, the purge bypass feature should disable the above described feature when the vehicle is turned off for short durations.

Does this sound feasible or is the Arduino overkill?
Logged

New Jersey
Offline Offline
Faraday Member
**
Karma: 70
Posts: 3743
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Certainly feasible. Overkill? You might argue that, but there are plenty of Arduino projects discussed here that are less complex. Personally, I wouldn't fancy getting that control system built out of 555s or other basic chippery, but that's my software bias showing. One of the hardware gurus might consider it a walk in the park.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'll admit I'm not much of a software guy so maybe that is what is stumping me but I'm not terribly sure how to go about accomplishing this task.  None of the examples I see are terribly appropriate for my project and there is zero chance of me being able to write code from scratch.  Could anyone point me in the right direction to get the ball rolling?  Do I need a shield for my four inputs and four outputs?  Can I wire in the necessary relays directly to the shield? 
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I can't offer any help, but I am a couple of steps behind you.  Are you rolling your own conversion?  I am converting an IDI VW engine.  You should check frybrid.com forums, but not much electronics discussion there.

I am hoping to an a LCD to display crankshaft RPM also.

I have some coder friends to help my progress, but my ultimate goal is fully automatic veg cutover when warm, and a pushbutton for purge cycle, while displaying oil temp, crank rpm, and current fuel level and status, ie veg or diesel.

Rod
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah I'm designing my own kit.

I'm stuck on how exactly to control the system, software via Arduino or simply hardware switches.  It seems that the Arduino would allow for more accurate and greater control but I know nothing about how to set it up or what its capabilities are.
Logged

New Jersey
Offline Offline
Faraday Member
**
Karma: 70
Posts: 3743
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This isn't complete - I couldn't decide from the description what states the outputs should be in all cases. It gives you the idea of how to use a state machine to do this though. I mocked it up with some pots and leds, it seems to work.
Code:
// States
#define OFF                0
#define RUNNING_DIESEL     1
#define STARTING_WVO       2
#define RUNNING_WVO        3
#define STOPPING           4

//pins
#define DIESEL_SWITCH      2  // Diesel pump
#define PURGE_SWITCH       3  // Purge solenoid
#define WVO_SWITCH         4  // WVO pump
#define ON_OFF_SWITCH      8  // System power
#define PURGE_BYPASS       9  // Purge bypass switch
#define OIL_TEMP_PIN      A0
#define OIL_PRESSURE_PIN  A1

#define WVO_START_THRESHOLD     617 // Arbitrary, need to set on calibration
#define OIL_PRESSURE_THRESHOLD  456 // Arbitrary, need to set on calibration
#define ENGINE_STOP_DELAY 15000UL   // Arbitrary 15 second delay

int state = OFF;  // state variable controls state machine

void  setup()
{
Serial.begin(9600);
pinMode(ON_OFF_SWITCH,INPUT);
pinMode(WVO_SWITCH,OUTPUT);
pinMode(DIESEL_SWITCH,OUTPUT);
pinMode(PURGE_SWITCH,OUTPUT);
pinMode(PURGE_BYPASS,INPUT);
}

void  loop()
{
if(state != OFF && digitalRead(ON_OFF_SWITCH)==LOW) // If we're in a running state and the system power switch is turned off, we should stop
  {
  delay(50); // debounce
  state = STOPPING; 
  } 
 
switch(state)
  {
  case OFF:
    CheckForStart();
    break;
  case RUNNING_DIESEL:
    DoRunningDiesel();
    break; 
  case STARTING_WVO:
    DoStartingWVO();
    break; 
  case RUNNING_WVO:
    DoRunningWVO();
    break; 
  case STOPPING:
    DoStop();
    break; 
  default:
    Serial.print("Unknown state ");
    Serial.println(state);
   break;
  }
delay(500); 
}

void     CheckForStart()
{ // Check for system power, if we find it, start things going on Diesel
if(digitalRead(ON_OFF_SWITCH))
  {
  Serial.println("Running Diesel");
  digitalWrite(DIESEL_SWITCH,HIGH); //Turn Diesel pump on
  state = RUNNING_DIESEL;
  }
}

void DoRunningDiesel()
{
int OilTemp=ReadOilTemp();
if(OilTemp>=WVO_START_THRESHOLD)
  {
  digitalWrite(PURGE_SWITCH,HIGH); // Open purge valve. Not clear from spec when this has to occur.
  digitalWrite(WVO_SWITCH,HIGH);
  Serial.println("Starting WVO");
  state = STARTING_WVO;
  }
}

void DoStartingWVO()
{
int OilPressure=ReadOilPressure();
if(OilPressure > OIL_PRESSURE_THRESHOLD)
  {
  digitalWrite(PURGE_SWITCH,LOW);  // Close purge valve
  digitalWrite(DIESEL_SWITCH,LOW); // Turn Diesel pump off
  Serial.println("Running WVO");
  state = RUNNING_WVO;
  }
}

void DoRunningWVO()
{
int OilPressure=ReadOilPressure();
if(OilPressure < OIL_PRESSURE_THRESHOLD)
  {
  digitalWrite(PURGE_SWITCH,HIGH);  // Open purge valve
  digitalWrite(DIESEL_SWITCH,HIGH); // Turn Diesel pump back on
  Serial.println("Reverting to Starting WVO");
  state = STARTING_WVO;
  }
}

void DoStop()
{
Serial.println("Stopping");
if(!digitalRead(PURGE_BYPASS))
  {
  digitalWrite(PURGE_SWITCH,HIGH);  // Open purge valve
  digitalWrite(WVO_SWITCH,LOW);     // WVO off
  digitalWrite(DIESEL_SWITCH,HIGH); // Turn Diesel pump on
  delay(ENGINE_STOP_DELAY);
  }
// Stop engine - not sure how.
Serial.println("Off");
state = OFF;
}

int ReadOilTemp()
{
int OilTemp = analogRead(OIL_TEMP_PIN);
Serial.print("Oil Temp: ");
Serial.println(OilTemp);
return OilTemp;
}

int ReadOilPressure()
{

int OilPressure = analogRead(OIL_PRESSURE_PIN);
Serial.print("Oil Pressure: ");
Serial.println(OilPressure);
return OilPressure;
}
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks! You make it look so simple!

Correct me if I'm mistaken then...

Assuming I can get code such as you included above to work correctly, the module can interact with whatever inputs and outputs are needed?  Would I need to create a shield of some sort to wire in the inputs/outputs?  Or would I wire directly to the Arduino?

I haven't purchased anything yet so I'm just trying to ensure I get everything I need in one fell swoop.
Logged

New Jersey
Offline Offline
Faraday Member
**
Karma: 70
Posts: 3743
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Motor vehicles tend to be electrically noisy, hostile environments for electronics. I have little expertise in that area, but there are plenty of people on the forum who do. However, you would probably want to consider opto isolating your outputs; not sure what you need on the analog read side.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My thoughts were not to run the actual shutdown of the engine through the controller, but to have a pushbutton for purge cycle and rely on me remembering to hit it, although it would be nice if you could make it so it couldn't shut down whilst being in the VWO cycle.  This must be relatively easy because many car alarms break into that circuit for turbo timers, etc.  My truck has remote start and a turbo timer.  I'll have to find the wiring diagram from that to see where it ties in.

I planned to opto-isolate my circuits.  After building a CNC machine at home, keeping those transient spikes from the brains is always a good idea.

Since my car will only use the Injection Pump I will strip out the parts to control pumps.  I only need to control solenoids for tank selection and purging.

Am I daft to think I can add a 240x4 LCD to display various values and status with a single arduino uno?

Since my VW did not come with a tachometer stock I thought of tapping into the W terminal on my alternator to approximate crankshaft RPM.  This W terminal is used by VW to drive the stock tach so it must be fairly accurate.

Rod
Logged

Greenville, IL
Offline Offline
Edison Member
*
Karma: 15
Posts: 1330
Warning Novice on board! 0 to 1 chance of errors!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Am I daft to think I can add a 240x4 LCD to display various values and status with a single arduino uno?

 I think you mean 40x4 or 20x4.   Either way, if you get a serial enabled LCD or one controlled by IC2 you won't need nearly as many pins.


Mark
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi nmracer,

How about a project update?  Did you use a particular kit or design for your WVO conversion?

I have a WVO conversion in my Suburban.  I am thinking an Arduino would be a good way to build a controller that is more flexible than the one I have now.  I would be very interested to hear from you or others on this subject.

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

BTW there is a similar discussion starting up at this WVO Forum:

http://wvodesigns.com/forum/showthread.php?100-help-building-a-wvo-controller/page2&highlight=arduino

And, I will let that WVO forum know about this thread.
Logged

Pages: [1]   Go Up
Jump to: