Raspberry Pi Simulink Driver Blocks ADC DAC PWM
Support for the Raspberry Pi beyond toggling GPIO. Joshua Hurst did some good work creating these blocks: http://uk.mathworks.com/matlabcentral/fileexchange/41529-raspberry-pi-pwm-driver-block-sfunction but there were a number of errors/steps lacking to get them compiling and working on a Raspberry Pi.
Uncomment or copy into another Raspberry Pi model the blocks you wish to use.
# Usage
* You must open the S-Function driver block and click 'Build' to generate the
embedded coder files otherwise you will receive an error 'sfcn\_.... does
not exist'.
* If using the ADS1115 and MCP4725 you will require my fork of wiringPi:
https://github.com/tuna-f1sh/wiringPi-mcp4725 see the README for
installation instructions.
* If using the PWM block, you will need to enable SPI in Raspbian - see: http://uk.mathworks.com/help/supportpkg/raspberrypiio/examples/analog-input-using-spi.html or enable via SSH.
* The scopes work in real-time on the Pi to see the correct data is going
to/coming from blocks.
* The discrete timestep is set to 'Ts' throughout the model. This is
initialised as 1e-3s at model load - it seems to be the sweet spot for
performance/usage. Remember to consider quantisation that this can create
with signals driving the blocks.
# Notes
* wiringPi softPWM:
https://projects.drogon.net/raspberry-pi/wiringpi/software-pwm-library/
* Do not sure both ADC blocks at once without changing the wiringPi 'pin'
assignment - it won't work.
* See the post on my blog explaining how these work: http://wp.me/p2C0Bi-bK
# Install wiringPi Fork
1. Login to the Pi via SSH.
2. `git clone https://github.com/tuna-f1sh/wiringPi-mcp4725`
3. `cd wiringPi-mcp4725`
4. `./build`
www.jbrengineering.co.uk - @j_whittington - 2015
引用
John Whittington (2024). Raspberry Pi Simulink Driver Blocks ADC DAC PWM (https://www.mathworks.com/matlabcentral/fileexchange/51232-raspberry-pi-simulink-driver-blocks-adc-dac-pwm), MATLAB Central File Exchange. に取得済み.
MATLAB リリースの互換性
プラットフォームの互換性
Windows macOS Linuxカテゴリ
タグ
謝辞
ヒントを得たファイル: Device Drivers, Raspberry Pi Driver Block SFunction, Raspberry Pi PWM Driver Block SFunction
ヒントを与えたファイル: Raspberry Pi and Arduino Serial Communication
コミュニティ
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!rpi-driver-blocks/
バージョン | 公開済み | リリース ノート | |
---|---|---|---|
1.0.0.0 | Added link to my blog
|