COM Port-annoying

Hello people!!!

Hope you guys are doing really great! :)

Well I am working  on prototype where I am logging the data of 3 sensors from Arduino board to Excel using PLX DAQ macro...

The platform I am working on is ARDUINO UNO board , Windows 7 64 bit and and Excel 2010...

I have been facing a very upsetting problem.. Since I make 18-24 hour long experiments, therefore need the PLX DAQ  & Arduino to record the data for that much time. 

But I always notice that that after 4-5 hours they stop recording and then when I disconnect and connect it again, 

PLX DAQ shows the error as : [b]"StampDAQ could not connect. Check port settings".[/b]
ARDUINO IDE shows the error: [b]"COM Port already in use."[/b]

Here's my code:
[code
#include <Wire.h>

#define HYT221_ADDR 0x32

// for Temperature and Humidity
double Humidity;
double Temperature;

// These constants won't change.  They're used to give names
// to the pins used:
int analogInPin0 = A0;  // Analog input pins that the Refernece sensors are attached to
int analogInPin1 = A1;

int sensorValue0 = 0;        // value read from the pot
int sensorValue1 = 0;
int sensorMin = 1023;        // minimum sensor value
int sensorMax = 0;           // maximum sensor value


void setup() {
 pinMode(A0, INPUT);
 pinMode(A1, INPUT);

  // initialize serial communications at 9600 bps:
  Serial.begin(9600); 
  Serial.println("CLEARDATA");
  Serial.println("LABEL,Time, CO2concinvessel(%), CO2concintube(%), Humidity(%), Temperature(degC)");
  Wire.begin();             // join I2C bus
}

void getData(){
  // initiate measurement
  Wire.beginTransmission(HYT221_ADDR);
  Wire.write(0);
  Wire.available();
  int Ack = Wire.read(); // receive a byte

    Wire.endTransmission(); 
  //delay(1000); //This particular delay is the delay between the displayed values (in msec)...

  // READ DATA from here on
  Wire.beginTransmission(HYT221_ADDR);
  Wire.requestFrom(HYT221_ADDR,4);  //Reade 1 byte
  Wire.available();
  int b1 = Wire.read(); // receive a byte
  int b2 = Wire.read(); // receive a byte
  int b3 = Wire.read(); // receive a byte
  int b4 = Wire.read(); // receive a byte
  Wire.write(0); //NACK

  // combine the bits
  int RawHumidBin = b1 << 8 | b2;
  // compound bitwise to get 14 bit measurement first two bits
  // are status/stall bit (see intro text)
  RawHumidBin =  (RawHumidBin &= 0x3FFF); 
  Humidity = 100.0/pow(2,14)*RawHumidBin;

  b4 = (b4 &= 0x3F); //Mask away 2 least sign. bits see HYT 221 doc
  int RawTempBin = b3 << 6 | b4;
  Temperature = 165.0/pow(2,14)*RawTempBin-40;

  Wire.endTransmission();
}

void loop() {
  delay(1000);
  // read the analog in value:
  Serial.print("DATA,TIME,");
  sensorValue0 = analogRead(analogInPin0); 
  sensorValue1 = analogRead(analogInPin1);  
  float voltage0 = sensorValue0 * (5.000 / 1023.000);
  float voltage1 = sensorValue1 * (5.000 / 1023.000);
  getData();
  Serial.print(voltage0);
  Serial.print(",");
  Serial.print(voltage1);
  Serial.print(",");  
  Serial.print(Humidity);
  Serial.print(",");
  Serial.println(Temperature);
  
}]

I have tried changing to 5 different ports, I have tried reinstalling the drivers… I have tried to reinstall Arduino IDE… I have also changed yesterday from windows 7 to XP… But this problem is persisting.

What should be done further… I am clueless! :frowning:

Please help! Will deeply appreciate!

Regards

Pramit

Your problem statement is NOT code. It does NOT belong in a code box.

Sorryy!! my bad!! :smiley:

please find below the correct formulation:

Hello people!!!

Hope you guys are doing really great! :slight_smile:

