How to contribute
OhmPi is an open source system and contributions in terms of hardware and software are welcome. However, in order to maintain the project on tracks and promote exchange and reuse, it is necessary that contributors wishing to develop new software or hardware components follow a few basic steps detailed below. Contributors are also kindly asked to get in touch with the OhmPi developing team.
Developing hardware components
Here is a non exhaustive wish list of new hardware features that are planned/hoped to be developed in the future. Contributors are welcomed to join forces to make this list come true, or propose new ideas by creating a new issue in the Gitlab repository.
Wish list of hardware developments:
Automatic selection of shunt resistors in a set of shunt resistances (hardware)
Add analog low-pass filter on receiver (hardware)
Battery recharge manager for monitoring (hardware)
Multi-channel acquisition (hardware)
Control OhmPi via microcontroller (hardware)
Developing software features
If the new developments purely concern the software (e.g. bug fix, new acquisition strategy, etc.), then please follow the git best practices by first creating an new issue and then create a local branch linked to this issue. Once the new feature is implemented, a pull request can be initiated.
Here is a series of software developments that are planned/hoped:
Sequence generator (software)
Calculate time-variable SP effects (software)
Calculate IP from full-waveform (software)
Pseudo multi-channel acquisition (software)
Software interface to new hardware components
This section is intended for developers of a new hardware component as part of an OhmPi system.
It presents some advices and best practices that should help developing new hardware components to work within an OhmPi system.
Two cases should be distinguished when dealing with hardware development components:
1- Developments of a hardware component that comply with the way the OhmPi Hardware System works. Such developments typically focus on improving an existing component (reduce cost, improve performance, adapt range to specific applications, design with easily available parts…). The newly created hardware component will expose the minimal functionalities required by hardware_system for this type of component.
2- Developments of a hardware component that introduce changes in the way the OhmPi Hardware System works. Such developments do not only focus on improving a single component but also on the way to operate the system. A discussion with developers of the OhmPi_Hardware and OhmPi classes should be initiated at a very early stage to investigate the best ways to design and implement a working solution.
If you are dealing with case 1 or have designed a development path and strategy, you are ready to start.
First the hardware board/device should be conceived and designed. The Ohmpi team recommends that contributors design or import their boards within KiCAD and that both schemas and PCB are shared.
When developing a new component Class, always start your development in a new branch. 1- Create a new python file or make a copy and modify an existing similar component file. All hardware component modules are stored in the ohmpi/hardware_component directory. In the newly created python file, define a new class based on the relevant abstract class of abstract_hardware_components.py. Implement the abstract methods to interact with your hardware. Name the file according to the name of the component. Make sure to place this new python module in the ohmpi/hardware_component directory.
2- Create a new configuration file or make a copy and modify an existing configuration file. All existing config files are stored in the ohmpi/hardware_component directory. In this newly created config file, describe your system including the new component in the HARDWARE_CONFIG dictionary. Name it config_XXX.py where XXX should be replaced by an expression describing the system. Make sure to place your new config file in the ohmpi/configs directory.
3- Create a new script or make a copy and modify of an existing script for testing the component. In this script, write python code where you will conduct the tests of the required functionalities of the new component.
Hardware components API
- class ohmpi.hardware_components.abstract_hardware_components.CtlAbstract(**kwargs)
CTlAbstract Class Abstract class for controller
- Attributes:
- cpu_temperature
- class ohmpi.hardware_components.abstract_hardware_components.MuxAbstract(**kwargs)
MUXAbstract Class Abstract class for MUX
- Attributes:
- barrier
Methods
switch
([elec_dict, state, bypass_check])Switch a given list of electrodes with different roles.
switch_one
([elec, role, state])Switches one single relay.
test
(elec_dict[, activation_time])Method to test the multiplexer.
reset
- switch(elec_dict=None, state='off', bypass_check=False)
Switch a given list of electrodes with different roles. Electrodes with a value of 0 will be ignored.
- Parameters:
- elec_dictdictionary, optional
Dictionary of the form: {role: [list of electrodes]}.
- statestr, optional
Either ‘on’ or ‘off’.
- bypass_check: bool, optional
Bypasses checks for A==M or A==M or B==M or B==N (i.e. used for rs-check)
- abstract switch_one(elec=None, role=None, state=None)
Switches one single relay.
- Parameters:
- elec
- role
- statestr, optional
Either ‘on’ or ‘off’.
- test(elec_dict, activation_time=1.0)
Method to test the multiplexer.
- Parameters:
- elec_dictdictionary, optional
Dictionary of the form: {role: [list of electrodes]}.
- activation_timefloat, optional
Time in seconds during which the relays are activated.
- class ohmpi.hardware_components.abstract_hardware_components.PwrAbstract(**kwargs)
PwrAbstract Class Abstract class for Power module
- Attributes:
- current
- pwr_state
- voltage
Methods
battery_voltage
reload_settings
reset_voltage
- class ohmpi.hardware_components.abstract_hardware_components.RxAbstract(**kwargs)
RXAbstract Class Abstract class for RX
- Attributes:
Methods
gain_auto
reset_gain
- property bias
Gets the RX bias
- property latency
Gets the Rx latency
- abstract property voltage
Gets the voltage VMN in Volts
- class ohmpi.hardware_components.abstract_hardware_components.TxAbstract(**kwargs)
TxAbstract Class Abstract class for TX module
- Attributes:
Methods
inject
([polarity, injection_duration, ...])Abstract method to define injection.
voltage_pulse
([voltage, length, polarity])Generates a square voltage pulse
current_pulse
reset_gain
- abstract property current
Gets the current IAB in Amps
- abstract inject(polarity=1, injection_duration=None, switch_pwr=False)
Abstract method to define injection.
- Parameters:
- polarity: int, default 1
Injection polarity, can be eiter 1, 0 or -1.
- injection_duration: float, default None
Injection duration in seconds.
- switch_pwr: bool
Switch on and off tx.pwr.
- property latency
Gets the Tx latency
- property voltage
Gets the voltage VAB in Volts
- voltage_pulse(voltage=0.0, length=None, polarity=1)
Generates a square voltage pulse
- Parameters:
- voltage: float, optional
Voltage to apply in volts, tx_v_def is applied if omitted.
- length: float, optional
Length of the pulse in seconds
- polarity: 1,0,-1
Polarity of the pulse
- class ohmpi.hardware_components.mb_2023_0_X.Rx(**kwargs)
RX class
- Attributes:
bias
Gets the RX bias
- gain
latency
Gets the Rx latency
- sampling_rate
voltage
Gets the voltage VMN in Volts
Methods
gain_auto
reset_gain
- property voltage
Gets the voltage VMN in Volts
- class ohmpi.hardware_components.mb_2023_0_X.Tx(**kwargs)
Tx Class
- Attributes:
current
Gets the current IAB in Amps
- gain
- injection_duration
latency
Gets the Tx latency
- measuring
- polarity
- pwr_state
- tx_bat
voltage
Gets the voltage VAB in Volts
Methods
inject
([polarity, injection_duration, ...])Abstract method to define injection.
voltage_pulse
([voltage, length, polarity])Generates a square voltage pulse
current_pulse
gain_auto
reset_gain
- property current
Gets the current IAB in Amps
- inject(polarity=1, injection_duration=None, switch_pwr=False)
Abstract method to define injection.
- Parameters:
- polarity: int, default 1
Injection polarity, can be eiter 1, 0 or -1.
- injection_duration: float, default None
Injection duration in seconds.
- switch_pwr: bool
Switch on and off tx.pwr.
- voltage_pulse(voltage=None, length=None, polarity=1)
Generates a square voltage pulse
- Parameters:
- voltage: float, optional
Voltage to apply in volts, tx_v_def is applied if omitted.
- length: float, optional
Length of the pulse in seconds
- polarity: 1,0,-1
Polarity of the pulse
- class ohmpi.hardware_components.mb_2024_0_2.Rx(**kwargs)
RX Class
- Attributes:
bias
Gets the RX bias
- gain
latency
Gets the Rx latency
- sampling_rate
voltage
Gets the voltage VMN in Volts
Methods
gain_auto
reset_gain
- property voltage
Gets the voltage VMN in Volts
- class ohmpi.hardware_components.mb_2024_0_2.Tx(**kwargs)
TX Class
- Attributes:
current
Gets the current IAB in Amps
- gain
- injection_duration
latency
Gets the Tx latency
- measuring
- polarity
- pwr_state
- tx_bat
voltage
Gets the voltage VAB in Volts
Methods
inject
([polarity, injection_duration])Abstract method to define injection.
voltage_pulse
([voltage, length, polarity])Generates a square voltage pulse
current_pulse
gain_auto
reset_gain
- inject(polarity=1, injection_duration=None)
Abstract method to define injection.
- Parameters:
- polarity: int, default 1
Injection polarity, can be eiter 1, 0 or -1.
- injection_duration: float, default None
Injection duration in seconds.
- switch_pwr: bool
Switch on and off tx.pwr.
- class ohmpi.hardware_components.mux_2023_0_X.Mux(**kwargs)
- Attributes:
- barrier
Methods
switch
([elec_dict, state, bypass_check])Switch a given list of electrodes with different roles.
switch_one
([elec, role, state])Switches one single relay.
test
(elec_dict[, activation_time])Method to test the multiplexer.
reset
- switch_one(elec=None, role=None, state=None)
Switches one single relay.
- Parameters:
- elec
- role
- statestr, optional
Either ‘on’ or ‘off’.
- class ohmpi.hardware_components.mux_2024_0_X.Mux(**kwargs)
- Attributes:
- barrier
Methods
switch
([elec_dict, state, bypass_check])Switch a given list of electrodes with different roles.
switch_one
([elec, role, state])Switches one single relay.
test
(elec_dict[, activation_time])Method to test the multiplexer.
reset
- switch_one(elec=None, role=None, state=None)
Switches one single relay.
- Parameters:
- elec
- role
- statestr, optional
Either ‘on’ or ‘off’.
- class ohmpi.hardware_components.pwr_batt.Pwr(**kwargs)
- Attributes:
- current
- pwr_state
- voltage
Methods
battery_voltage
reload_settings
reset_voltage
- class ohmpi.hardware_components.pwr_dps5005.Pwr(**kwargs)
- Attributes:
- current
- pwr_state
- voltage
Methods
battery_voltage
current_max
reload_settings
reset_voltage
- class ohmpi.hardware_components.raspberry_pi.Ctl(**kwargs)
- Attributes:
- cpu_temperature