Voltage to Frequency Converter with ATtiny85
In this project, I present a simple and efficient circuit based on an ATtiny85, capable of converting an analog voltage into a digital frequency (V/F). This small module allows me to measure the voltage of a solar panel, the battery voltage, and even the charging current, in a system where the grounds are not common (panel ground ≠ battery ground).
A common method is to transmit the measurement signals to an Arduino and save the data to an SD card for long-term analysis.
(If you are not using an SD card, see: Sending CSV reports via Bluetooth HC)
However, in some system configurations, the solar panel ground (GNDS) must not be connected to the battery ground.
This type of situation is common in off-grid solar systems and poses a major problem for my project :: Using the Arduino, I want to measure battery voltage (Vbattery) and solar voltage (Vsolar).
Therefore, a direct analog measurement of the solar voltage was not feasible without galvanic isolation.
Lacking a specialized circuit for my urgent need, I opted for an ATtiny85 to convert the solar voltage into a frequency.
This signal will then be transmitted through an optocoupler, ensuring perfect galvanic isolation.
The Arduino can then reconstruct the original voltage by measuring the input frequency.
Operating Principle
The ATtiny85 is powered by a 5V supply from a completely independent 18650 battery pack. The solar voltage (between 1.4 V and 15 V after a series protection diode) is applied via a 20 kΩ/10 kΩ voltage divider.
The microcontroller measures the divided voltage and generates a square wave signal whose frequency is proportional to the measured voltage.
This signal is passed through a 220 Ω series resistor to an SFH610-A optocoupler, ensuring complete galvanic isolation.
The optocoupler output is connected to a digital input of an Arduino board, which measures the frequency and records the reconstructed voltage value to an SD card (or in CSV-BT format).
The two systems remain completely isolated: the solar ground (GNDS) is not electrically connected to the Arduino ground.
Read me
Voltage-to-Frequency-Converter_EN
or lisez moi
Conversion-fréquence_-tension_FR
Code.ZIP
.ino : ATTINY85_MEASURE_SOLAR_CONVERT_FREQUENCY
: ARDUINO_CHECK_FREQUENCY_CONVERT_VOLT

Diskussion (0 Kommentare)