Standalone Data Aquasition System

Hello everyone,

I have been building a stand alone data aquasition system. The idea is to have something that can be strapped to an engine and collect data in harsh enviornments. I have built one using the Arduino and shields, but now I need something a bit more rugged. I have put together a design for a custom solution. It uses a Atmega 2560. I am on my second revision, and still having some trouble getting everything functioning. As of right now I have 3 thermocouples, and a RPM(12V hall effect sensor) working. I kind of got myself in over my head lol. If anyone is interested in helping I would be willing to ship you a board now, and one of each revision. Thanks!

The problems I am having are

1). The battery charging circuit is not working. I assume this is because it has no way to switch off the rest of the circuit when it is charging. I was thinking of adding some sort of transistor to do this.

2). I have 2 ADP1610 Step up converters. One steps up the 3.7V to 5V, And that goes into the nevt converter. This converter boost it up to 12V. This part of the circuit is pulling way to much current. The first converter gets extreamly hot! Both put out the proper voltage, but it is way to hot!(hot enough to melt solder). I tried changing inductor sizes, and adp switching speed, but no luck.

3). I have it wired for the gps, but run into problems when I try to get all the code working at the same time. The gps code, and the max6675 use the spi bus for communication.

4). Last thing is a wierd problem with the thermocouples. I had to put in a low pass filter to get them to work. The engine is a terrible ground and without the filter a charge builds up, and resets the chip.

Any help with this stuff would be greatly appreciated.

//1.0.3 Removed NAN.  
//This code is functional  
//Added sample rate at 1hz
//Removed DHT sensor.  now has RPM, and three thermocouples
//Resets rpm to zero when unit is off.
#include <SD.h>
#include "DHT.h"
#include <LiquidCrystal.h>
#include "max6675.h"

#define DHTPIN 43        // what pin we're connected to for amb, and humidity
#define DHTTYPE DHT22   // DHT 22  (AM2302)

const int chipSelect = 10; //for SD
File dataFile;

volatile int rpmcount;
unsigned int rpm;
unsigned long timeold;

//Next six lines are for the five thermocouple pins.
int thermoDO = 27;
int thermoCS = 29;
int thermoCLK = 31;
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);

int VPin = 39;           //This sets variables for 5V and Ground for humidity sensor
int GPin = 41;

float ThermtempA;        //Thermocouple temperatures.
float ThermtempB;         
float ThermtempC; 

int counter; //counter for thermocouples
long previousMillis = 0;        // will store last time data was writen
long interval = 800;           // sample rate ms.  Remember to take into account the 200ms delay.

int h = 0;
int t = 0;
//DHT dht(DHTPIN, DHTTYPE);

void setup() {
   Serial.begin(115200); //remember to check to see if this is fast enough for rpm input.
      
    attachInterrupt(0, rpm_fun, RISING);
         rpmcount = 0;
         rpm = 0;
         timeold = 0;
    int i=0;
    char filename[]="AC8Field.csv";
    
    digitalWrite(2, HIGH);

    //For multiplexer ADG608
    pinMode(39,OUTPUT);
    pinMode(A2,OUTPUT);
    pinMode(A4,OUTPUT);
    pinMode(A6,OUTPUT);
    digitalWrite(39,HIGH);//Enables adg608
  
    
         
    pinMode(SS, OUTPUT);//SD
    
    /*pinMode(VPin, OUTPUT);//Temp&Humidity
    digitalWrite(VPin, HIGH);//Sets pin 39 to 5V
    pinMode(GPin, OUTPUT);
    digitalWrite(GPin, LOW);//Sets pin 41 to Ground
    delay(1000);
    dht.begin();*/
    
    if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");
    // don't do anything more:
    while (1) ;
  }
  
  
  // Open up the file we're going to log to!
  dataFile = SD.open(filename, FILE_WRITE);
  if (! dataFile) {
    Serial.println("error opening datalog.txt");
    // Wait forever since we cant write data
    while (1);
    
  }
    
    Serial.println("SpkTemp, CarbTemp, AmbTemp, RPM");
    dataFile.println("SpkTemp, CarbTemp, AmbTemp, RPM");
    
    //set counter value for thermocouples
    counter=0;

}



