JeeHell PackFlow2Arduino

Introduction

This software can control 12V FAN to use with JeeHell A320FMGS Homecockpit software. The FAN will be triggered based on the aircraft state (Bleed Air available, e.g.) and the PACK FLOW switch in the overhead. Mainly for cooling the cockpit. :O)

This package is based on two parts

  • Arduino Sketch (prepared for ARDUINO MEGA R3)
  • Software to communicate with A320FMGS (JeeHell) and the Arduino Board

I point out that the replica (especially in electrical circuits) happens at your own risk and I assume no liability for damages. This is a noncommercial documentation of my private work.

My project

See the documentation of my fan project using this software.

Scheme

Requirements

  • JeeHell A320GFMGS Software
  • JeeHell FSUIPC Hardwaremodule installed
  • FSUIPC 4/5 installed
  • Arduino Board (in my case Arduino MEGA R3, but other are possible)
  • FAN with PWM capabilties
  • 12V power to run the fan

Download

Changelog

  • 29.07.2018 v6
    • Arduino Sketch
      • Improvement of logic
    • Software
      • Improvements and better Error handling
  • 11.07.2018 v5
    • Latest Version

Installation

Arduino

Our Arduino needs the software code (Sketch) to know how to act. The Sketch defines the PINs for the PWM signal and the inputs in variables. If this changes by your configuration just change the variables. Keep in mind that the PIN for the FAN needs to be a PWM Output PIN:

int pin_PWM = 9;

The PINs for the Input of the „Pack Flow Switch“ needs to be Digital Inputs:

int pin_pFlowLO = 22; 
int pin_pFlowNORM = 24; 
int pin_pFlowHI = 26;

Arduino Code

int fanSpeed = 0;
int pin_PWM = 9;
int pin_pFlowLO = 22;
int pin_pFlowNORM = 24;
int pin_pFlowHI = 26;
int pin_Last = 0;
int pin = 0;
int runFan = 0;
String sendItem = "";

void setup() {
TCCR2B = TCCR2B & 0b11111000 | 0x01; // Setzt Timer1 (Pin 9 und 10) auf 31300Hz
pinMode(pin_PWM, OUTPUT);
pinMode(pin_pFlowLO, INPUT_PULLUP);
pinMode(pin_pFlowNORM, INPUT_PULLUP);
pinMode(pin_pFlowHI, INPUT_PULLUP);
Serial.begin(9600);
}

void loop() {

if (digitalRead(pin_pFlowLO) == LOW) {
sendItem = "pFlowLO"; 
sendPin(); 
}

if (digitalRead(pin_pFlowNORM) == LOW) {
sendItem = "pFlowNORM"; 
sendPin();
}

if (digitalRead(pin_pFlowHI) == LOW) {
sendItem = "pFlowHI";
sendPin();
}

String s = Serial.readString(); // get the character

if (s.indexOf("fanOn") >= 0 || runFan == 1) {
if (sendItem != "") {
Serial.println (sendItem);
runFan = -1; 
}

}

if (s.indexOf("fanOff") >= 0 || runFan == 0) {
analogWrite(pin_PWM, 0);
runFan = 0; 
} else {
analogWrite(pin_PWM, fanSpeed);
}

}

void sendPin() {
if (sendItem=="pFlowLO") {
pin = pin_pFlowLO;
fanSpeed = 64; 
}
if (sendItem=="pFlowNORM") {
pin = pin_pFlowNORM;
fanSpeed = 128; 
}
if (sendItem=="pFlowHI") {
pin = pin_pFlowHI;
fanSpeed = 255; 
}
if (pin != pin_Last) {
Serial.println (sendItem);
pin_Last = pin;
}
}

peroJeeHellPackFlow2Arduino.exe

My software only needs to be configured once by selecting the COM port. It needs a FSUIPC connection and a running simulator. Of course, the Arduino must be connected.