Dealing with unreliable BeagleBone pin levels during boot
I presume based on the "mostly in the middle" remark, that this means the pins power up as inputs (rather than outputs), so they are basically high impedance and will float.

The solution is to use a level shifter (one which has a strong push-pull output) with a pull-down resistor (or pull-up if it is inverting) on the input of the level shifter, not the output. This will keep the output of the level shifter driven to a known state when the beaglebone I/O pins are inputs.



What level shifter you use is up to you. In fact if you are driving LEDs, you can make a level shifter with a single N-Channel logic level MOSFET (or NPN BJT with base resistor). The LED anode is connected via its current limit resistor to +5V, and then the cathode is connected to the drain of the MOSFET. The source of the MOSFET connected to GND. The gate is connected to the BB with a pull-down resistor. 







simulate this circuit &ndash; Schematic created using CircuitLab

You can do the same thing for a relay (put the relay in place of the LED in the above).