Matlab and Raspberry Pi 4 with Analog Voltage Inputs

24 visualizzazioni (ultimi 30 giorni)
I am looking for a way to measure analog voltage signals with Matlab/Simulink and Raspberry Pi 4 for further processing in Matlab/Simulink. Here are the following questions:
  • Cany anyone recommend a solution for acquiring data (analog voltage signals) with Pi4 directly in Matlab/Simulink. What is the recommondation for the analog-digital-converter (ADC) for Pi4?
  • The Digilent MCC 128 and 172 are good ADCs for Pi4. But it's not possible to directly acquire the data in Matlab only in the Pi OS by C or Python Code. Does anayone has a solution fpr MCC 128 / 172 to acquire data directly in Matlab?
  • Are the other general recommendations for analog signal acquisition with Pi4 in Matlab/Simulink? Any general DAQ solution?
Thanks

Risposte (1)

recent works
recent works il 30 Ago 2023
There are a few different ways to acquire analog voltage signals with MATLAB/Simulink and Raspberry Pi 4. One way is to use a dedicated ADC board, such as the Digilent MCC 128 or 172. These boards have a built-in SPI interface that can be used to communicate with the Raspberry Pi. MATLAB/Simulink has a library of functions that can be used to acquire data from these boards.
Another way to acquire analog voltage signals is to use the Raspberry Pi's built-in ADC. The Raspberry Pi has a 12-bit ADC that can be used to measure analog voltages in the range of 0 to 3.3V. However, the Raspberry Pi's ADC is not as accurate or as versatile as a dedicated ADC board.
If you are using a dedicated ADC board, you can acquire data directly in MATLAB/Simulink using the following steps:
  1. Connect the ADC board to the Raspberry Pi.
  2. Install the necessary drivers for the ADC board.
  3. Create a MATLAB/Simulink model that includes the ADC block.
  4. Configure the ADC block with the settings for the ADC board.
  5. Run the MATLAB/Simulink model to acquire data from the ADC board.
If you are using the Raspberry Pi's built-in ADC, you can acquire data in MATLAB/Simulink using the following steps:
  1. Install the necessary drivers for the Raspberry Pi's ADC.
  2. Create a MATLAB/Simulink model that includes the Raspberry Pi ADC block.
  3. Configure the Raspberry Pi ADC block with the settings for the Raspberry Pi's ADC.
  4. Run the MATLAB/Simulink model to acquire data from the Raspberry Pi's ADC.
  3 Commenti
recent works
recent works il 30 Ago 2023
I am not familiar with any way to use these boards directly in MATLAB/Simulink.
The Digilent support team is correct in saying that these boards require Pi OS. This is because the MCC 128 and 172 are SPI devices, and the Raspberry Pi's SPI interface is not available in the Linux kernel that is used by MATLAB/Simulink.
If you are still interested in using the MCC 128 or 172, you could use the following steps:
  1. Install the Pi OS on the Raspberry Pi.
  2. Install the necessary drivers for the MCC 128 or 172.
  3. Write a Python script to communicate with the MCC 128 or 172.
  4. Use MATLAB/Simulink to call the Python script.
This is a bit of a roundabout way to do things, but it is the only way to use the MCC 128 or 172 directly in MATLAB/Simulink.
As for other ADC boards that you can use directly in MATLAB/Simulink, I am not sure. I would recommend searching for ADC boards that are compatible with the Raspberry Pi's SPI interface
Matthias Schmidt
Matthias Schmidt il 30 Ago 2023
Ok, 1. - 3. works and I can acquire data in Pi OS. But can you describe in more detail point 4? The Pi4 is connected per LAN to my notebook (Matlab) - how can I call the Python script in Maltab and how can I stream the data from the Pi4 to my notebook?

Accedi per commentare.

Categorie

Scopri di più su MATLAB Support Package for Raspberry Pi Hardware in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by