- Name : MAX471
- Description :
Small library for the MAX471 current and voltage sensor for the Arduino eco-system
- Current range 0-3 A
- Voltage range 3-25 V
- ATmega328 battery internal reference voltage supported.
- Author: Gavin Lyons
- Arduino IDE: 1.8.16
- Copyright: GNU GPL v3
- Example in a project
The library is included in the official Arduino library manger and the optimum way to install it is using the library manager which can be opened by the manage libraries option in Arduino IDE. Search "MAX471" in search bar of library manager to find it.
See link below for instruction for this and for the other methods too.
Installing Additional Arduino Libraries guide
Tested with the module pictured. There is a few different designs of this module and you can also purchase the MAX471 chip. Some of these modules don't have some or all of these components just breakout connectors so user must add them. The resistor divider network on board divides Vin (PSU) to VT, So we must multiply by 5 in software to "restore" value. This ratio is defined by RS_VOLT_DIVIDE define in header file. If using different resistor values this will have to be adjusted.
- VT = (R2/(R2+R1)) * Vin
- VT = (7.5K/37.5)* Vin
- VT*5 = Vin
The other resistor(2K) and a capacitor on current signal line (AT) for transient suppression.
- Connect two ADC pins to measure : voltage = VT & current = AT.
- Connect Vin(+RS) to external PSU to drive load.
- Connect Vout(-RS) to load/circuit/device under test.
Example file outputs data to Serial monitor. When declaring the constructor list, possible values for ADC resolution and Voltage reference(mV) are in keywords.txt. If user wishes to use a custom value not in this list , cast the custom int value to the relevant enum.
If user is using an ATmega328 based unit and wishes to use internal battery reference voltage. They can pass VCC_BAT to constructor. Using this requires calibration for best result. See notes in function header in cpp file for how to. If using another IC other than ATmega328 then comment out the define in header file to avoid compile errors.
Files
Src Files | Desc |
---|---|
MAX471.h | library header file |
MAX471.cpp | library source file |
MAX471_basic_usage | example file |