Skip to content

Operation Manual

David Arthur edited this page Apr 11, 2024 · 6 revisions

Hardware Setup

Required Parts and Tools

This guide assumes the use of 3d printed parts for mounting. Nylon standoffs and custom wooden parts are also usable.

  • 1x Assembled power board
  • 1x Assembled control board
  • 1x Raspberry Pi (4b or newer) †
  • 1x 12V to USB power module (e.g., DROK) †
  • 16-18 AWG wire and wire ferrules for USB module
  • 4x wire ferrules for ^ wire (optional)
  • 10 AWG wire for battery, power supply, and load wiring
  • 6x 10 AWG wire ferrules (optional)
  • 1x 10-pin ribbon cable
  • 1x 12-pin ribbon cable
  • 3d printed standoff for power board
  • 3d printed terminal guard for power board
  • 3d printed standoff for control board
  • 4x M4 bolts and 4x M4 threaded inserts
  • 4x M3 bolts and 4x M3 threaded inserts

Wire ferrules are optional, but recommended.

A soldering iron is required to install the threaded inserts into the 3d printed mounts.

† For TARPN installs, these parts are already present.

System Layout

Since we are dealing with large capacity DC batteries and heavy gauge wire, it is recommended to mount the two boards before attaching the wiring. The power board can be mounted horizontally or vertically. If mounting vertically, it should be oriented with the terminal lugs facing down. If mounted horizontally, the lugs should face away from the operator. This reduces the change of an arc or fire hazard if you or a cat drops a tool on the lugs.

A 3d-printed terminal guard can be installed to further reduce the risk of shorting the lugs.

TODO picture of power board. with shroud

The power board can by mounted mostly flush with a surface. For installations requiring a heatsink, it is best to leave an inch or so of clearance behind the board to accommodate a heatsink and allow for airflow.

TODO picture of 3d printed mount.

Mount the control board some place convenient to the operator. Typically, this will mean a vertical installation so the OLED display is easily visible. The two push buttons should be below the display with the knob to the right. The power and control boards will be connected with the 12-pin ribbon cable, so use that as a gauge for finding a a suitable mounting location for the control board.

The control board has two ribbon cables that are attached to the back of the board. It should be mounted with enough clearance to insert and remove those cables.

TODO picture of mounted control board.

Connections

I/O Connections

There are two ribbon cables employed by the system. One is a 12-pin ribbon connector between the power and control boards. The other is a 10-pin connector between the control board and the Raspberry Pi.

To accommodate the 10 pin ribbon connector on the RPi, pins 11 and 12 must be snipped or bent out of the way.

Power Connections

For a typical multi-port TARPN node, 10 AWG stranded wire is recommended. Stranded wire is more flexible and easier to work with. It is also what is recommended by the lug manufacturer. The stranded wire can be used directly or with wire ferrules. Ferrules make things a bit easier to work with and give the wiring a nice finished look.

The lugs should be torqued to 20 in-lb (2.26 N-m) which is approximately half-way between "good and tight" and "that ain't goin' nowhere". Give them a good pull after tightening to make sure they don't move.

The sequencing of power connections should be:

  1. Connect the loads to "Load +" and "Load -".
  2. Connect the PSU, while powered off, to "Supply +" and "Supply -".
  3. Connect the 12V regulator (e.g., DROK) to "12V RPi +/-".
  4. Connect the USB output from the 12V regulator to the power input for the RPi

At this point, nothing will be powered on. The load terminals and 12V RPi terminals should have roughly 0V. The next step will energize the system.

  1. Connect the battery to "Battery +" and "Battery -". There may be a small spark ⚡ as a result of inrush current.

Once the battery is connected, the whole system will power up. The RPi will be powered on through the offboard 12V regulator and the loads will be powered on.

⚠️ If the battery is disconnected abruptly, the whole system will immediately lose power. This can corrupt the RPi SD card.

Calibration

You will need:

  • A multimeter or volt meter
  • To dismount the control board

The BBD firmware includes several user configurable values which help improve the accuracy of the measurements made by the system.

On the control board, enter the menu system and select "Tune" (🔘 + ↩️ + 🔘). You will see "X1 Current Sense". Scroll through to see all seven "tunables".

  • X1: Current Sense. A scaling factor for the current shunt resistor R3. It should be set to 0.04 (20 * R3)
  • X2: Current Offset. A voltage offset provided by the reference voltage U1. It should be set to 2.486
  • X3: ADC Reference. A voltage reference provided by U5. Measured from AREF (typically 4.860)
  • X4: Voltage Factor. A scaling factor for the two resistor divider networks R1+R4 and R8+R11.
  • X5: Voltage Offset. A voltage offset for the resistor divider networks. Set this to 0.0
  • X6: Battery Factor. The same as X1, but for R36 (this may be deprecated in the future)
  • X7: Battery Offset. The same as X2, but for the battery current shunt (this may be deprecated in the future)

