This is the connections of the current sensor
https://www.seneca.it/en/linee-di-prodo ... dch300-lp/I connect the followings:
- the -ve port of current sensor to +ve of channel 4 on libelium shield and
- the +ve port of current sensor to +ve of Vout on libelium shield
the Positive of 12V DC motor through the Seneca's current sensor and to +ve 12V battery
The negative of 12V DC motor to ground of battery
// Include this library for using current loop functions.
#include <currentLoop.h>
#define CHANNEL CHANNEL4
void setup()
{
// Switch ON the 24V DC-DC converter
sensorBoard.ON();
// Inits the Serial for viewing data in the serial monitor
Serial.begin(115200);
delay(100);
Serial.println("Arduino 4-20mA board switched ON...");
}
Read with the example code from the library of libelium board as followings:
void loop()
{
// Get the sensor value in int format (0-1023)
int value = sensorBoard.readChannel(CHANNEL);
Serial.print("Int value read from channel 4 : ");
Serial.println(value);
// Get the sensor value as a voltage in Volts
float voltage = sensorBoard.readVoltage(CHANNEL);
Serial.print("Voltage value rad from channel 4 : ");
Serial.print(voltage);
Serial.println("V");
// Get the sensor value as a curren in mA
float current = sensorBoard.readCurrent(CHANNEL);
Serial.print("Current value read from channel 4 : ");
Serial.print(current);
Serial.println("mA");
Serial.println("***************************************");
Serial.print("\n");
delay(2000);
}