Voltage Measurement Sensor(HAM6827)

아두위키 : Arduwiki
ArduWiki (토론 | 기여)님의 2024년 3월 24일 (일) 15:47 판 (Created page with "{{#seo:|title=아두위키 : 아두이노 전압 측정 센서(HAM6827) 가이드|title_mode=append|keywords=아두이노, 정보과학, 메이커학습, 수행평가, 전압 측정 센서(HAM6827), 아두이노 작품, 캡스톤작품, 아두이노 예제코드|description=아두이노로 전압 측정 센서(HAM6827)를 제어하는 방법(기본정보, 회로, 예제 코드)을 소개합니다. 정보과학과 메이커수업에 활용가능합니다.}} File:전압...")
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

The HAM6827 is a miniature module capable of measuring voltages up to 25V. Its small size makes it suitable for development of compact products. When used with an Arduino, it requires some calculations to convert the analog pin readings to voltage values.

Specifications

  • Input Voltage Range: DC 0V ~ 25V
  • Voltage Measurement Range: 0.02445V ~ 25V
  • Voltage Resolution: 0.00489V

Example Required Hardware

  • Arduino board
  • Jumper cables
  • Voltage Measurement Sensor
  • 9V Battery

Connection

  • Measuring a 9V Battery
Arduino Voltage Measurement Sensor 9V Battery
A0 S
GND -
VCC +
GND -
  • Measuring a 5V Battery
Arduino Voltage Measurement Sensor
5V VCC
GND -, GND
A0 S

Example Code

The example code measures the value from the voltage measurement sensor and applies it to a formula to output the actual voltage value. The formula converts the analog reading into a voltage by accounting for the internal resistances in the voltage measurement circuit.

double R1 = 30000.0;  // Internal resistance 1 of the voltage measurement sensor
double R2 = 7500.0;   // Internal resistance 2 of the voltage measurement sensor
double val = 0;
double vout = 0;

void setup() {
  Serial.begin(9600);
  Serial.println("Start");
}

void loop() {
  val = analogRead(A0);
  vout = ((val * 5.0) / 1023.0) / (R2 / (R1 + R2));  // Part that converts to voltage
  Serial.println(vout);
  delay(300);
}

Execution Results

  • 9v
  • 5v