void loop() {

 
  
   if (counter==0)
   {
     digitalWrite(A2,HIGH);//Sets to 1 1 0 channel B
     digitalWrite(A4,HIGH);
     digitalWrite(A6,LOW);

     ThermtempA = (thermocouple.readFahrenheit()-8.7654)/.9928;//calibrates thermocouple temp.
     counter++;
     //set variable "value" to value read from channel zero
   }
   else if (counter==1)
   {
     digitalWrite(A2,HIGH);//Sets to 1 0 0 channel C
     digitalWrite(A4,LOW);
     digitalWrite(A6,HIGH);

     ThermtempB = (thermocouple.readFahrenheit()-826.25)/.8295;//calibrates thermocouple temp.
     counter++;

   }
   
   else if (counter==2)
   {
     digitalWrite(A2,HIGH);//Sets to 1 1 1 channel A
     digitalWrite(A4,HIGH);
     digitalWrite(A6,HIGH);

     ThermtempC = (thermocouple.readFahrenheit()*1.1097)-508.53;//calibrates thermocouple temp.
     counter = 0;

   }
   
   
    if(rpmcount >= 50) { 
     //Update RPM every 50 counts, increase this for better RPM resolution,
     //decrease for faster update
     rpm = 60.0*1000/(millis() - timeold)*rpmcount;
     timeold = millis();
     rpmcount = 0; 
     }
   else if(rpmcount < 50){
     
               rpm = 60.0*1000/(millis() - timeold)*rpmcount;
if(rpm < 800){
  rpm = 0;
}
   }
  
  // Reading temperature or humidity takes about 250 milliseconds!
  // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  //float h = dht.readHumidity();
  //float t = dht.readTemperature();

            //Serial.println(timer); 
  unsigned long currentMillis = millis();
  if(currentMillis - previousMillis > interval) {
    // save the last time you blinked the LED 
    previousMillis = currentMillis;   
    
    
         Serial.print(ThermtempA); //Prints F=Thermocouple temp first
         Serial.print(","); 
         Serial.print(ThermtempB); //Prints F=Thermocouple temp first
         Serial.print(","); 
         Serial.print(ThermtempC); //Prints F=Thermocouple temp first 
         Serial.print(","); 
         Serial.println(rpm,DEC);
         
         
      dataFile.print(ThermtempA);
      dataFile.print(",");
      dataFile.print(ThermtempB);
      dataFile.print(",");
      dataFile.print(ThermtempC);
      dataFile.print(",");
      dataFile.println(rpm,DEC);

  }
                dataFile.flush();
                                    delay(200);

}
void rpm_fun()
 {
   rpmcount++;
   //Each rotation, this interrupt function is run twice
 }

I am ready to work on your project. I charge 1800 Euros per week.

Houser636:
4). Last thing is a wierd problem with the thermocouples. I had to put in a low pass filter to get them to work. The engine is a terrible ground and without the filter a charge builds up, and resets the chip.

Could you please tell what low pass filter values you used? I may have a similar problem reading CHT and EGT using MAX31855s.

Thanks,

Holger

Its a 3K ohm resistor, and a 10pf cap. This works good in the 0-10000 rpm range. The sensors must then be recalibrated in the code . I think most off the shelf thermocouple conditioning equipment use opti-isolators, but I have not tried these yet. Let me know if this work, or if you find a better solution.

Houser636:
Its a 3K ohm resistor, and a 10pf cap. This works good in the 0-10000 rpm range.

Thanks for the values. I'll report back with my findings. I'm testing on a 6300 rpm two stroke engine, and a 3000 rpm four stroke, both non-electronic ignition, vintage units.

Holger

I'm very interested in your project and wouldn't mind helping out but I am in South Africa. If you want to, you could send me your sketch and partslist and I'll see what info I can come up with for you?

Sent you a PM RudiAhlers