Taking Measurements

These steps require taking voltage measurements of a few test points on the power and control boards. To do this, use a multimeter in DC volts mode. Place the positive lead on the test point and the negative lead on a nearby ground. All of the plated mounting holes are connected to ground. There is also a labelled ground strip on each board.

ADC Reference (X3)

This is the most critical value to get right since it affects every measurement made by the system. Once the system is powered on, take a measurement of the "AREF" test point on the control board. Input this value as X3.

Voltage sensors (X4, X5)

In most cases this value will not need to be adjusted since we are using high precision resistors for the voltage dividers. The value of X4 should be set to 0.287. If different value resistors were used for assembly, calculate the value for X4 using:

R4 / (R1 + R4)

X5 should be initially set to 0.0. If there is some voltage drop through the ribbon cable, this value can be adjusted to account for that.

Current sensors (X1, X2, X6, X7)

There are two current sensors on the power board. One is for the load current (X1 and X2) and the other is for the battery current (X6 and X7).

On the power board PCB, there is a test point labelled "2.4V". Measure this with a multimeter (positive lead to the test point, negative lead to one of the mounting hole pads as a ground reference).

Set X2 and X7 to the measured "2.4V" voltage.

Set X1 and X6 to 0.04 (which should be the default value). If a different value resistor was used for R3 and R36, calculate new values for X1 and X6 as R * 20.

Theory of Operation

Bi-directional Power Switching

The inspiration for this project was Texas Instruments publication SLVA948 Achieve Bidirectional Control and Protection Through Back-to-Back Connected eFuse Devices. One or more bi-directional power switches are employed to control which supply is powering a load. The benefit of this approach is that the voltage sources are totally isolated when their corresponding switch is open. The bi-directionality of this circuit allows for battery charging through the switch using pulse-width modulation (i.e., a synchronous buck converter).

High powered D2PAK MOSFETs are used for their fast switching time, low "on" resistance, and good thermal properties.

In bench tests, the time to detect a power loss and switch to the battery is a little as 10s of microseconds. The majority of this time is actually spent in the microcontroller.

Current Sensing

There are two current sensors on the power board. One is for the current going out to the loads and the other is for current flowing out of (or into) the battery. Both sensors are identical, but are calibrated separately to account for differences in the trace routing, assembly, and the tolerance of the shunt resistor.

The sensor IC are INA181 current sense amplifiers. They give a fixed 20 times gain for the voltage measured across the shunt resistor.

The formula used by the firmware to calculate current is Ohm's law.

Measured Shunt Voltage = Current * (Shunt Resistance)

Since the measured voltage is the result of a 20x gain, we divide this by 20 to get the real current. The values X1 and X6 are a combination of the shunt resistance and the gain multiplier.

X1 = 20 * R3
X6 = 20 * R36

Reference

Pinouts

Control Cable

J14 and J15 are used for the 12-pin ribbon cable that connects the power board to control board.

Pin Signal Description
1 Ground System ground
2 5V Regulated 5V from U2
3 PSU PSU switch, active low
4 Batt Battery voltage sensor
5 BATT Battery switch, active low
6 Temp Temperature sensor
7 RPI Critical loads switch, active low
8 Load Load current sensor
9 Ground System ground
10 PSU PSU voltage sensor
11 Ground System ground
12 Chrg Battery current sensor

RaspberryPi Cable

J8 on the control board connects to pins 1 through 10 on the RaspberryPi.

Pin RPi signal Control board signal
1 +3V3 used for pullup of pin 5
2 +5V unused
3 GPIO 2 RPI_PWR (active low)
4 +5V unused
5 GPIO 3 RPI_SHUTDOWN (active low)
6 Ground Ground
7 GPIO 4 Reset†
8 GPIO 14 RXD (serial)
9 Ground Ground
10 GPIO 15 TXD (serial)

† This pin is sometimes cut on older TARPN installations. See below for workaround instructions.

The RPI_SHUTDOWN signal is used to trigger a shutdown of the RPi. When this signal is momentarily pulled low the RPi will perform a safe shutdown. A pull-up resistor between RPi pin 5 and RPi pin 1 is used to prevent this signal from floating.

The RPI_PWR is used to inform the control board whether or not the RPi has power. When this signal is low, the RPi is powered on. This signal allows the control board to determine when the RPi has powered off following a safe shutdown.

RXD and TXD are used for serial communication from the control board to the RPi. This is used for exporting telemetry from the control board.

If pin 7 has been cut, a separate jumper between an unused GPIO on the RPi and the RESET line on the control board will be needed. Pin 5 of the ISCP header can be used to solder one end of a jumper. When doing firmware uploads from the RPi, a different reset pin can be selected with the --gpio argument.