HSC pressure sensors via SPI Arduino
6 ビュー (過去 30 日間)
古いコメントを表示
Hi! Does anyone know the robust way of connecting Honeywell HSC pressure sensors via SPI and Arduino board?
Suggested here SPI interface supports only Aardvark and NI connections:
The idea is quite simple: to drop CS pin to 'low' and read just four (4) bytes of data from MISO (there's no MOSI at all) and then close connection.
Cheers
0 件のコメント
採用された回答
Arun Kumar
2019 年 6 月 11 日
Hi Viacheslav,
What I understood from your question is that you want to read data from a SPI device using arduino.
To do this, you can use MATLAB Support package for Arduino Hardware.
Here is the link to download that:
And here is the link to the documentation of SPI communication on Arduino using MATLAB:
Hope this helps.
Cheers
2 件のコメント
Arun Kumar
2019 年 6 月 12 日
Hi Viacheslav,
Reading 4 bytes should not be any issue with arduino.
Refer this page for details:
You can read 4 bytes like this:
a = arduino;
dev = device(a,'SPIChipSelectPin','D10');
dataOut = writeRead(dev,zeros(1,4));
その他の回答 (2 件)
Viacheslav Sedunin
2019 年 6 月 14 日
1 件のコメント
Arun Kumar
2019 年 6 月 14 日
Hi Viacheslav,
The random values could be because of wrong clock speed. Can you check the SPI clock speed supported by your sensor and the SPI clock configured in matlab.
For decoding values from two bytes, you can use the code below:
msb = bitshift(bitand(byte1,bin2dec('111111')),8); %Extracting only 6 bits and shifting it by 8
lsb = byte2;
out = bitor(msb,lsb);
参考
カテゴリ
Help Center および File Exchange で MATLAB Support Package for Arduino Hardware についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!