File Exchange

image thumbnail

Arduino Additional Sensors Library (DHT, LPS331)

version 1.0.1 (311 KB) by Pavel Roslovets
Simulink blocks for DHT and LPS331 sensors


Updated 14 Apr 2021

From GitHub

View Version History

View license on GitHub

Now you can work with sensors:
- DHT11
- DHT21
- DHT22
- AM2301
- LPS331
More sensors are coming...
If Arduino Additional Sensors Library does not appear in Library Browser, refresh Library Browser.

Cite As

Pavel Roslovets (2021). Arduino Additional Sensors Library (DHT, LPS331) (, GitHub. Retrieved .

Comments and Ratings (18)

Ethan Ho

Anyone know how come the DHT block isn't working. It simply doesn't run when I input my pin and DHT type.

Tran Nhut

I do not have Install button, i just have Download but when i press it, i had a zip file

Mauro Fusco


Dear Mr. Roslovets, I habe problems adding the library. Could you add a shot discription how to add your library?
Best regards Ulrich

asdf jkl


Hello, Any way for use with 5 DHT22 ? It work fine with one DHT22. I don't know how to change the sources files. I see DHT arduino class was instencied only for one. Does anyone know how to solve this?
Thanks for your help

Pavel Roslovets

Amin, it works good for me in R2019b. Try to clear 'Controller_ert_rtw' and 'slprj' folders.

Amin Asham

I am using R2019a, it gives an error "### Failed to generate all binary outputs." due to an error:
"gmake: *** No rule to make target `C:/MATLAB/MATLABAddOns/R2019a/Collections/Arduino', needed by `dht_arduino.o'. Stop.
C:\Users\amind\Google_Drive\MATLAB\AWG\Controller_ert_rtw>echo The make command returned an error of 2"



It is not work with previous version of MATLAB. I am using these library with R2016a. Its giving error.

Pavel Roslovets

Hi, Aiman.
Seems like you have problem that is not related to this particular library. Please make sure that your current folder doesn't contain whitespaces and special charachters but only english letters and numbers. And first of all try to deploy any simple model from Arduino Support Package examples.
BTW try to run MATLAB as Administrator.

Aiman Hazman

Hello, I'm using MATLAB R2017b and a single DHT22 sensor. When I try to deploy to the Arduino board (Im using mega 2560), it shows an error "Failed to generate binary output". Does anyone know how to solve this? Or if anyone ever succeeded in using this library with DHT sensor? I need help.

Erik Kärcher

Hey guys, I try to use the DTH11 sensor with MATLAB r2015a. But when I try to install the support package, it says: there is no support package located.

Is there another way to install the support package ? Even with a try due an internet installation, the sensor support package is not shown up. Everthing I can see to install, are these standard support packages for arduino, androi, etc... but no additive sensor package.

Please help me!

Pavel Roslovets

Hi, Nguyen. This Library is not suited to work with more than one DHT22 at once. I think you need to modify source files to hadle it.

Nguyen Long

Hello. I am working with 1 DHT22 sensor in the simulink. This is Ok
But when I am working with 2 DHT2 sensors in the simulink. This is failure. Can you help me?

Pavel Roslovets

It works fine for me in R2017b. I can't really understand what's the problem, so my advice is to reinstall Arduino Support Package and Arduino Additional Sensors Library.

Ian Alferez

when using your library i got this errors out:
Error: File: C:\MATLAB\R2017b\rtw\c\tlc\mw\opaquelib.tlc Line: 6 Column: 10
Unable to open %include file Arduino_additional_examples_aux.tlc
Main program:
==> [00] C:\MATLAB\R2017b\rtw\c\tlc\mw\opaquelib.tlc:<NONE>(6)
### Initial pass through model to cache user defined code
Error: File: C:\MATLAB\R2017b\rtw\c\tlc\blocks\opaque.tlc Line: 14 Column: 23
Attempt to call a non-function value: NULL
Main program:
==> [00] C:\MATLAB\R2017b\rtw\c\tlc\blocks\opaque.tlc:BlockTypeSetup(14)
[01] C:\MATLAB\R2017b\rtw\c\tlc\mw\commonpass.tlc:<NONE>(150)
Error: File: C:\MATLAB\R2017b\rtw\c\tlc\blocks\opaque.tlc Line: 15 Column: 49
Undefined identifier protoBuf
Main program:
==> [00] C:\MATLAB\R2017b\rtw\c\tlc\blocks\opaque.tlc:BlockTypeSetup(15)
[01] C:\MATLAB\R2017b\rtw\c\tlc\mw\commonpass.tlc:<NONE>(150)
Error: File: C:\MATLAB\R2017b\rtw\c\tlc\mw\filepackaginglib.tlc Line: 101 Column: 20
Undefined identifier buffer
Main program:
==> [00] C:\MATLAB\R2017b\rtw\c\tlc\mw\filepackaginglib.tlc:SLibCacheCodeToFile(101)
[01] C:\MATLAB\R2017b\rtw\c\tlc\blocks\opaque.tlc:BlockTypeSetup(15)
[02] C:\MATLAB\R2017b\rtw\c\tlc\mw\commonpass.tlc:<NONE>(150)

MATLAB Release Compatibility
Created with R2017a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: Device Drivers

Inspired: Simulink Library for Arduino DHT sensor and LCD

Community Treasure Hunt

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

Start Hunting!