External Battery Monitor with ADC
The OcPoC has an interval voltage monitor, but its internal ADC cannot support analog voltages greater then 1V. This tutorial presents the setup required to read an external battery monitor through I2C.
What you'll need:
- Soldering Iron
- ADS1115 by adafruit - ADS1015 will work as well
- OcPoC Zynq Mini
- External Battery Monitor - we recommend the MAUCH 100 or 200A Hall Sensor
- Development Machine - we run Ubuntu 16.04, but any computer that can compile Ardupilot will work
- 4 Pin JST-GH to 4 single JST-RE connector - optional but highly recommended
- This tutorial shows a 4-pin JST-GH to separate 2.54mm Female pins from mRobotics
Putting the hardware together
The following process is lengthy, involves soldering, and a powerful LiPo battery. Practice proper soldering techniques. Practice safe battery handling.
- Remove the Mauch Hall Sensor from it's packaging. Solder your XT-60 connectors to the power module as shown in the picture below.
Make sure that the power goes in the square section of the XT-60 and ground goes into the triangle.
Test your connection with your battery, sensor, and airframe. Everything should act like normal - otherwise check all your connections.
The MAUCH Hall Sensor needs one of its 6-pin power connections to go to the OcPoC GPIO Pin 15 VCC pint (the middle pin). Connect at least one of it's ground connections to the ground rail on the GPIO pins (the ground rail is the top set of pins). Connect the 'current' pin to 'AD0' on the ADS1115 and 'voltage' to 'AD1'. See the picture below for explanation of wire colors from Mauch power module.
If properly wired, the Hall Sensor will light up blue when the battery is connected.
- Wiring the ADS to the OcPoC
Connect the header pins that came with the ADC, or the leads coming off the JST-GH ended cable, to the ADS1115. Remember the right-most connection is power, and the left-most connection is ground. Additionally connect the ADDR pin on the ADS1115 to a ground pin on the PWM header. Connect the JST-GH plug to Port 1 on the OcPoC
Before soldering, confirm that you have the correct wiring for an I2C connection
Plug going into OcPoC
Pin 1 (Left most) - Ground
Pin 2 - SDA
Pin 3 - SCL
Pin 4 (right most and usually red) -Power
If you ordered a MAUCH Hall sensor, it should come with a final calibrated set of coefficients for using it. You can either hardcode these coefficients in your source code or set them from the ground station parameters.
To hardcode the values into Ardupilot, open the file 'libraries/AP_BattMonitor/AP_BattMonitor_Analog.h' and change the coefficients in the following listing:
#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_OCPOC_ZYNQ # define AP_BATT_VOLT_PIN -1 # define AP_BATT_CURR_PIN -1 # define AP_BATT_VOLTDIVIDER_DEFAULT 10.04975f // V Divider << Change # define AP_BATT_CURR_AMP_PERVOLT_DEFAULT 33.05487f // A/V << Change #else # define AP_BATT_VOLT_PIN -1 # define AP_BATT_CURR_PIN -1 # define AP_BATT_VOLTDIVIDER_DEFAULT 10.1f # define AP_BATT_CURR_AMP_PERVOLT_DEFAULT 17.0f #endif
To set these parameters from the ground station, follow the steps for "Setup Through Mission Planner" provided in the ardupilot user guide.
Updated over 5 years ago