HSC pressure sensors via SPI Arduino
6 views (last 30 days)
Show older comments
Viacheslav Sedunin
on 10 Jun 2019
Answered: Viacheslav Sedunin
on 18 Jun 2019
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 Comments
Accepted Answer
Arun Kumar
on 11 Jun 2019
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 Comments
Arun Kumar
on 12 Jun 2019
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));
More Answers (2)
Viacheslav Sedunin
on 14 Jun 2019
1 Comment
Arun Kumar
on 14 Jun 2019
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);
See Also
Categories
Find more on MATLAB Support Package for Arduino Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!