Skip to content

Commit

Permalink
Cleaner config
Browse files Browse the repository at this point in the history
inop instead of open and short
  • Loading branch information
tomcourt authored and tomcourt committed Jun 23, 2017
1 parent f19049b commit d926332
Show file tree
Hide file tree
Showing 8 changed files with 203 additions and 161 deletions.
67 changes: 37 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ The engine sensors themselves are fairly generic. The default configuration uses

## Software

On the tablet, attach to the Stratux network, use the browser to navigate to 192.168.0.111, save the link to the home page. Go to the home screen and press the Enguino icon, the web page will open up in full screen.

The firmware is installed on the Arduino using the Arduino IDE. First install the [Arduino IDE]. Add the Ethernet 2 libary **TBD** add detailed instructions. Then download the [Enguino source code]. Any configuration must be done before installing the firmware. Configuration involves editing the config.h file. After editing the configuration, connect the Arduino to your PC via a USB cable. This will also power up the Arduino and a green light will appear next to the USB connector. Start up the Arduino software on your PC. Go `File`, `Open` and select the file `enigno.ino`. Then go `Sketch` and `Upload`. The other green LED next to the power LED will flash until the file is uploaded. Done Uploading will appear near the bottom of the window.

## Configuration
Expand Down Expand Up @@ -71,11 +73,10 @@ Scroll to bottom and add

net.ipv4.ip_forward=1


Ctrl-o, enter, ctrl-x

Reboot.
Connect to stratux network again.
Connect to Stratux wireless network again.
Browse to 192.168.10.1, confirm Stratux control panel shows up.
Browse to 192.168.0.111, confirm Engiuno panel shows up.

Expand All @@ -89,22 +90,22 @@ The supply is rated for 1000 ma. The Leonardo uses 82 mA. Testing will need to b

**Leonardo Pins Mapping to ATmega 32U4**

| Arduino | 32U4 | Use |IRQ|Analog|Counter|
|---------|-------|-----------|---|------|-------|
| D0 | PD2 | Serial RX | * | | |
| D1 | PD3 | Serial TX | * | | |
| D2 | PD1 | SDA | * | | |
| D3 | PD0 | SCL/PWM | * | | |
| D4 | PD4 | TC Mux A0 | | * | * |
| D5 | PC6 | TC Mux A1 | | | |
| D6 | PD7 | TC Mux A2 | | * | * |
| D7 | PE6 | TC Mux EN | * | | |
| D8 | PB4 | TC CS | | * | |
| D9 | PB5 | Analog 9 | | * | |
| D10 | PB6 | Ether CS | | * | |
| D11 | PB7 | PWM | | | |
| D12 | PD6 | TC MISO | | * | |
| D13 | PC7 | TC SCLK | | | ||
| Arduino | 32U4 | Use |IRQ|Analog|Counter|
|---------|-------|-------------|---|------|-------|
| D0 | PD2 | Serial RX | * | | |
| D1 | PD3 | Serial TX | * | | |
| D2 | PD1 | SDA | * | | |
| D3 | PD0 | SCL/PWM | * | | |
| D4 | PD4 | TC Mux A0 | | * | * |
| D5 | PC6 | TC Mux A1 | | | |
| D6 | PD7 | TC Mux A2 | | * | * |
| D7 | PE6 | TC Mux EN | * | | |
| D8 | PB4 | TC CS | | * | |
| D9 | PB5 | Analog 9 | | * | |
| D10 | PB6 | Ether CS | | * | |
| D11 | PB7 | PWM | | | |
| D12 | PD6 | TC MISO | | * | |
| D13 | PC7 | TC SCLK/LED | | | ||

The D6 and D12 pins support counters which would be useful for the tach and fuel flow. But the thermocouple board also conflicts with this.

Expand All @@ -124,9 +125,9 @@ The main webpage has a timer running in Javascript on the tablet that invokes a

### Sensors

