measuring current using analogRead() showing constant random values

I am using a current sensor to measure current.The input current is about 1A but still the output at LCD and serial is shows a constant random value(mostly 512 etc) between 0-1023.i know we have to scale the value .can u people help me out?
here is my code

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int sensorPin = A3;

// variable to store the value coming from the sensor

void setup() {
// set up the LCD’s number of columns and rows:
lcd.begin(16, 2);
pinMode(sensorPin, INPUT);
// Print a message to the LCD.


void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
float sensorValue;
lcd.setCursor(0, 1);
sensorValue = analogRead(sensorPin)/450;


Sounds like you have a floating input. Can you post a schematic of what you have wired up. Is the ground of your current source connected to the ground of the arduino?

yes exactly i am having a floating value and yes the ground is same

So are you going to post anything so we can spot your wiring error?

the schematic is same for the LCD display in the example with addition: 1.output of current sensor to pin A3 2.2nd to the ground(same as of arduino) 3.vcc(same as of arduino)

i need help very urgent because this is a part of my Final Year project…please

Sorry that description is not good enough for me to know what is going on. You mention a current sensor for the first tie in the thread, please link to it. But no schematic means I can't help, why can you not draw one?

Maybe some one else can help you without a schematic but my crystal ball is on the blink.


If the input current is 1A you would expect to get a raw reading of about 13.

This line:-

sensorValue = analogRead(sensorPin)/450;

Will produce a value of zero until you have an input of about 15Amps because it is an integer division first and only then is transferd to a floating point value. So if everything was working your code should be returning zero.

As it is not but it is returning a random value, it looks like either you have not wired it up like your schematic or your current sensor is not working. What do you get when you measure the voltage on A3 with your multimeter?