Look for in our Blog. You will find multiple applications, solutions, code examples. Navigate using the tag cloud or search using specific criteria

Voltage sensor FZ0430

General information and example of use

Introduction

In this post we will show you how the voltage sensor FZ0430 works and how to use it to read the input voltage. This sensor can be useful for measuring the status of a battery or checking the power of a 12 or 24 V device. 
 

 

Requirements


Voltage sensor FZ0430

The FZ0430 is a simple voltage divider with two resistors R1 = 30000 (30k) and R2 = 7500 (7.5k) Ohms. So the output voltage from the sensor is:

Vout (S) = 7.5/(30+7.5) Vin (Vcc)

Specifications:


Voltage Input Range DC (V)0 - 25 V 
Max Input Voltage (V)25 (Vcc = 5), 16.5 (Vcc = 3.3) V 
Voltage Detection Rang0.02445 - 25 V
Voltage Analog Resolution 0.00489 V 

Connection



INPUTSOUTPUTS
GND. This is where you connect the low side of the voltage you are measuring. This is the same point as your Arduino ground. S. This connects to your Arduino analog Input.
VCC. This is where you connect the high side of the voltage you are measuring+. Not connected (NC).

-. This connects to your Arduino ground. 


Example of use

In this example we read the Input voltage of the FZ0430 sensor by the analogic signal A1 of the Arduino. In the schematic below you can see the connection:

Code

Here you have the example code. This example prints the calculated current Input in A units:


#define FZ0430 A1 //Define an analog input where we read V_out from the FZ0430
#define R1 30000.0 //Define the two resistors of the voltage divider
#define R2 7500.0 

float v_out, v_in; //Define variables v_out and v_in as a float

void setup() {
  pinMode(FZ0430, INPUT); //Set pin A1 as Input to read the values from V_out
  Serial.begin(115200); //Set baud rate speed for the serial
}

void loop() {
  calculate_voltage(analogRead(FZ0430)); //Calculate voltage from de analog value of A1
  Serial.println("Voltatge: " + String(v_in)); //Print de Input Voltage 
}

void calculate_voltage(int16_t adc_v_out) {
  v_out = adc_v_out * (5.0/1024);//v = ADC_V_OUT * (Vcc/1024)
  v_in = v_out * ((R1 + R2) / R2); //Get the input voltage dividing by the voltage divider  
}