Well I am working on prototype where I am logging the data of 3 sensors from Arduino board to Excel using PLX DAQ macro…

The platform I am working on is ARDUINO UNO board , Windows 7 64 bit and and Excel 2010…

I have been facing a very upsetting problem… Since I make 18-24 hour long experiments, therefore need the PLX DAQ & Arduino to record the data for that much time.

But I always notice that that after 4-5 hours they stop recording and then when I disconnect and connect it again,

PLX DAQ shows the error as : “StampDAQ could not connect. Check port settings”.
ARDUINO IDE shows the error: "COM Port already in use."

#include <Wire.h>

#define HYT221_ADDR 0x32

// for Temperature and Humidity
double Humidity;
double Temperature;

// These constants won't change.  They're used to give names
// to the pins used:
int analogInPin0 = A0;  // Analog input pins that the Refernece sensors are attached to
int analogInPin1 = A1;

int sensorValue0 = 0;        // value read from the pot
int sensorValue1 = 0;
int sensorMin = 1023;        // minimum sensor value
int sensorMax = 0;           // maximum sensor value


void setup() {
 pinMode(A0, INPUT);
 pinMode(A1, INPUT);

  // initialize serial communications at 9600 bps:
  Serial.begin(9600); 
  Serial.println("CLEARDATA");
  Serial.println("LABEL,Time, CO2concinvessel(%), CO2concintube(%), Humidity(%), Temperature(degC)");
  Wire.begin();             // join I2C bus
}

void getData(){
  // initiate measurement
  Wire.beginTransmission(HYT221_ADDR);
  Wire.write(0);
  Wire.available();
  int Ack = Wire.read(); // receive a byte

    Wire.endTransmission(); 
  //delay(1000); //This particular delay is the delay between the displayed values (in msec)...

  // READ DATA from here on
  Wire.beginTransmission(HYT221_ADDR);
  Wire.requestFrom(HYT221_ADDR,4);  //Reade 1 byte
  Wire.available();
  int b1 = Wire.read(); // receive a byte
  int b2 = Wire.read(); // receive a byte
  int b3 = Wire.read(); // receive a byte
  int b4 = Wire.read(); // receive a byte
  Wire.write(0); //NACK

  // combine the bits
  int RawHumidBin = b1 << 8 | b2;
  // compound bitwise to get 14 bit measurement first two bits
  // are status/stall bit (see intro text)
  RawHumidBin =  (RawHumidBin &= 0x3FFF); 
  Humidity = 100.0/pow(2,14)*RawHumidBin;

  b4 = (b4 &= 0x3F); //Mask away 2 least sign. bits see HYT 221 doc
  int RawTempBin = b3 << 6 | b4;
  Temperature = 165.0/pow(2,14)*RawTempBin-40;

  Wire.endTransmission();
}

void loop() {
  delay(1000);
  // read the analog in value:
  Serial.print("DATA,TIME,");
  sensorValue0 = analogRead(analogInPin0); 
  sensorValue1 = analogRead(analogInPin1);  
  float voltage0 = sensorValue0 * (5.000 / 1023.000);
  float voltage1 = sensorValue1 * (5.000 / 1023.000);
  getData();
  Serial.print(voltage0);
  Serial.print(",");
  Serial.print(voltage1);
  Serial.print(",");  
  Serial.print(Humidity);
  Serial.print(",");
  Serial.println(Temperature);
  
}

I have tried changing to 5 different ports, I have tried reinstalling the drivers… I have tried to reinstall Arduino IDE… I have also changed yesterday from windows 7 to XP… But this problem is persisting.

What should be done further… I am clueless! :frowning:

Please help! Will deeply appreciate!

Regards

Pramit

I have tried changing to 5 different ports,

Did you do this in windows device manager? If not, open device manager and right click on the port assigned to the arduino, then click properties > port settings > advanced, and click on the com port number drop down. You may see a number of ports indicating in use, but most will be orphaned ports and can be selected for use if nothing is actually using that port. Crashes and such may make windows think the port is still in use, which results in windows assigning a new port to the arduino when it is plugged into the pc.