Arduino Megasquirt Library

This driver provides access to the MegaSquirt ECU with a level of abstraction above the MegaSquirt serial interface, enabling users with no knowledge of the MegaSquirt commands to access the register data easily without caring about the underlying communication required.

The MegaSquirt is a low cost engine control unit with support for fueling, ignition and idle control.

Wiring

The MegaSquirt is connected to the Arduino using the RS232 output on the MegaSquirt, a MAX232 chip, and the Serial interface on the arduino board.

Synopsis

 
#include >MegaSquirt.h<
void setup(){
 MegaSquirt::begin();
 
 byte status;
 String signature;
 status=MegaSquirt::signature(&signature);
 switch (status){
  case MS_COMM_SUCCESS:
   Serial.print("MegaSquirt Signature: ");
   Serial.println(signature);
   break;
  case MS_ERR_COMM_TIMEOUT:
   Serial.println(" FAILURE: Communication Timeout");
   break;
  case MS_ERR_COMM_OVERFLOW:
   Serial.println(" FAILURE: Communication Overflow");
   break;
  default:
   Serial.println(" FAILURE: Unknown Error"); 
 }

String revision;
 status=MegaSquirt::revision(&revision);

 uint16_t uptime;
 status=MegaSquirt::seconds(&uptime);

 MegaSquirtData registers;
 byte regTable[MS_TABLE_LENGTH];
 status=MegaSquirt::getData(regTable);

 registers.loadDAta(regTable);

 Serial.println(registers.lambda1()/10,DEC )
}

Download

You can download the ZIP file to import into the IDE here, or you can fork your own.

Fury Progress

Has been slow, lots of things getting in the way of moving forward, engine wiring has stalled, i can’t seem to find a fault, and am wondering if its the ECU. I also have an oil leak (Joy) from the o ring in the sump, so that needs to come off and be fixed.

I’ve been trying to get little jobs done, but have been plagued by broken parts, wrong sizes, shorts, the seven has current priority, but am aiming to get going again in a month or so. I am making progress with the dashboard though.

SDC10158

Electrical Wiring

I fitted the ECU, i opted to put it behind the scuttle as this is just the right distance to allow me to leave the shielded cables untouched as they are just the right length. I’ve trimmed the remaining wires down to size. I connected up the battery to it temporarily, the engine spins over but I get no fault code on the display, so I think i’ve really broken the wiring. At best it might be I’ve missed a wire to the ECU that the display needs, but knowing my luck, its more likely to be something more complex.

On further investigation there is now power to the power commander so I suspect I’ve made a dogs breakfast out of the various live circuits somewhere.