Language: EN

medir-voltajes-de-hasta-25v-con-arduino-y-fz0430

Measuring voltages up to 25V with Arduino and FZ0430

What is the FZ0430?

The FZ0430 is a commercial module that allows us to easily measure voltages up to 25V with a processor like Arduino.

As many of you will imagine, in reality the FZ0430 is a simple voltage divider with resistances of 30kOhm and 7.5kOhm, which means that the voltage perceived after the module is divided by a factor of 5 (7.5/(30+7.5))

Therefore, the maximum voltage we can measure will be 25V for a 5V Vcc supply voltage processor, and 16.5V for a 3.3V Vcc processor. Exceeding this voltage at the input of the FZ0430 will damage the analog pin of Arduino.

Of course, this expansion of the measurement range has a negative consequence on the precision of the measurement. In Arduino models that incorporate a 10-bit ADC powered at 5V, the normal resolution is 4.88mV. After the FZ0430, the resolution of the measurement is 24.41mV.

In the case of using a 25V load, the current that passes through the divider is 0.7mA, and the losses of the divider are 16.67mW.

Of course, we can build a voltage divider ourselves for a much lower price, and where we adjust the values of the resistors used to our project to minimize the loss of precision.

However, this module incorporates connection terminals and terminals to connect to Arduino easily and quickly, so it could be interesting to have a module for a quick and low-precision measurement.

For example, it can be useful for measuring the state of a battery, or checking the power supply of a 12V or 24V device, such as an LED strip, an electromagnet, a fan, or a Peltier plate.

It can also be interesting in combination with a 16-bit ADS, which has differential measurement to perform analog measurements in alternating current. With 15 dedicated bits + 1 for the sign, we have a precision of 0.15mV, which after the FZ0430 leaves a final precision of 0.76mV.

We can, for example, combine it with a 220V/12V transformer to make simple measurements of alternating voltage at 220V, to create an energy monitor.

Price

The 25V FZ0430 measurement module is an inexpensive device. We can find it for €0.75 from international sellers on eBay or AliExpress.

As we said, it is cheaper to assemble a voltage divider. The main advantage it provides us with is ease of use. If we take into account the cost of the connection terminal, the board, the Dupont terminals, and the assembly, it is probably cheaper to buy it than to make it.

However, in a definitive assembly, we will normally replace this module with a voltage divider integrated into our assembly, not only because of the cost, but also because of the space occupied and the possibility of adjusting the precision conveniently.

arduino-tension-25v-fz0430-componente

Assembly diagram

The connection scheme is very simple. On one hand, we connect the voltage we want to connect to the connection terminal, respecting the polarity.

On the other hand, we connect the module’s electronics to Arduino using the available terminals. Connecting Gnd and SIG of the FZ0430, respectively, to Gnd and any analog input of Arduino.

arduino-tension-25v-fz0430-esquema

The Vcc terminal does not need to be connected. In fact, it does absolutely nothing.

The connection, as seen from Arduino, would be as follows.

arduino-tension-25v-FZ0430-conexion

If we wanted to do the same thing by making the voltage divider ourselves, the scheme would be as follows.

arduino-tension-25v-FZ0430-funcionamiento

Code examples

The code is equally simple, as it is identical to what we would use to read an analog input, simply modifying the value of 5.0V to 25.0V.

const int sensorPin = A0;   // select the input for the sensor
int sensorValue;      // variable that stores the raw value (0 to 1023)
float value;        // variable that stores the voltage (0.0 to 25.0)

void setup() {
  Serial.begin(9600);
}

void loop() {
  sensorValue = analogRead(sensorPin);        // perform the reading
  value = fmap(sensorValue, 0, 1023, 0.0, 25.0);   // change scale to 0.0 - 25.0

  Serial.println(value);              // show the value by serial
  delay(1000);
}

// scale change between floats
float fmap(float x, float in_min, float in_max, float out_min, float out_max)
{
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}

Download the code

All the code in this post is available for download on Github. github-full