Interfacing Arduino IDE with MATLAB
조회 수: 6 (최근 30일)
이전 댓글 표시
I have a LiDAR sensor that was created to interface with Arduino IDE. It has it's own support package in Arduino IDE in order to allow it to function. This support package is not available in MATLAB (as far as I could find). The sensor itself has a supply terminal (VDD), output terminal (Vout), ground (GND), L/O supply voltage (Vin), input terminal for active standby control (GP), I2C clock (SCL), and I2C data bus (SDA).
Attempting to be able to interface the sensor with MATLAB, I was hoping to receive an analog output by simply wiring only the VDD, GND, and Vout ports to an Arduino Uno controlled with the MATLAB Arduino add-on. In this, I would have the MATLAB code read the analog output voltage, however, given the multitude of other ports, I'm doubting whether this will be work. It seems too simplistic for having an SCL and SDA (still not sure what those mean or how to use them). I don't want to wire the system up yet as I don't want to damage the electronics if I am wrong. Below I will link the datasheet to the sensor. Can anyone confirm this or assist me in figuring out how to receive an analog output from the sensor?
Note: I am a college student whose major only loosely associates with coding. I have been coding for many years, however, my knowledge is self-taught and therefore very limited so simplistic responses are preferred.
댓글 수: 0
답변 (1개)
Walter Roberson
2022년 12월 29일
If you use the Arduino support package then see https://www.mathworks.com/help/supportpkg/arduinoio/ref/matlabshared.i2c.device.html . You would use arduino() to establish the connection, then device() to configure the i2c details, and then read() or write()
Note that this kind of connection will be slower than if you created a custom arduino sketch that do the reading or writing and sent the values to MATLAB over the serial port (USB really) or by an ethernet connection. The arduino() / device() / read() structure is convenient for not having to know the details of how it all works, but it has the disadvantage of needing to have the MATLAB session send "commands" to the arduino that the arudino has to interpret to figure out what has to be done and then package up the results and send them back . This would, of course, be slower than if the arduino has already been programmed to only do one thing, without having to be instructed about what to do each time.
댓글 수: 0
참고 항목
카테고리
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!