Arduino UNO unsure about coding

Thread Starter

ckinger

Joined Feb 6, 2017
13
Hello, I am doing a project of current measurement using the LEM LA 55-P ( hall effect sensor ) transducer which senses the strength of magnetic field produced by a current carrying conductor traveling through the hole of the sensor and outputs a linear milliamp output. I want to interface this sensor with an Arduino UNO but am not to certain about the code required. A little bit about the sensor, it can measure a primary current up to 50 Amps which will output 50 milliamps; I am going to have the output going to a 100ohm precision resistor so that 50mA max output will equal 5 volts; 50mA x 100 ohms = 5 volts. I want to then send this output to the Arduinos analog to digital converter, and have an LCD display wired to the Arduino, with a code stating that 5 volts input will display 50 Amps to the LCD, 1 volt will display 10 amps etc. basically every 0.1 Volt = 1 Amp. if anyone has any insight on how to go about writing this code it would be much appreciated, I don’t think it will be an overly complicated code but I have next to no experience with C++, Thanks for your help.
 

MrSoftware

Joined Oct 29, 2013
2,188
well, that didn't help at all
He pointed you to the analogRead() library function, which is how you read an analog voltage on an arduino (0-5v typically), and the LiquidCrystal library which simplifies displaying data on an LCD. Those are the 2 major requirements in your question. If that's not enough to get you going, then my suggestion is try some Arduino and C++ tutorials so that you get a basic understanding of each. Otherwise you're basically asking someone to write the code for you, which is fine if someone volunteers, but I don't think that's likely.
 

mcgyvr

Joined Oct 15, 2009
5,394
This should be code to get you started.. Then you just need to add code to show that value on the display you choose..

Code:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin 0:
  int sensorValue = analogRead(A0);
  // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
  float current = sensorValue * (5.0 / 102.3) ;
  // print out the value you read:
  Serial.println(current);
}
 
Top