Arduino Voltage And Current Sensor 3~25V 0~3A (MAX471) [B145]




https://www.youtube.com/watch?v=iqT9ZTLlVZc


* GitHubhttps://github.com/rdiot/rdiot-b145.git


* Specs

This module can be used to test the current and voltage

The principle of voltage test based on principle of resistive voltage divider design, can make the red terminal connector input voltage to 5 times smaller

for Arduino analog input voltages up to 5 v, the voltage detection module input voltage not greater than 5Vx5=25V (if using 3.3V systems, input voltage not greater than 3.3Vx5=16.5V).for Arduino AVR chips have 10-bit AD, so this module simulates a resolution of 0.00489V (5V/1023), so the minimum voltage of input voltage detection module is 0.00489Vx5=0.02445V

The MAX471 chip on the board used to test the consume current of the load

Test Voltage range: DC3 - 25V (for Arduino work on 5V) or DC3 - 16.5V (for Arduino work on 3.3V)

Test Current range: DC0 - 3A

PCB Size: 22*21*7mm/0.86*0.82*0.27"

Quantity:1pc


* Content

- Connect

VT - A0

AT - A1

GND - GND

GND - GND


VIN - 3V~25V

GND - GND

VOUT - LOAD LED 12V VCC

GND - LOAD LED GND


- Key Code

#include <Wire.h> 

#include <LiquidCrystal_I2C.h>


#define VT_PIN A0 // connect VT

#define AT_PIN A1 // connect AT


#define ARDUINO_WORK_VOLTAGE 5.0


LiquidCrystal_I2C lcd(0x27,20,4);  // LCD2004


void setup()

{

  lcd.init();  // initialize the lcd 

  lcd.backlight();

  lcd.print("start LCD2004");


  delay(1000);


  lcd.clear();

}


void loop()

{

 

  lcd.setCursor(0,0);

  lcd.print("B145:MAX471");


  int vt_temp = analogRead(VT_PIN);

  int at_temp = analogRead(AT_PIN);


  double voltage = vt_temp * (ARDUINO_WORK_VOLTAGE / 1023.0) * 5;

  double current = at_temp * (ARDUINO_WORK_VOLTAGE / 1023.0);

  

  lcd.setCursor(0,1);

  lcd.print("Voltage= " + (String)voltage + "V  ");


  lcd.setCursor(0,2);

  lcd.print("Current= " + (String)current + "A  ");


  delay(500);

}



Posted by RDIoT
|