Difference between revisions of "AWS IOT with Arduino ESP32"
Line 36: | Line 36: | ||
[[File:ESP32 AWS IOT PUBLISH SUBSCRIBE.png]] | [[File:ESP32 AWS IOT PUBLISH SUBSCRIBE.png]] | ||
<br><br> | <br><br> | ||
+ | |||
+ | =Logging Temperature and Humidity using DHT11 sensor= | ||
+ | After setting the AWS client and AWS IOT lib, lets log the real time temperature and humidity using DHT11 sensor.<br> | ||
+ | Install the Adafruit DHT11 sensor library using Arduino Library Manager or download it from [https://github.com/adafruit/DHT-sensor-library this link]. <br> | ||
+ | |||
+ | Do the connection as shown below. | ||
+ | [[File:0 ESP32 AWS IOT DTH11 Logging.png]] | ||
+ | |||
+ | Now copy paste the below code and configure the Wifi SSID, Host Address and upload the sketch. | ||
+ | <html> | ||
+ | <script src="https://gist.github.com/SaheblalBagwan/b39e80d2b0de87731fce7a7a5f37bea4.js"></script> | ||
+ | </html> | ||
+ | |||
+ | Temp and Humidity logged to AWS IOT server. | ||
+ | [[File:ESP32 AWS IOT DTH11 Logging.png]] | ||
=Download= | =Download= |
Revision as of 20:35, 12 April 2017
In the earlier tutorial we discussed how to setup AWS IOT for an Amazon user account. Now lets see hot to use the Arduino esp32 AWS IOT library to communicate with AWS server.
Contents
AWS IOT for ESP32
Download the AWS IOT library for Arduino ESP32 from this link.
Now open the first example pubSubTest.ino as shown below.
.
Wifi SSID and Host Address Configuration
Configure the below parameters at the beginning of the sketch as shown in the image.
WIFI_SSID
WIFI_PASSWORD
HOST_ADDRESS
CLIENT_ID
TOPIC_NAME
AWS Certificate Configuration
The below certificate and private key needs to be copied to aws_iot_certificate.c file in the form of array.
aws-root-ca.pem certificate.pem.crt private.pem.key
Upload the sketch and verify the output
Publish and subscribe(received) messages printed on terminal.
Published message viewed on MQTT Fx client software:
Publish a message from MQTT Fx Client and verify the received message on terminal.
Logging Temperature and Humidity using DHT11 sensor
After setting the AWS client and AWS IOT lib, lets log the real time temperature and humidity using DHT11 sensor.
Install the Adafruit DHT11 sensor library using Arduino Library Manager or download it from this link.
Do the connection as shown below.
Now copy paste the below code and configure the Wifi SSID, Host Address and upload the sketch.
Temp and Humidity logged to AWS IOT server.
Download
Download the Arduino ESP32 AWS IOT lib and examples form this link.
Have an opinion, suggestion , question or feedback about the article let it out here!