Circuit Details

American DJ SR P8 (the power strip), uses 12V relays to control each of its eight AC outlets. Each of these relays in turn represented by one pin in the Line In DB9 connector. We'll use reef-pi to generate the required 12V control signal for each of the 8 outlets This signal will be created in the controller enclosure and exposed via a DB9 connector. We can then connect the enclosure with the power strip using a DB9 cable. 

Internally, reef-pi will use one of the Raspberry Pi's GPIO for each outlet signal. Since Raspberry Pi GPIO produces 3.3V, we'll use a ULN2803 Darlington transistor to convert it to 12V. ULN2803 is an 8 channel Darlington transistor which works out perfectly.

Following is the pinout of ULN2803A, we'll connect each of the In pin to a Raspberry Pi GPIO pin, and Out pin to DB9 connector. COM will be connected to 12V and 0V to common GND (shared across LM2596, ULN2803A, and Raspberry Pi). ULN2803A is a sink type driver, hence we'll connect 12V power to the GND pin of the DB9 connector.

With the power strip control circuit operating at 12V and Raspberry Pi at 5V, we'll need a power source for each of this. Though it is possible to power them separately, it's inconvenient. We'll use a single 12V power supply and an LM2596 buck converted to convert 12V to 5V (you can use a 12V to 5V UBEC as well).

The LM2596 module allows variable voltage step down using the trimmer. Before wiring it to the rest of the circuit, tune it to generate 5V output by rotating the trimmer screw. LM2596 modules are cheap and effective in stepping down anywhere from 30V to 3.3V at 2.5A

This is the fritzing breadboard view of the entire circuit. We are using a perma proto hat to mount ULN2803. Notice the DB9 connector exposing 8 12V control signal, and a barrel jack connector for 12V power source. The ULN2803A circuit is built on top of a PermaProto HAT, which also used to build a 12V rail to connect power source (barrel jack), LM2596 input pin, DB9 connectors GND pin (since ULN2803 is a sink type driver).


This entire circuit will be housed inside the enclosure. Female barrel jack connector will be used to connect power source with enclosure, and db9 connector for the powerstrip.  ULN2803 circuit will be built on top of a PermaProto HAT.

Before starting soldering or drilling the plastic enclosure, arrange all the main components (connectors, pi, PermaProto HAT) to get a tentative idea. We'll use same arrangements to draw the drilling holes for the standoffs in next section.

Prepare Connectors

All connectors (DB9 and barrel jack) will be wired with the PermaProto HAT using jumper wires. For this, I start with male-female jumper wires, then strip off the male end, tin it with soldering iron

We'll be powering this build with DC 2.1 barrel jack connector based 12V power supply.  A panel mount female barrel jack connector is fixed on the controller housing. 


Solder the jumper wires to the barrel connector. I prefer to use appropriate colored (red for +Ve, black for GND) jumper wires for individual pins. This simplifies understanding the overall circuit.

To determine the +Ve and GND pins in barrel connectors, I generally plug in the power source and use a multimeter to identify which pins represents +Ve and GND. 

The DB9 connector we are using has screw terminals, we can simply screw in one end of the jumper wire while the other end can be connected to male headers (that connected to ULN2803A output pin).

It's OK to use other types (not screw terminal) of DB9 terminals as well.

Use PermProto HAT to Mount ULN2803A

On the Perma Proto HAT, ULN2803 is mounted using a 18 pin IC socket, which is soldered on the HAT. Pi GPIO pins are connected to ULN2803 input pins using  22 AWG solid core jumper wires. We'll also solder male header pins for each of the output of ULN2803, as well as COM.

Connect 8 individual GPIO with each of the In pins of ULN2803A.

Solder male header pins to LM2596 module.  We'll use female-female jumper wires to connect the input pin of this module with 12V rail on PermaProto HAT. The output pins will be connected back to PermProto HAT's 5V rail. It is safe to connect all GND together (LM2596 can share a common input and output GND).

Solder male header pins to LM2596 module. We'll use female-female jumper wires to connect the input pin of this module with 12V rail on PermaProto HAT. The output pins will be connected back to PermProto HAT's 5V rail. It is safe to connect all GND together (LM2596 can share a common input and output GND).

Adjust the LM2596 module for precisely 5.1 V output. For this, connect the 12V power source to the input pin (use the barrel connector we have built in the earlier step) and a multimeter (with alligator clip) to the output pin. Rotate the trimmer pot screw till multimeter indicates 5.1-5.2V. LM2596 is fairly precise, you should be able to configure exactly 5.1V.

We have not built the housing yet, but for reference, this is the final state we are looking at. You don't have to follow the exact layout, thanks to the PermaProto HAT's design, there's plenty other ways to construct this, as long as the connections are proper (follow the breadboard schematic), we are good. Notice the 12V rails on PermaProto HAT, a set of 3 male header pins located in the same column as ULN2803A pin 10 or COM pin. The right side of the PermaProto HAT has male header pins for GND. In the build image below, I have passed the red jumper wires beneath the PermaProto HAT to reduce visual clutter 

This guide was first published on Sep 18, 2018. It was last updated on Mar 08, 2024.

This page (Circuit Construction) was last updated on Mar 08, 2024.

Text editor powered by tinymce.