Power Supply

Nets that are assigned the type power-supply can have the voltage or current on them directly controlled. Often these nets will be the main power source or charge source to a PCB.

Voltage Control

With Voltage control you can specify and hold a voltage on a specific net.

set_voltage.py
 from lager import Net, NetType

 main = Net.get('main_power',
         type=NetType.PowerSupply,
         setup_function=setup_nets,
         teardown_function=teardown_nets)

 main.set_voltage(3.3)
 print(f"Voltage:{main.voltage()}")
Set Voltage
 ~  lager supply main_power voltage 3.3 --dut 1
 Set voltage to 3.3V? [y/N]:
 ~  lager supply main_power enable --dut 1
 Enable Net? [y/N]:
 ~  lager supply main_power voltage
 Voltage: 3.3
 ~  lager supply main_power disable --dut 191
 Disable Net? [Y/n]:
 ~

Current Control

Similar to Voltage control, Current control allows you to set and maintain a constant current in a given net.

set_current.py
 from lager import Net, NetType

 main = Net.get('main_power',
         type=NetType.PowerSupply,
         setup_function=setup_nets,
         teardown_function=teardown_nets)

 main.set_current(0.25)
 print(f"Current:{main.current()}")
Set Current
 ~  lager supply main_power current 0.25 --dut 1
 Set current to 0.25A? [y/N]:
 ~  lager supply main_power enable --dut 1
 Enable Net? [y/N]:
 ~  lager supply main_power current
 Current: 0.25
 ~  lager supply main_power disable --dut 191
 Disable Net? [Y/n]:
 ~

Over Voltage and Current Protection

Over voltage and over current protections are important to make sure you don't damage the electronics on your board.

set_over_protections.py
 from lager import Net, NetType

 main = Net.get('main_power',
         type=NetType.PowerSupply,
         setup_function=setup_nets,
         teardown_function=teardown_nets)

 main.clear_ovp()
 main.clear_ocp()
 main.set_ovp(3.5) #Set over voltage limit to 3.5V
 main.set_ocp(.3) #Set over current limit to 300mA
Set Over Voltage and Over Current Protection
 ~  lager supply main_power voltage 3.3 --ovp 3.5 --ocp .3 --dut 1
 Set voltage to 3.3V? [y/N]:
 ~

Note

It is highly recommended to ALWAYS set an over current and over voltage limit when using a power-supply net.