Expansion Boards are responsible for interacting with the external physical environment, buffering sensor data and controlling actuators. A number of standard Expansion Boards are bundled with Blitz, however it is also possible to write your own in Python.
Expansion Boards may be anything that conforms to the Blitz Expansion Board specification. Typically for testing Expansion Boards have been based on Arduino boards, particularly the Arduino Due given its high processing power. A C++ Arduino library called BlitzExpansion is available to make implementing expansion boards simpler.
An expansion board used for testing purposes. Returns
This board is under development. It will allow direct access of Raspberry Pi GPIO pins. Note that there are limitations to this approach and it should not be used for time critical data acquisition of high sample rate data acquisition.
The Blitz Basic Expansion Board is the simplest and most basic board to implement. It is used for logging up to five digital and five analogue channels. The variables available are:
Note the digital channels are available from version 0.2.2 onwards
The exact data reported on each channel, and the corresponding ADC and digital pins is up to the firmware implementation of the Basic Expansion Board. An example implementation for Arduino is available here.
The Blitz Motor Expansion Board allows control of motors from the client software. The exact motor behaviour is unspecified. No example firmware is currently available, however it is likely one will be added to the BlitzExpansion examples at a later date.
The variables available are:
raw_adc
valueThe NetScanner Expansion Boards are present for historic reasons. They will not be useful to most users and may be removed from the repository at a later date, or converted into a more generic ethernet control board.
Boards #10 and #11 are for connecting to and controlling to NetScanner 9IFC and NetScanner 9116 pressure sensing devices via an ethernet connection. They are most likely irrelevant for most users. Back to List
See the description for board #10 above. Back to List
Expansion Boards can be implemented with a few additional lines of Python code. For instance the following is the code for the "Blitz Basic" expansion board which contains a payload with five 12-bit integers:
class BlitzBasicExpansionBoard(BaseExpansionBoard):
"""
A basic expansion board with three 10bit ADCs
"""
def __init__(self, description="Blitz Basic Expansion Board"):
"""load the correct description for the board"""
BaseExpansionBoard.__init__(self, description)
self.do_not_register = False
self.id = 8
self.description = description
def register_signals(self):
"""Connect to the board loading signal"""
registering_boards.connect(self.register_board)
def get_variables(self):
return {
"adc_channel_one": self.get_number(0, 12),
"adc_channel_two": self.get_number(12, 12),
"adc_channel_three": self.get_number(24, 12),
"adc_channel_four": self.get_number(36, 12),
"adc_channel_five": self.get_number(48, 12)
}
This is the minimal implementation required. The class must inherit from BaseExpansionBoard
.
The function __init__
allows the board to be identified and described. The ID should be unique, and not one of the IDs described below. The do_not_register
variable allows expansion boards to be skipped during loading.
The get_variables
function must return a dictionary of "variable": "value"
pairs. It uses functionality provided by the BaseExpansionBoard
class. Refer to the API documentation for more information.