PSOC 5LP device'DAC producing staircase voltage ramp reading with Arduino UNO

Dear friends,
I am generating a staircase voltage ramp from a WaveDAC facility provided by PSOC 5LP 888 97 device fron Cypress Semiconductor incorporation and detecting its voltage by Arduino UNO using alaogRead (A0);. My actual objective is to take one reading when voltage is" stable" and" downstairs" say S1 while another reading when voltage is "stable" and "upstairs" say S2 and taking difference of both readings that is (S2 -S1). For this purpose I wrote an Arduino code that acquire 10 or more analogReadings and find just maximum and minimum of those and make subtraction to print differential voltage. However, the problem is my code only gives only one differential reading and keep showing the same even after running for minutes and don't gives next differential. while running the basic "Serial analogRead" example I confirmed that it gives nice staircase output ramp as produced by PSOC WaveDac. my voltage ramp is attached here along with the code. Kindly help me in this regard and if there is a better approach for solving this problem I am thankful as I am very new to programming.
l.


DPV_simple_with_time_and_min_and_max.ino (1.2 KB)

int max =0;
int min=1023;
int sV[9]={0,0,0,0,0,0,0,0,0};
int diff;
int i=0;
int new_Value;
int Start_increamenter;

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
while (!Serial);
new_Value=0;

Start_increamenter=0;
new_Value=0;

}

void loop() {
// put your main code here, to run repeatedly:

new_Value=analogRead(A0);
if(Start_increamenter<=9){

  sV[9]=sV[8];
  sV[8]=sV[7];
  sV[7]=sV[6];
  sV[6]=sV[5];
  sV[5]=sV[4];
  sV[4]=sV[3];
  sV[3]=sV[2];
  sV[2]=sV[1];
  sV[1]=sV[0];
  sV[0]=new_Value;
 
  Start_increamenter++;
  }
  else
  {
  min=1023;
for(i=0;i<=9;i++){
if(sV[i]<min){
  min=sV[i];
  Serial.println("min");

Serial.println(min);
}

max=0;
for(i=0;i<=9;i++){
if(sV[i]>max){
  max=sV[i];
   Serial.println("max");

Serial.println(max);
}

if(max/min>1.05){
  diff= max - min;
  Serial.println("diffrential");

Serial.println(diff);

}
}
}

}

}

I would integrate my output voltage and get rid of the steps. Your voltage then would follow your ramp. If you need the pulses you can integrate the signal via a simple sample circuit.

thankyou Gilshultzs for your comments however it is required to have pulses with a time period, step height and amplitude. Integrating and getting an integrated ramp is not required to proceede with.

I think the problem lies in the fact that you only store the first 10 samples in your sV array.
As soon as you have collected these 10 samples, you extract the min and max value, but you no longer update the array with new values...

1 Like

Did you check for real-time electrochemistry example?

hi Ektabanik,
I was scanning voltages for potassium ferricynanide in 1M KCl solution.
However, I find that a simple code by using delay() function can work. However, I an getting lots of single lined peaks.

Please guide in details -->>How to connect with PSoC 5LP & Arduino Uno (Schematic Diagram required).Detail code burning process.How you burn the code for the same.Required GUI & Hex file for visualization.

Can you share some clips for real sample analysis

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.