Close

testing INA219 & MAX6682

A project log for Aruna - ROV

Modular ROV for underwater exploration, discovery and monitoring

noel-moeskopsNoeƫl Moeskops 09/10/2020 at 12:140 Comments

INA219

The INA219 is positioned on the power board to monitor the voltage and current of the 12V battery pack, communication goes over I²C. I used an Arduino sketch to test this sensor and it all worked the first try.

Multimeter left showing voltage (10.65 V) and multimeter on the right showing current (3.02 mA)
To monitor the correctness of the measured data I placed two multimeters in the circuit to measure the voltage and current. The left multimeter measured the voltage at 10.65 V. This is only a difference of 0.03 V between the control and the INA219 chip. The right multimeter measured a current flow of 3.02 mA. The INA measured a current of 5.40 mA, this is quite a big difference. But it is consistence with the difference of the voltage measurement: 0.03 V and ~0.02 A. The current is now ridiculously low because the components are also being powered by the debugger. When the debugger is disconnected the current rises on the multimeter. Because the UART of the FT2232H board I use also supplies power to the board is it difficult to get an accurate measurement. Later, when I write a driver for it, I can communicate the current over RS485 this problem would me mitigated and some proper testing with motors in place could be done. But so far it looks functional.
Bus Voltage:   10.62 V
Shunt Voltage: 0.54 mV
Load Voltage:  10.62 V
Current:       5.40 mA
Power:         59.00 mW

Serial output of the example code above.

MAX6682

The MAX chip converts thermistor temperature to digital data over SPI. This comes in handy for my external thermistor (YC100665). The chip takes care of self heating and power-supply noise and supplies a read-only 10bit SPI signal, very straight forward.

After reading the SPI documentation of the ESP-IDF it turned out that my assumption of "ESP-32 supports every hardware operation on every IO port" was incorrect. It turns out that there are two SPI IO sets for the ESP: HSPI and VSPI. HSPI is already in use by JTAG so only VSPI is left for mortals. Not using the VPSI pins is possible but at lower speeds and more delay. So not a total loss I though, until I found out that I was using an input only pin for the MOSI :( (also for one BLHeli Dshot output pin, but that was redundant anyway).  I changed the MOSI pin to IO2, since that was the only pin left, so I could at least still test the chip.

The Slave Select pin of the MAX6682 is connected to an output of an MC74HC138A demultiplexer. This allows for up to eight devices on the SPI bus by using SS0-2 pins for chip selection. My luck turned here and I could successfully read the MAX6682 via SPI (no thermistor attached).

Looking at the logic analyser the data does not seem to make a lot of sense. At least the MAX6682 is outputting data on the MISO line. More testing with the sensor attached needs to be done. But I'll leave that for later since I want to focus on more essential things first.

Discussions