Data acquistion with Simulink 2012b and Arduino UNO
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello everyone,
I've been trying to read data from my arduino UNO on simulink with no success.
I connected a potentiometer on analog port 3 (A3) on the arduino. On simulink I have an Analog Input block connected to a scope block.
I run on target and then play the simulation, but I only read 0 on the scope.
To be honest, I'm pretty confused. The help files were not really helpful and I have tried every possible combinations of blocks. Maybe it's best using a Serial Receive block?!
By the way, I'm quite new to Simulink.
Any help will be greatly appreciated, as I need to get this working for my project.
Thanks!
댓글 수: 5
Md Rasheduzzaman
2015년 10월 21일
Ardunio Uno does not support signals to show up on scopes. Buy Arduino mega.
SHARIQ SHAMSI
2017년 3월 26일
Mr. Rasheduzzaman, you mean the same model will work with mega and produce the same result?
답변 (12개)
Ryan G
2012년 10월 1일
Make sure you have the right pin selected in the input block. When you play the model, set it to run 'inf' so you can play around with your board and Simulink will keep running.
Are you sure you're setup to run on the arduino board? In the configuration parameters there is a 'Run on Target Hardware' section. You can select the Arduino Uno from here.
How are you running the model? Try tools -> run on target hardware -> run.
댓글 수: 0
Rodolfo Buschle
2012년 10월 1일
편집: Rodolfo Buschle
2012년 10월 1일
댓글 수: 1
Ryan G
2012년 10월 1일
"I connected a potentiometer on analog port 3 "
When you wrote that in the main post I read it as 'pin' 3, is this the case? Try stting the Input block to 3 instead of 0. Essentially it is trying to read whatever is at pin 0, which at this point there does not seem to be anything on that pin.
"Interactive parameter tuning and signal monitoring of applications running on the Arduino Mega (not available on Arduino Uno)"
"Model deployment for stand-alone operation"
Essentially your model is 'deploying' on the target. This means there is not really any more interaction with Simulink. You could start the Arduino running and unplug it from the PC. However, if you do want to monitor it you can either use MATLAB or Simulink to read from the serial port in the PC (which it sounds like you've found is slow).
The Ardunio Input block in this case is simply used in whatever type of design you are planning in Simulink (like a feedback control).
YT
2013년 1월 23일
Have you solved the problem? I have the same issue. The sensor works very well at Arduino IDE. I also detects voltage change at the pin using a multimeter. But i cannot make it work at Simulink. I tried Rodolfo's way of using the serial port receive/send, it did not work either. I use win7 64bit + Matlab 2012a. Any suggestions?
댓글 수: 0
Robalivry
2013년 2월 14일
What did you do exactly to read with Simulink ?
For my part, I always :
* make a new variable with my Arduino in command line :
>> Due = arduino('COM4');
(I use a Duemilanove)
* go to Simulink, put a scope in my model and link it to the Analog Input found in the ArduinoIO library AND put a Setup block (found at the same place) in the model
* Double-click on the setup block and chose "existing variable #1" (or something like this) and enter the name of my variable "Due" in the field below.
* Then go to the Analog Input block and chose the *same* "existing variable #1".
* Run my model and it works.
Hope that will help !
댓글 수: 0
shri raje
2013년 3월 5일
Can anybody will give me pictorial representation of communicating virtual com port with proteus and simulink(2012a) for detecting analog signal and displaying it on scope of simulink(2012a)???????????????
댓글 수: 0
Kashyap
2013년 11월 17일
Could anyone solve the problem with data acquisition using Arduino uno and simulink?? Any help would we greatly appreciated.
Thank You.
댓글 수: 0
William sanchez
2014년 5월 27일
Any help us please! i have the same problema with arduino uno and preset.
댓글 수: 0
Valmir Sadiku
2014년 5월 27일
편집: Valmir Sadiku
2014년 5월 27일
I tried two years ago and it worked for me fine. The attached picture shows you, how you can build a simple analog read from arduino into simulink.
First model read the analog sensor (in my an poti) and write it to the serial com port (byte by byte). this model must be uploaded to the arduino!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/175008/image.jpeg)
The second model reads the serial port as shown in this picture.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/175009/image.jpeg)
hope this will help you!
댓글 수: 4
OJIJ
2016년 1월 12일
편집: OJIJ
2016년 1월 12일
thank's for your answer. I success to analogread with (Arduino Uno) using your idea (conversion to the serial) but I used another configuration instead your first model as you are shown in this picture:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/181567/image.png)
the second model is as you mentioned. Thank's for sharing again
chfakht chfakht
2015년 2월 11일
Simulink with arduino : data acquisition Hello all , i'm working on data acquisition from a sensor attached to the arduino : MPU6050 using a model in simulink , i have installed the hardware support in simulink but i don't know how to start building the model , the model must read the data from arduino by deploying it into the arduino my connection arduino = MPU6050 is :
Arduino MPU 9150
3.3V VCC
GND GND
A5 SCL
A4 SDA
DIGITAL 2 INT
GND AD0
any help will be appreciated thanks
댓글 수: 0
Madhu Govindarajan
2015년 10월 21일
Arduino Uno and Leonardo are not supported for external mode on Simulink - http://www.mathworks.com/hardware-support/arduino-simulink.html
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Setup and Configuration에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!