The sensor system is fairly generic but currently only Van's Aircraft engine sensors have predefined configurations. The resistive sensors will have a 240 ohm(1%) pull up to Vcc. This will require up to 18 ma per sensor, or for the typical 5 sensors (fuel x 2, oil-p, oil-t, fuel-p) 90 ma total. This provides a good compromise between power usage, heat and loss of resolution. This provides 9 bits of resolution. To limit resistor heating to reasonable levels, .5 watt resistors should be used. Resistor temp. rise should be no more than 100 deg. C in free air. A resistance < 16 ohms will register as a short failure. > 480 ohms will register as an open failure. To convert from ADC units to ohms use this formula `ohms = 240 * (adc / (1024-adc))`.
The sensor system is fairly generic but currently only Van's Aircraft engine sensors have predefined configurations. The resistive sensors will have a 240 ohm(1%) pull up to Vcc. This will require up to 18 ma per sensor, or for the typical 5 sensors (fuel x 2, oil-p, oil-t, fuel-p) 90 ma total. This provides a good compromise between power usage, heat and loss of resolution. This provides 9 bits of resolution. To limit resistor heating to reasonable levels, .5 watt resistors should be used. Resistor temp. rise should be no more than 100 deg. C in free air. A resistance < 16 ohms will register as a short failure. > 480 ohms will register as an open failure. To convert from ADC units to ohms use this formula `ohms = 240 * (adc / (1024-adc))`, this will require long divided by long division unfortunately or a lookup/interpolation table.

All but the oil-temp sensor are 33.5-240 ohm sensors. The scale is as follow: zero=240, half=103, full=33.5 ohms. The oil temperature sensor (for a Rochester 3080-37) as follows (degF=ohms): 100=497, 150=179, 200=72, 250=34. This is a thermistor. Using a Steinhar-Hart calculator the conversion formula becomes `degrees Kelvin = 1 / (0.0016207535760566691 + 0.0002609330007304247 * log(R) + -1.0278556187396396e-7 * log(R)^3)`. A lookup table will certainly be required.
All but the oil-temp sensor are 33.5-240 ohm sensors. These usually scale linearly by resistance. Some may scale closer to ADC counts as follow: zero=240ohm/511adc, half=103ohm/716adc, full=33.5ohm/898adc. The oil temperature sensor (for a Rochester 3080-37) as follows (degF=ohms): 100=497, 150=179, 200=72, 250=34. This is a thermistor. Using a Steinhar-Hart calculator the conversion formula becomes `degrees Kelvin = 1 / (0.0016207535760566691 + 0.0002609330007304247 * log(R) + -1.0278556187396396e-7 * log(R)^3)`. A lookup table will certainly be required.

For resistive sensors still attached to the gauge, the gauge itself provides the pull up resistance and voltage. For Vans Aircraft engine instruments the pull up is 5 volts and the resistor is about 227 ohms(measured externally, internally the resistor appears to be 240 ohms, 5%). The pin can be directly connected if the voltage can't exceed Vcc by more than .5v. Otherwise a series resistor as discussed later could be attached to isolate the pin.

Expand Down Expand Up @@ -178,25 +179,32 @@ Other messages would include:
To prevent having to re-acknowledge warnings there would be both temporal and range hysteresis built in.

### Parts list
* Arduino Leonardo ETH ($46 amazon)
* Thermocouple Multiplexer Shield ($50 electronics123)
* Arduino Stackable Header Kit - R3 ($1.50 sparkfun)
* Break Away Headers - Straight ($1.50 sparkfun)
* More digikey parts - make above parts digikey as well
* Note - stackable headers are Samtec SAM1206-#pins-ND, no workable shorter lengths available
* --- Arduino Leonardo ETH - Digikey 1050-1007-ND
* --- Thermocouple Multiplexer Shield ($50 electronics123)
* Bicolor LED - Digikey 754-1232-ND
* T 1 3/4 LED holder for panel - Digikey 67-1332-ND
* 2 Adafruit 7 segment displays - Digikey 1528-1473-ND
* 10 240 ohm 1% resistors - Digikey A121513CT-ND
* 15K ohm 5% resistors - Digikey
* 3K ohm 1% resistor - Digikey 3.01KXBK-ND
* 1k ohm 1% resistor - Digikey 1.00KXBK-ND
* 10 input screw terminal block - Digikey ED10567-ND
* .025 square breakaway headers - Digikey 929647-04-35-ND - will probably work well on the thermocouple board w/o a header extension.
* 500 ohm potentiometer - Digikey 987-1738-ND - used to simulate a resistive sensor to determine transfer function
* Resistor decade/substitution box, ~$32 Amazon
* jack for auxiliary display 6 pin - Digikey 455-2271-ND
* header for auxiliary display 6 pin - Digikey 455-2218-ND
* contacts for header x 10 - Digikey 455-1135-1-ND
* pushbutton switch - Digikey EG2015-ND
* K style thermocouple wire, 24-26 gauge, EBay

