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.
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()}")
~ 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.
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()}")
~ 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.
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
~ 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.