[SOLVED] CT sensor with Attiny85

Hello,

I am using the core posted here https://github.com/mchr3k/arduino-libs-manchester/downloads by mchr3k. I did so in order to get the Manchester library working.
As you may see below I'm troubleshooting the values by transmitting them wirelessly to another arduino and reading them there.

Thanks for your help.

//Basic energy monitoring sketch - by Trystan Lea
//Licenced under GNU General Public Licence more details here
// openenergymonitor.org


// for data TX using manchester coding library
#include <MANCHESTER.h>

#define TxPin 4  //the digital pin to use to transmit data
#define SensPin 0   //current sensor connected to A0 on AT Mega and on pin 3 on attiny85


//Sketch measures current only. 
//and then calculates useful values like
//apparent power and Irms.
//Apparent power is calculated from set Vrms.
double Vrms=234.0;

//Setup variables
int numberOfSamples = 3000;

//Set current input pin
int inPinI = 1;

//Current calibration coeficient
double ICAL = 0.1;

//Sample variables
int lastSampleI,sampleI;

//Filter variables
double lastFilteredI, filteredI;

//Power calculation variables
double sqI,sumI;

//Useful value variables
double apparentPower,
       Irms;
      
void setup()
{
//   Serial.begin(9600);
  MANCHESTER.SetTxPin(TxPin);
}

void loop()
{ 

for (int n=0; n<numberOfSamples; n++)
{

   //Used for offset removal
   lastSampleI=sampleI;
   
   //Read in current samples.   
   sampleI = analogRead(inPinI);
   
   //tx calculated value
   MANCHESTER.Transmit(sampleI);

   //Used for offset removal
   lastFilteredI = filteredI;
  
   //Digital high pass filters to remove 2.5V DC offset.
   filteredI = 0.996*(lastFilteredI+sampleI-lastSampleI);
      
   //Root-mean-square method current
   //1) square current values
   sqI = filteredI * filteredI;
   //2) sum 
   sumI += sqI;
}

//Calculation of the root of the mean of the current squared (rms)
//Calibration coeficients applied. 
Irms = ICAL*sqrt(sumI / numberOfSamples); 

//Calculation power values
apparentPower = Vrms * Irms;

//Serial.println(sumI / numberOfSamples);
//Serial.print(' ');
//Output to serial
//Serial.print(apparentPower);
//Serial.print(' ');
//Serial.println(Irms);

////tx calculated value
//MANCHESTER.Transmit(apparentPower);

//Reset current accumulator
sumI = 0;
}