### Future stuff
* It may be possible to support 2 thermocouples without the thermocouple multiplexer shield by using the differential mode ADC, 40x gain and a thermistor. Only 8 bits are usable with 40x. 488 uV per count works out to 21.5 deg. F resolution with a K type thermocouple. The 2.56 volt internal reference would double the resolution and oversampling could probably double it again.
* The Arduino Yun would support airplanes lacking a Stratux. The code would need to use the 'bridge' objects instead of the ethernet objects. Use #ifdef AVR_YUN to flex the code.
* Themes - a dark theme could be created easily enough by adjusting the styles. A larger text theme for the gauges would involve more defines and stringizing them for the SVG.
* Warning lights instead of auxillary display? A board with 4 caution/warning LEDs (red/green common cathode [bicolor LED]). Turning red and green on produces yellow. Alternatively use a module like the [BOB-13884] to provide 3 RGB LED's.
* Use digitalFastWrite for smaller code - https://github.com/NicksonYap/digitalWriteFast
* Create mult16x16to32 function for smaller code - https://github.com/rekka/avrmultiplication


### To be added
[open source]:https://en.wikipedia.org/wiki/Open-source_model
[Stratux]:http:https://stratux.me
[example]:http:https://www.tcourt.net/efis
Expand All @@ -210,4 +218,3 @@ To prevent having to re-acknowledge warnings there would be both temporal and ra
[BOB-13884]:https://www.sparkfun.com/products/13884
[7 segment LED displays]:https://www.adafruit.com/product/878
[14 segment LED display]:https://www.adafruit.com/product/1911
[Enguino source code]
39 changes: 28 additions & 11 deletions enguino/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,34 @@ const char *red = "red";
#define divisor 13 // 1<<13 = 8192, this allows factors between -2.0 to 1.999
// for the 0-1023 ADC values, multiply range by 8 for full scale

#define MX(x) (int)((x)*(1<<divisor) + 0.5)
#define GMX(range) (int)(1000.0 / (range) * (1<<divisor) + 0.5)
#define GB(low) (int)(-((low) + 0.5))
#define ADCtoV (5.0/1023.0) // multiply this by divider to get DC volts

const int thermistorADC[] = {};
const int thermistorC10[] = {};

const int resist240ADC[] = {};
const int resist240p1000[] = {};

