siddu1901
Newbie level 4

I'm making this Electric Impedance Tomography project on proteus and the code is in arduino Mega1280. The circuit is working fine. The problem is when I'm simulating the circuit on proteus, the input voltages coming to A0 pin are being printed as 0 for some reason. Even though when I put a probe on that wire and it shows the voltage, arduino is printing as zero. Can someone help me?
Here is the code:
Here is the link for the proteus file:
[Moderator action: removed link to external file server]
Here is the code:
C:
//library of the multiplexors
#include <CD74HC4067.h>
//library for calculating RMSvalues
#include <TrueRMS.h>
// loop period time in microseconds (time between samples)
#define LPERIOD 1000
// define the used ADC input channel
#define ADC_INPUT 0
// RMS window of 40 samples, means 2 periods at 50Hz
#define RMS_WINDOW 40
unsigned long nextLoop;
int adcVal;
int cnt=0;
// ADC full scale peak-to-peak is 5.00Volts
float VoltRange = 5.00;
// create an instance
Rms readRms ;
CD74HC4067 my_mux(22,23,24,25);
CD74HC4067 my_mux2(26,27,28,29);
CD74HC4067 my_mux3(30,31,32,33);
CD74HC4067 my_mux4(34,35,36,37);
void setup()
{
pinMode(A0, INPUT);
Serial.begin(9600);
Serial.println("LABEL,v");
Serial.print("DATA, ");
readRms.begin(VoltRange, RMS_WINDOW, ADC_10BIT, BLR_ON,CNT_SCAN);
readRms.start();
// Set the loop timer variable for the next loop interval.
//micros( ) Returns the number of microseconds since the Arduino board began running the current program.
nextLoop = micros() + LPERIOD;
//electrode 0 and 1//electrode 0 and 1
my_mux.channel(0);
my_mux2.channel(1);
for (int k=2;k<15;k++)
{
my_mux3.channel(k);
my_mux4.channel(k+1);
for(int i=0;i<500;i++)
{
// Read the ADC and remove the DC-offset
adcVal = analogRead(ADC_INPUT);
//take an instance again
readRms.update(adcVal);
cnt++;
//repeating the readings of one sample
if(cnt >= 500)
{
// publish every 0.5s
readRms.publish();
Serial.print(readRms.rmsVal,2);
Serial.println();
Serial.print("DATA, ");
cnt=0;
}
// wait until the end of the time interval
while(nextLoop > micros());
// set next loop time to current time + LOOP_PERIOD
nextLoop += LPERIOD;
}
}
}
void loop(){
}
Here is the link for the proteus file:
[Moderator action: removed link to external file server]
Last edited by a moderator: