Arduino Forum

Using Arduino => Interfacing w/ Software on the Computer => Topic started by: 7896792575 on Apr 28, 2018, 08:52 pm

Title: Data plotting in Excel sheet from the Arduino UNO
Post by: 7896792575 on Apr 28, 2018, 08:52 pm
I am trying to Plot Transfer Characteristics of NPN Common Emitter BJT . collector emitter voltage  versus collector current in X-axis Versus Y-axis. Whileusing voltage and current of step 30, Then it gives the correct values in Excel sheet and when we reduced or increased the step size of 30, it gives very large error. Can anybody tell why it is happening? if it gives correct value at step of 30 then it should also give correct value at another step size. i am attaching program.



Code: [Select]
#include <rExcel.h>
//int           outputTiming = 1000;
long          idx = 1;
char          value[16];
int ini=0;

//float rnd;
rExcel        myExcel;
int pwmOut1=3;
int pwmOut2=11;
int  i,readValue1,readValue2,readValue3;
float VB[30],VBE[30],IB[30],VCE[30],IC[30];

void setup() {
 // put your setup code here, to run once:

Serial.begin(9600);
delay(1000);
myExcel.clearInput();
 //randomSeed(analogRead(5));
pinMode(pwmOut1, OUTPUT);
pinMode(pwmOut2, OUTPUT);
pinMode(A0, INPUT);
pinMode(A1, INPUT);
pinMode(A2, INPUT);
}

void loop()
{
 analogWrite(pwmOut1,204);

if (ini==0){
 idx=1;
  //analogWrite(pwmOut1,204);
for (i=ini; i<=255;)
{
 analogWrite(pwmOut2,i);
readValue1=analogRead(A0);
 readValue2=analogRead(A1);
  readValue3=analogRead(A2);
 VBE[i] = (5./1023.)*readValue1;
 VB[i] = (5./1023.)*readValue2;
 VCE[i] = (5./1023.)*readValue3;
 IB[i] = (VBE[i]-VB[i])*(1./660.);
 IC[i]=330*IB[i];

  myExcel.writeIndexed("bjtchar", idx, 1, idx);
   myExcel.writeIndexed("bjtchar", idx, 2, VCE[i],2 );
   myExcel.writeIndexed("bjtchar", idx, 3, IC[i],2 );
   
Serial.println(i);
i=i+30;
delay(500);
 idx++;
}
}

else {
 ini=i-30; idx--;
 for (i=ini; i>0;)
{
 
 analogWrite(pwmOut2,i);
readValue1=analogRead(A0);
 readValue2=analogRead(A1);
  readValue3=analogRead(A2);
 VBE[i] = (5./1023.)*readValue1;
 VB[i] = (5./1023.)*readValue2;
 VCE[i] = (5./1023.)*readValue3;
 IB[i] = (VBE[i]-VB[i])*(1./660.);
 IC[i]=330*IB[i];

  //myExcel.writeIndexed("bjtchar", idx, 1, idx);
   myExcel.writeIndexed("bjtchar", idx, 2, VCE[i],2 );
   myExcel.writeIndexed("bjtchar", idx, 3, IC[i],2 );
   Serial.println(i);
i=i-30;
delay(500);
 idx--;
}
}
}


Moderator: Code tags added.
Title: Re: Data plotting in Excel sheet from the Arduino UNO
Post by: jremington on Apr 28, 2018, 09:05 pm
Please edit your post to add code  tags, so that it

Code: [Select]
looks like this.
See the "How to use this forum" post.

Quote
it gives very large error.
Give details, please.

Post a link to where you downloaded the Excel library.
Title: Re: Data plotting in Excel sheet from the Arduino UNO
Post by: larryd on Apr 28, 2018, 09:16 pm
Show us a good schematic of your circuit. 
Show us a good image of your wiring.



Title: Re: Data plotting in Excel sheet from the Arduino UNO
Post by: 7896792575 on Apr 29, 2018, 08:20 pm
Actually i have downloaded a software named excel commander which is interfaced with Arduino and Excel 2013
Title: Re: Data plotting in Excel sheet from the Arduino UNO
Post by: ieee488 on Apr 30, 2018, 04:24 pm
Actually i have downloaded a software named excel commander which is interfaced with Arduino and Excel 2013
So what?


.