Go Down

Topic: ACS712 Using (Read 1 time) previous topic - next topic

raghul_emcee

sorry thats the wrong aref,the correct is 4.35v

Wawa

my aREF is 3.68v
And the 5volt pin?
And the sensor output?

raghul_emcee

which 5v pin are you asking about.?
my current ( CURRENT SENSOR ) reading is 430 and 431 without load alternatively
Code: [Select]
float amps = 0;
float maxAmps = 0;
float minAmps = 0;
float lastAmps = 0;
float noise = 0;
int analogInPin2=A0;
double in;
double resultV;
double meanV;

void setup() {
Serial.begin(9600);
}

void loop() {
 for(int i=0;i<20;i++)//mean
  {
  in=analogRead(analogInPin2);
  resultV=((2.1041057-(in*5)/1023))/.666+resultV;//cal V
  //delay(20);
  }
  meanV=resultV/20;
   
  Serial.println(meanV);
}

Wawa

which 5v pin are you asking about.?
Really?
To which three pins did you connect the sensor to.
High time you posted a picture.
Leo..

raghul_emcee

sensor vcc-arduino vin
sensor gnd-arduino gnd
out           - A0

raghul_emcee

i found the problem the voltage is very low for the current sensor,now i have supplied around 5v,now the reading is lik 510,509...i have done new code for that
Code: [Select]
/*
  Analog Input
 Demonstrates analog input by reading an analog sensor on analog pin 0 and
 turning on and off a light emitting diode(LED)  connected to digital pin 13.
 The amount of time the LED will be on and off depends on
 the value obtained by analogRead().

 The circuit:
 * Potentiometer attached to analog input 0
 * center pin of the potentiometer to the analog pin
 * one side pin (either one) to ground
 * the other side pin to +5V
 * LED anode (long leg) attached to digital output 13
 * LED cathode (short leg) attached to ground

 * Note: because most Arduinos have a built-in LED attached
 to pin 13 on the board, the LED is optional.


 Created by David Cuartielles
 modified 30 Aug 2011
 By Tom Igoe

 This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/AnalogInput

 */

int sensorPin = A0;    // select the input pin for the potentiometer
int sensorValue = 0;  // variable to store the value coming from the sensor

void setup() {
  // declare the ledPin as an OUTPUT:
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
}

void loop() {
 
  sensorValue = analogRead(sensorPin); 
  delay(250);
  double initialCurrent=(sensorValue*5);
  initialCurrent=initialCurrent/1024;
  double calculatedCurrent=(2.49-initialCurrent);
  double Sense=calculatedCurrent/.185;
  Serial.println(Sense);
 
}

output:Still no correct reading
reading using DMM=.35A,arduino=.125-.189
how to get correct reading?

Wawa

#21
Jan 27, 2016, 10:12 pm Last Edit: Jan 28, 2016, 12:48 am by Wawa
That sketch seems to be for a pot, and modded for a 10Amp sensor.
Not very good for a noisy ACS712.

You could make things easier for yourself (and the forum) by giving us the full picture.
Details about your Arduino, supply, and wiring, and a picture of the setup.
And answer every question. They are asked for a reason that might not yet be clear to you.
Leo..

Go Up