sensorHumedad-MQTT © CC BY-NC

sensor hdt arduino that send data through mqtt to a broker, and a arduino reptor detail the state

  • 2 respects

About this project

The project is maker after finish of a course about arduino.

It is about an idea to a little project in a building.

This project use 2 arduinos UNO with ethernet shield, and a raspberry pi. One arduino send capture the humidity and temperature and send the data with MQTT. It has 4 sounds DHT11. The commnication is with arduino ethernet shield.

There is a raspberry pi as a broker with the software "mosquitto". It sends the data in the and a second arduino recepts it.

The second arduino receives the message and acts indicating the state of the probes.The states are three states Normal, error and danger.normal: turn on the green led.error: turn on the yellow led (occurs if there are more than 3 errors in the data collection)danger: turn on the yellow LED and the speaker sounds. (occurs if there are one or 2 errors in the data collection)

Every time the recept show 2 seconds in a 2x16 display the state, (ok,er,pl) and the average of humidity and temperature.

Alternatively every 2 seconds show humidity and temperature for every DTH11 named s1,s2,s3,s4. if it is an error and no data the display show 0 in the display data of that DHT11.

It not use the pins 10,11,12 because they are used for the ethernet shield.

The arduino transmitter sends the mqtt data in the format:

"ok 25.25$23.23|s1 11.11$11.11|s2 21.21$22.22| s3 31.13$32.32|s4 41.41$42.42|"

the arduino receiver receives the data and process it.

The data has 5 parts separtely by "|".

ej "ok 25.25$23.23|"

The first part indicates the state and the average of humidity and temperature of the 4 sensors.

ej "s1 <hum>$<temp>|"

The next indicates the parameters of DHT sersors (s1,s2,s3,s4)

The broker (raspberry pi) use moquitto software with the commands:

# <path>/mosquitto -c <path>/mosquitto.conf

It begins the service.

To view the messages sends by arduino in other shell:

# <path>/mosquitto_sub -t "centro" -v

it is a mosquitto client with the same topic "centro" as arduinos use.

github project

The project has the board and esquematic images, and the list of materials.


  • 4 Humidity and Temperature Sensor DHT11
  • 1 Piezo Speaker
  • 1 Red (633nm) LED
  • 1 Yellow (595nm) LED
  • 1 Green (555nm) LED
  • 1 LCD1602-I2C
  • 2 Arduino Uno (Rev3) - ICSP
  • 2 Arduino Ethernet Shield (Rev3)
  • 3 220Ω Resistor
  • 1 Raspberry Pi B rev1


  • fritzing
  • arduino IDE
  • project hub
  • github

library for arduino

  • adafrauit dht sensor
  • adafruit unified sensor (necesary for dht sensor library)
  • ethernet for arduino
  • LiquidCrystal_I2C (for receiver control i2c Display)
  • PubSubClient (mqtt client for sender and receiver)

necesary parts

any time ;)



esquematic and circuit diagram, list of materials.
There are esquematic and circuit diagram, list of materials. There are generated with fritzing


Add projectSign up / Login