HSC pressure sensors via SPI Arduino
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Viacheslav Sedunin
am 10 Jun. 2019
Beantwortet: Viacheslav Sedunin
am 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 Kommentare
Akzeptierte Antwort
Arun Kumar
am 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 Kommentare
Arun Kumar
am 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));
Weitere Antworten (2)
Viacheslav Sedunin
am 14 Jun. 2019
1 Kommentar
Arun Kumar
am 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);
Siehe auch
Kategorien
Mehr zu MATLAB Support Package for Arduino Hardware finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!