// Sensor defintions and scaling
// -----------------------------
const Sensor opS = { st_volts, 0, 800, 0, 8008}; // 0 - 100
const Sensor otS = { st_volts, 50, 400, 0, 8008}; // 50 - 250
const Sensor vtS = { st_volts, 100 ,4000, 0, 8008}; // 100 - 600 (10 - 16)
const Sensor fpS = { st_volts, 0, 800, 0, 8008}; // 0 - 100 (0 - 10)
const Sensor flS = { st_volts, 0, 1280, 0, 8008}; // 0 - 160 (0 - 16)
const Sensor taS = { st_volts, 0, 12000, 0, 8008 }; // 0 - 3000
const Sensor maS = { st_volts, 100, 2000, 0, 8008}; // 100 - 350 (10 - 35)
const Sensor chS = { st_volts, 100, 3200, 0, 8008}; // 100 - 500, input is .25 C, convert to whole F
const Sensor egS = { st_volts, 1000,4800, 0, 8008}; // 1000 - 1600, input is .25 C, convert to to whole F
// Sensors are scaled using the formula: y = m * x + b, where y is either numeric value displayed or the gauge pointer postion.
// All of these numbers must be integers. Factors are represented as a ratio with an integer numerator and a denominator of 8192.
// Some numberic values are multipled by 10 and then have a decimal point added when displayed.
// The MX macro converts a floating point factor for m into an integer factor. The gauge pointers vary from 0 to 1000.
// Use GB() and GMX to set the graphs b and m values based on lowest input and input range (hi-low) respectively.
//
const Sensor opS = { st_r240to33, 0, MX(0.1), 0, MX(1.0)}; // 0 - 100
const Sensor otS = { st_r240to33, 50, MX(0.2), 0, MX(1.0)}; // 50 - 250
const Sensor vtS = { st_volts, 0, MX(ADCtoV*40), 0, 8008}; // 100 - 160 (10 - 16)
const Sensor fpS = { st_r240to33, 0, MX(0.1), 0, MX(1.0)}; // 0 - 100 (0 - 10)
const Sensor flS = { st_r240to33, 0, MX(0.16), 0, MX(1.0)}; // 0 - 160 (0 - 16)
const Sensor taS = { st_tachometer, 0, 12000, 0, 8008 }; // 0 - 3000
const Sensor maS = { st_volts, 100, 2000, 0, 8008}; // 100 - 350 (10 - 35)
const Sensor chS = { st_thermocouple, 32, MX(1.8/4), GB((100-32)*5./9.*4), GMX(400*5./9.*4)}; // 100 - 500, input is .25 C, convert to whole F
const Sensor egS = { st_thermocouple, 32, MX(1.8/4), GB((1000-32)*5./9.*4), GMX(600*5./9.*4)}; // 1000 - 1600,input is .25 C, convert to to whole F

// Labels
// ------
Expand Down Expand Up @@ -67,8 +84,8 @@ const Gauge gauges[] = {
{bank+3500, 0, gs_vert, 1, "", "VOLT", "volt", vtLV, vtLP, N(vtLV), vtRC, vtRP, N(vtRC), &vtS, 2},
{bank+5250, 0, gs_vert, 1, "FUEL", "PRES", "psi", fpLV, fpLP, N(fpLV), fpRC, fpRP, N(fpRC), &fpS, 3},
{bank+7000, 0, gs_pair, 1, "FUEL", "", "gal", flLV, flLP, N(flLV), flRC, flRP, N(flRC), &flS, 4}, // pins 4 and 5
{100, 0, gs_round, 0, "TACH", "", "rpm", 0, 0, 0, taRC, taRP, N(taRC), &taS, 6},
{100, 3200, gs_round, 1, "MP", "", "in-hg", 0, 0, 0, maRC, maRP, N(maRC), &maS, 7},
{100, 0, gs_round, 0, "TACH", "", "rpm", 0, 0, 0, taRC, taRP, N(taRC), &taS, -1},
{100, 3200, gs_round, 1, "MP", "", "in-hg", 0, 0, 0, maRC, maRP, N(maRC), &maS, -1},
{3000, 6250, gs_horiz, 0, "CHT", "", "", chLV, chLP, N(chLV), chRC, chRP, N(chRC), &chS, 16},
{3000, 6250, gs_aux, 0, "EGT", "", "", egLV, egLP, N(egLV), 0, 0, 0, &egS, 20}
};
Expand Down
12 changes: 7 additions & 5 deletions enguino/egTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@

typedef const char * string;

enum SensorType {st_ohms, st_thermistor, st_volts, st_thermocouple};
// st_ohms - 320 - 2400 32-240 ohms in tenths
// st_thermistor - 300 - 3000 30-300 degrees F. in tenths
// st_volts - 0 - 1023 ADC units 4.88 mV/per
// st_thermocouple - 0 - 4000 0-1000 degrees C. in quarters
enum SensorType {st_r240to33, st_thermistor, st_volts, st_thermocouple, st_tachometer, st_fuelflow};
// st_r240to33 - 0 - 1000 proportional resistive sensor
// st_thermistor - 0 - 1500 degrees C. in tenths
// st_volts - 0 - 1023 ADC units 4.88 mV/per
// st_thermocouple - 0 - 4000 0-1000 degrees C. in quarters
// st_tachometer
// st_fuelflow

// for K style in deg. C, use a multiply of 4096 (0.25), offset 0
// for K style in deg. F, use a multiplier of 7373 (0.25 * 1.8), offset -32
Expand Down
Loading

0 comments on commit d926332

Please sign in to comment.