Firmware for Raspberry Pico that turns it into a SCPI instrument.
The project has C library, that handles the support for SCPI and usbtmc. An example application runs on a Pico without additional hardware and supports analog in-out and digital in-out.
Pre-build firmware is available on github. There's a LabVIEW driver block for the major functions. Advanced functionality (instrument specific registers, service requests) are available via the typical SCPI constructs for them
This section describes the supported (and not yet supported) commands. It lists
set digital output |
drive digital output pin of PICO high or low |
pins: 0: GP22 |
SCPI | DIGItal:OUTPut# <0|1> |
example: DIGI:OUTP0 1 #: pin |
VI |
Public/Action-Status/Digital Out Control |
inputs: |
|
|
|
get digital output | query the state of a digital output |
pins: 0: GP22 |
SCPI | DIGItal:OUTPut#? |
example: DIGI:OUTP0? #: pin |
VI |
Public/Data/Read Digital Out |
inputs: pin (int) outputs: state (bool 0|1) |
|
||
get digital input |
query the state of a digital input |
pins: 0: GP20 |
SCPI | DIGItal:INPut#? |
example: DIGI:INP0? #: pin |
VI |
Public/Data/Read Digital In |
inputs: pin (int) outputs: state (bool 0|1) |
|
|
|
get analogue input (standard) | query an ADC input of the Pico |
pins: 0: GP26 (ADC0) |
SCPI | ANAlog:INPut#:RAW? |
example: ANA:INP0:RAW? #: pin |
VI |
Public/Data/Read Analog |
inputs: pin (int) outputs: ADC value (integer 0-4095) |
|
|
|
get analog input (high resolution) | query an input of attached ADS1115 ADC |
pins: ADS1115 pin 0 - 3 |
SCPI | ANAlog:HIRES:INPut#:RAW? | #: pin return: ADC value(integer 0-32766) |
VI |
Public/Data/Read Analog HiRes |
inputs: pin (int) outputs: ADC value (integer 0-32766) |
|
|
|
set analog output | control pin of Pico with variable duty cicle |
pins: 0: GP16 |
SCPI | ANAlog:OUTPut#:RAW <0-4095> | inputs: pin (int) Duty cycle value (integer 0-4095) outputs: na |
VI |
Public/Action-Status/Analog Out Control |
inputs: pin (int) duty cycle (integer 0-4095) outputs: na |
|
|
|
get analog output | query the set duty cycle set on a pin of Pico |
pins: 0: GP16 |
SCPI | ANAlog:OUTPut#:RAW? | inputs: pin (int) outputs: Duty cycle value (integer 0-4095) |
VI |
Public/Data/Read Analog Out |
inputs: pin (int) outputs: duty cycle (integer 0-4095) |
|
|
|
init resource | initiate connection | VISA url: USB0::0xCAFE::0x4000::123456::INSTR |
SCPI | na, connect via VISA API | client dependent |
VI |
Public/Initialize |
inputs: VISA url outputs: na |
|
|
|
close resource | release connection | |
SCPI | na, disconnect via VISA API | client dependent |
VI |
Public/Close |
inputs: na outputs: na |
This section describes the supported (and not yet supported) commands. It lists
digital input registers | query the registers of a digital input, set filter and fan-out to IEEE488.2 Operation Status register |
bits: 0: GP20
registers: fan-out to IEEE488.2: Operation Status[0] |
SCPI | STATus:OPERation:DIGItal:INPut:CONDition? STATus:OPERation:DIGItal:INPut:PTRansition STATus:OPERation:DIGItal:INPut:PTRansition? STATus:OPERation:DIGItal:INPut:NTRansition STATus:OPERation:DIGItal:INPut:NTRansition? STATus:OPERation:DIGItal:INPut:EVENt? STATus:OPERation:DIGItal:INPut:ENABle STATus:OPERation:DIGItal:INPut:ENABle? |
|
|
|
|
Simple Example
VI read analogue pin
Documentation on element 14: Program the Pico SCPI labTool
Firmware (code and binary) and drivers available on github: The release has all you need to get started. The firmware contains the binary .uf2 that you can copy on your Pico. The LabVIEW VI Driver contains examples that you can run right away.
software | latest release (source and bin) | development branch (source) |
Pico Firmware | github release | github branch |
LabVIEW Virtual Instrument driver with examples | github release | github branch |
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
images showed when entering the text. I tried to edit and fix the images, but have no rights to edit the post.