code update
0.1
Read the README.txt in the folder
where and what pins do we need to connect the pots and other stuff? (schematic of any sort?)
also, here is a basic schematic of the 555 timer i was saying we could use for testing the input frequency.
please see (555/556 Astable)
on this page:
http://www.kpsec.freeuk.com/555timer.htm
this way you can test this code
looks like a 500 - 5000 range for frequency...
ill need to see what the engine rpm is on the gen set i'm using...
any how. ill gather that other stuff up also...
thanks!!!
~Russ
First, this is
really cool:
https://www.youtube.com/watch?v=ALFYm_6IlX8Second, the code is setup to be easily configurable. Take a quick look at the "config.h" file:
/*
* Jonathan Frisch
* Basic Engine Control System
*
* Config.h
*
* This file sets the configuration for the
* compiled code.
*
* Note the output from the initializer for
* port 'A0'. This is the value to begin
* using for analog ports on Arduino.
* A0 = 54 on a Mega 2560.
*
* Times are in microseconds.
*/
/* This section defines various
* aspects of the ECS that are present
* in all compiles.
* Adding ".0" to the end makes it a
* float - very handy.
* SPARK_TIME_MIN will be used if no
* SPARK_TIME_POT present.
*/
#define SPARK_TIME_MIN 500.0
#define SPARK_TIME_MAX 50000.0
#define SPARK_VAR_ANG 60.0
#define TICKS_PER_REV 1.0
#define DEG_PER_RPM_TICK 360.0
#define RPM_FINE_TUNE 600000.0
#define SERIAL_SPEED 19200
#define ANALOG_MAX 1023
#define PWM_MAX 255
#define LONG_MAX 4294967295
/* This section contains the necessary
* inputs and outputs.
* To adjust the pin placement,
* change the number for the
* corresponding #define.
*/
#define SPARK 1
#define POS_REF 2
#define RPM 3
#define SPARK_ANG_POT 54
#define SET_BUTTON 4
/* This section turns on and off
* various functions and sencors.
* Simply comment it out to remove it
* using "//" at the beginning of the
* line.
*/
#define SPARK_TIME_POT 55
#define SPARK_ANG_MIN_POT 56
#define SPARK_ANG_MAX_POT 57
The first set of defines are for customizing for a given setup - leave those alone unless you are certain something should be changed.
The second set of defines are mandatory inputs. 1, 2, 3 and 4 correspond to digital inputs, and 54 is A0 on the Mega 2560. Adjust these numbers if you use a different board or input configuration.
SPARK is the output trigger that activates the spark. Run the sensor off the engine spark timing to both RPM and POS_REF (they are separate for advanced setups).
SPARK_ANG_POT adjusts the angle of the spark using a pot or similar. The spark angle will always be at or after the engine spark angle.
SET_BUTTON is used only once - when it is first cranked. The steps are simple - turn on Arduino, pull cord till the beginning of compression stroke, push set button, and then crank. It is there so there won't be sparks during intake.
The last set of defines are optional. If you don't use them, comment them out with a "//" at the beginning of the line(s). SPARK_TIME_POT is for adjusting length of spark using a pot or similar. SPARK_ANG_MIN_POT is for adjusting minimum adjustment angle of spark using a pot or similar - for fine tuning. SPARK_ANG_MAX_POT is for adjusting maximum adjustment angle of spark using a pot or similar - for fine tuning.
One catch I ran into is the length of time a spark lasts so I had to guess. I hope it's accurate.