Analytics is one of the best tools which help you gain information about what is happening, and help you to see the trends in the data. Companies like Facebook, Google, Uber, Amazon, and many others use the help of analytics to perform certain tasks, such as ads.
Originally posted at https://highvoltages.co/project/arduino/arduino-real-time-plotting-with-matlab/
Also Learn how to plot relatime data in MATLAB over MQTT protocol (ESP8266 data) : https://highvoltages.co/iot-internet-of-things/how-to-mqtt/mqtt-in-matlab/
This project will help you do analysis on your sensor data in real-time. In this project, we are going to take sensor values and send it on MATLAB script running on our laptop serially and will plot those serial values in real time.
MATLAB has been used for multiple purpose and in this tutorial we are going to use it for real time data plotting.
We will read the analog values of potentiometer and our favorite development board Arduino will help us do that and the value will be sent to MATLAB serially.
Check out how to do the same task with Python:
Set Up MATLAB Arduino Hardware Support:MATLAB being the matrix lab and the tool for mathematical processing have 100s of tools, some of them comes pre installed and you will have to install some. So our first task will be to install the MATLAB Arduino support and you can do that by following the method discussed below,
- First, start MATLAB and click the Add-Ons drop down menu. In the drop-down menu click Get Hardware Support Packages. It will start the package installer window.
- Select Install from internet and then Next.
- In the next window you will see all the available packages for MATLAB and Simulink. Select the Arduino package, then check all the packages displayed and click Next to continue installation.
- Next, the installer will ask you to log in to your Math Works account. If you don’t have an account, you can create one during installation. Accept the license agreement on the next screen and continue to download the packages. Now you have to wait for MATLAB to download and install all the required packages.
Once the packages are installed, connect your Arduino board to your PC and type the following command in MATLAB command window,
>> a = arduino()
if you have more than one Arduino connected to your PC, you have to specify the board type you will be communicating with:
>> a = arduino(‘com3’, ‘uno’)
MATLAB will then attempt to communicate with your board. If successful, MATLAB will display the properties of the Arduino board connected to your PC.
Make Circuit Diagram and Write MATLAB Script:Then all you have to do is to make circuit diagram which is quite simple and is attached and then write MATLAB code (attached) and run the program.
Video:Don't Forget to Subscribe and Like Our Facebook Page:
Comments