MATLAB Answers

How to communicate from Matlab/Simulink to Arduino Due by Wifi using a ESP8266 wifi chip

86 views (last 30 days)
Laurent Storrer
Laurent Storrer on 23 Nov 2017
Answered: Shreya Bharti on 7 May 2021 at 14:20
I try to setup a communication between Matlab 2016a/Simulink and Arduino Due through wifi with an ESP8266 wifi chip, following this tutorial:
I use the Simulink setup that Mathworks is providing, but I have 2 problems/questions:
1) In the Hardware Implementation configuration panel of Simulink (Simulation > Model Configuration Parameters > Hardware Implementation > "specify arduino model in hardware board field" > Target Hardware Ressources > Wifi shield properties), after specifying that I use an Arduino Due (I have downloaded the Arduino Support Package) I can't specify that I am using an ESP8266. Does it mean that the ESP8266 is not taken in charge in the package by Matlab anymore? Does it mean that the ESP8266 is not detected?
I have:
and following the tutorial I should have:
2) Do I have to program my ESP8266 to act as a server and assign an IP adress to it(through C++ code run on the Arduino) before trying to connect it with Matlab, or will Matlab do all the setup automatically? (For the configuration I have the Arduino connected via USB to my laptop).
Thanks in advance for the help!

Answers (2)

Pradeep KS
Pradeep KS on 24 Nov 2017
Hi Laurent, ESP8266 WiFi board is supported as a shield in Simulink Arduino Support package starting from R2017b release. Its not supported in R2016a release as you mentioned.
To use ESP8266 with Simulink Arduino support package, AT firmware should be running in the ESP8266 board. Arduino and ESP8266 are interfaced using Serial communication.
Please refer to below link on interfacing ESP8266 WiFi board with Arduino hardware. https://www.mathworks.com/help/supportpkg/arduino/ug/connect-esp8266-to-arduino-hardware.html
-Pradeep
  2 Comments
Prathap moola
Prathap moola on 27 Nov 2018
hi guys,
I too have the same issue... how to fix it... how to assign ip adress to esp8266.
if any one can help me!
thank you.

Sign in to comment.


Shreya Bharti
Shreya Bharti on 7 May 2021 at 14:20
Hello, I am trying to calculate distance through ultrasonic sensor which is interfaced with esp8266 and the complete system is working fine when running code on Arduino ide.But I want to display and plot distances using MATLAB code.Is it possible in any way?? I have tried lot of things but alone with esp8266 and sensor it's not working. Please help.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!