Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i am working on an iot project. i am taking data from sensors max 3 0 1 0 2 and dht 1 1 ( heart

i am working on an iot project. i am taking data from sensors max
30102 and dht11(heart rate ,temperature and humidity)now i am using esp32 wroom 32 pins and uploading the data on arduino cloud next stage is to display data on lcd screen tft 7735 i am unable to do so .i am sharing details about my code and pin connections and can you help with this . code: #include "thingProperties.h"
#include "DHT.h"
#define DHTPIN 26
#define DHTTYPE DHT11// DHT 22
DHT dht(DHTPIN, DHTTYPE);
#include
#include "MAX30105.h"
MAX30105 particleSensor;
#include // Graphics and font library for ST7735 driver chip
#include
TFT_eSPI myGLCD = TFT_eSPI(); // Invoke library, pins defined in User_Setup.h
#define DELAY 500
#define TFT_GREY 0x7BEF
#define TFT_W 160
#define TFT_H 80
unsigned long runTime =0;
void setup(){
// Initialize serial and wait for port to open:
Serial.begin(9600);
Serial.println(F("DHTxx test!"));
dht.begin();
initProperties();
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
Serial.println("Initializing...");
if (!particleSensor.begin(Wire, I2C_SPEED_FAST))//Use default I2C port, 400kHz speed
{
Serial.println("MAX30105 was not found. Please check wiring/power.");
while (1);
}
particleSensor.setup(0x1F,8,3,100,411,4096);
myGLCD.init(); // Initialize the display
myGLCD.setRotation(1); // Adjust the display rotation as needed
myGLCD.fillScreen(TFT_BLACK); // Set initial screen color
byte ledBrightness =0x1F; //Options: 0=Off to 255=50mA
byte sampleAverage =8; //Options: 1,2,4,8,16,32
byte ledMode =3; //Options: 1= Red only, 2= Red + IR,3= Red + IR + Green
int sampleRate =100; //Options: 50,100,200,400,800,1000,1600,3200
int pulseWidth =411; //Options: 69,118,215,411
int adcRange =4096; //Options: 2048,4096,8192,16384
particleSensor.setup(ledBrightness, sampleAverage, ledMode, sampleRate, pulseWidth, adcRange); const byte avgAmount =64;
long baseValue =0;
for (byte x =0 ; x < avgAmount ; x++)
{
baseValue += particleSensor.getIR(); //Read the IR value
}
baseValue /= avgAmount;
for (int x =0 ; x <500 ; x++)
Serial.println(baseValue)
randomSeed(analogRead(A0));
// Setup the LCD
myGLCD.init();
myGLCD.setRotation(1);
}
void loop(){
ArduinoCloud.update();
float h = dht.readHumidity();
float t = dht.readTemperature();
float f = dht.readTemperature(true);
if (isnan(h)|| isnan(t)|| isnan(f)){
Serial.println(F("Failed to read from DHT sensor!"));
return;
}
int temperature=t ;
int humidity=h ;
int heartrate=particleSensor.getIR();
float hif = dht.computeHeatIndex(f, h);
Compute heat index in Celsius (isFahreheit = false)
float hic = dht.computeHeatIndex(t, h, false);
Serial.print(F("Humidity: "));
Serial.print(h);
Serial.print(F("% Temperature: "));
Serial.print(t);
Serial.print(F("\deg C "));
Serial.print(f);
Serial.print(F("\deg F Heat index: "));
Serial.print(hic);
Serial.print(F("\deg C "));
Serial.print(hif);
Serial.println(F("\deg F"));
Serial.println(heartrate);
myGLCD.fillScreen(TFT_BLACK);
myGLCD.setTextColor(TFT_WHITE);
myGLCD.setTextSize(2);
myGLCD.setCursor(10,10);
myGLCD.print("Temperature: ");
myGLCD.print(temperature);
myGLCD.println(" C");
myGLCD.setCursor(10,40);
myGLCD.print("Humidity: ");
myGLCD.print(humidity);
myGLCD.println("%");
myGLCD.setCursor(10,70);
myGLCD.print("Heart Rate: ");
myGLCD.print(heartrate);
myGLCD.println(" bpm");
delay(2000);
}
void onTemperatureChange(){
}
void onHumidityChange(){
}
void onHeartrateChange(){
// Add your code here to act upon Heartrate change
} this was my code and my pin connections are :Vcc-3.3v
Led-3.3v
GND-GND
CS-D15
Rst-D4
A0-D2
Sda-D23
Sck-D18

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL For Data Science Data Cleaning Wrangling And Analytics With Relational Databases

Authors: Antonio Badia

1st Edition

3030575918, 978-3030575915

More Books

Students also viewed these Databases questions

Question

What should I remember about this?

Answered: 1 week ago