[HELP] How to pass DHT22 data from Arduino to Simulink?

3 views (last 30 days)
Currently Im doing a mini project that needed to read temperature and humidity using DHT22 (connected to Arduino Mega 2560). However, when I try to deploy the block simulink to the Arduino Mega 2560, it seems to have error that display "Failed to generate all binary output". Btw, I'm using DHT additional library on simulink: https://www.mathworks.com/matlabcentral/fileexchange/62878-arduino-additional-sensors-library-dht-lps331 . I tried to deploy a simple block which is to blink an LED and it works fine. If anyone could help me with my problem Id really appreciate it.
Below is the error shown:
### Starting build procedure for model: simul1
### Generating code and artifacts to 'Model specific' folder structure
### Generating code into build folder: D:\FYP\simulink\simul1_ert_rtw
### Invoking Target Language Compiler on simul1.rtw
### Using System Target File: C:\Program Files\MATLAB\R2017b\rtw\c\ert\ert.tlc
### Loading TLC function libraries
### Initial pass through model to cache user defined code
.
### Caching model source code
### Writing header file simul1_types.h
### Writing header file simul1.h
### Writing source file simul1.c
.
### Writing header file simul1_private.h
### Writing header file rtwtypes.h
### Writing header file rt_nonfinite.h
### Writing source file rt_nonfinite.c
### Writing header file rtGetInf.h
### Writing source file rtGetInf.c
.
### Writing header file rtGetNaN.h
### Writing source file rtGetNaN.c
### Writing source file simul1_data.c
### Writing header file rtmodel.h
### Writing source file ert_main.c
### TLC code generation complete.
### Evaluating PostCodeGenCommand specified in the model
### Using toolchain: Arduino AVR v1.8.1 | gmake (64-bit Windows)
### 'D:\FYP\simulink\simul1_ert_rtw\simul1.mk' is up to date
### Building 'simul1': "C:\PROGRA~1\MATLAB\R2017b\bin\win64\gmake" -f simul1.mk all
D:\FYP\simulink\simul1_ert_rtw>cd .
D:\FYP\simulink\simul1_ert_rtw>if "" == "" ("C:\PROGRA~1\MATLAB\R2017b\bin\win64\gmake" -f simul1.mk all ) else ("C:\PROGRA~1\MATLAB\R2017b\bin\win64\gmake" -f simul1.mk )
gmake: *** No rule to make target `C:/Users/User/DOCUME~1/MATLAB/Add-Ons/Collections/Arduino', needed by `dht_arduino.o'. Stop.
D:\FYP\simulink\simul1_ert_rtw>echo The make command returned an error of 2
The make command returned an error of 2
D:\FYP\simulink\simul1_ert_rtw>An_error_occurred_during_the_call_to_make
'An_error_occurred_during_the_call_to_make' is not recognized as an internal or external command,
operable program or batch file.
### Creating HTML report file simul1_codegen_rpt.html
### Build procedure for model: 'simul1' aborted due to an error.
Error:Error(s) encountered while building "simul1":
### Failed to generate all binary outputs.

Answers (1)

Madhu Govindarajan
Madhu Govindarajan on 15 Aug 2018
Here is a link that I found - https://www.mathworks.com/matlabcentral/answers/95399-why-is-the-build-process-failing-for-a-shipped-model-in-simulink-or-for-a-model-run-in-accelerator-m
Solution #2 in this page seems to have worked for a few folks. Can you give that a try?
Regards, Madhu
  2 Comments
Aiman Hazman
Aiman Hazman on 15 Aug 2018
I tried the solution #2 and other solution as well. But, it shows I did not have the privilege to perform those action. Which means I can create the link of mymatlab folder.
I suspect the problem came from the DHT block:
because when I tried to use Digital Input block from Simulink Support Package for Arduino Hardware, it shows no error when deploying to the hardware (but I can't read the data of humidity and temperature).
Is there any solution to solve this?
Madhu Govindarajan
Madhu Govindarajan on 15 Aug 2018
You can always open MATLAB as and administrator by right clicking on MATLAB icon and selecting 'Run as administrator'. This should give you necessary access. If this does not resolve the issue, I suggest you send a private message to the owner as well to see if they can provide some insight about the library and this specific block.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!