KritikaVaishnaviVikas SharmaDr. Umesh Dutta
Published

๐’๐ฆ๐š๐ซ๐ญ๐’๐ž๐ง๐ฌ๐ž - Smart Public Feedback System

A smart IoT review system that collects real-time public feedback via sensors, logs data to ThingSpeak, and provides instant insights.

BeginnerFull instructions provided160
๐’๐ฆ๐š๐ซ๐ญ๐’๐ž๐ง๐ฌ๐ž - Smart Public Feedback System

Things used in this project

Hardware components

NodeMCU ESP8266 Breakout Board
NodeMCU ESP8266 Breakout Board
For WiFi communication and processing.
×1
4-CHANNEL RELAY CONTROLLER FOR I2C
ControlEverything.com 4-CHANNEL RELAY CONTROLLER FOR I2C
For controlling external devices.
×1
Humidity and Temperature Sensor
Adafruit Humidity and Temperature Sensor
To collect user feedback.
×1
Jumper wires (generic)
Jumper wires (generic)
For proper connections.
×1
60W PCIe 12V 5A Power Supply
Digilent 60W PCIe 12V 5A Power Supply
Power supply for the circuit.
×1
Linear Regulator (7805)
Linear Regulator (7805)
To step down 12V to 5V.
×1
Grove - WS2813 RGB LED Strip Waterproof - 60 LED/m - 1m
Seeed Studio Grove - WS2813 RGB LED Strip Waterproof - 60 LED/m - 1m
To indicate feedback visually.
×1

Software apps and online services

Arduino IDE
Arduino IDE
Code, upload, and debug firmware for NodeMCU.
ThingSpeak API
ThingSpeak API
Collect, store, and visualize public review data online.

Story

Read more

Schematics

๐’๐ฆ๐š๐ซ๐ญ ๐๐ฎ๐›๐ฅ๐ข๐œ ๐…๐ž๐ž๐๐›๐š๐œ๐ค ๐’๐ฒ๐ฌ๐ญ๐ž๐ฆ - ๐‚๐ข๐ซ๐œ๐ฎ๐ข๐ญ ๐Ž๐ฏ๐ž๐ซ๐ฏ๐ข๐ž๐ฐ

This circuit seamlessly integrates NodeMCU, three touch sensors, three LED strips, and a 4-channel relay module, all powered by a 12V adapter. The 7805 voltage regulator steps down 12V to 5V, ensuring safe operation for the NodeMCU and sensors. Each sensor triggers a corresponding LED strip via the relay, while feedback data is sent to ThingSpeak for real-time monitoring. This setup provides an efficient and scalable solution for public review collection in various environments.

Code

๐’๐ฆ๐š๐ซ๐ญ ๐๐ฎ๐›๐ฅ๐ข๐œ ๐…๐ž๐ž๐๐›๐š๐œ๐ค ๐’๐ฒ๐ฌ๐ญ๐ž๐ฆ - ๐‚๐จ๐๐ž ๐Ž๐ฏ๐ž๐ซ๐ฏ๐ข๐ž๐ฐ

C/C++
The system seamlessly detects sensor inputs and updates ThingSpeak.
LEDs provide instant feedback for user responses.

1. ๐š‚๐šข๐šœ๐š๐šŽ๐š– ๐šœ๐šŽ๐š๐šž๐š™ ๐šŠ๐š—๐š ๐šŒ๐š˜๐š—๐š—๐šŽ๐šŒ๐š๐š’๐šŸ๐š’๐š๐šข
Connecting NodeMCU to WiFi and initializing components.

2. ๐™ณ๐šŠ๐š๐šŠ ๐šƒ๐š›๐šŠ๐š—๐šœ๐š–๐š’๐šœ๐šœ๐š’๐š˜๐š— โ€“ Sending Feedback to ThingSpeak
When a sensor is triggered, the count is updated and logged online.

3. ๐™ฑ๐š˜๐š˜๐š๐š’๐š—๐š ๐š„๐š™ โ€“ Initializing the System
Setting up WiFi and configuring input/output pins.

4. ๐š๐šŽ๐šŠ๐š•-๐šƒ๐š’๐š–๐šŽ ๐š๐šŽ๐šŽ๐š๐š‹๐šŠ๐šŒ๐š” ๐šŒ๐š˜๐š•๐š•๐šŽ๐šŒ๐š๐š’๐š˜๐š—
Detecting sensor triggers and logging feedback.
#include <ESP8266WiFi.h>       // Library for ESP8266 WiFi connection
#include <ESP8266HTTPClient.h> // Library for HTTP requests

// WiFi credentials
const char* ssid = "name"; 
const char* password = "password";

// ThingSpeak API details
const char* apiKey = "api_key";
const char* thingspeakServer = "http://api.thingspeak.com/update";

// Initialize WiFi client
WiFiClient wifiClient;

// Sensor and LED pin assignments
int sensor1 = D5, led1 = D2;
int sensor2 = D6, led2 = D3;
int sensor3 = D7, led3 = D4;

// Counters for feedback collection
int count1 = 0, count2 = 0, count3 = 0;

//Sends collected data to ThingSpeak
void sendToThingSpeak(int count, int field) 
{
  if (WiFi.status() == WL_CONNECTED) // Check if WiFi is connected
  {
    HTTPClient http;
    
    // Construct ThingSpeak API URL
    String url = String(thingspeakServer) + "?api_key=" + apiKey + "&field" + String(field) + "=" + String(count);
    
    http.begin(wifiClient, url); // Start HTTP request
    http.GET();                  // Send GET request
    http.end();                   // Close connection
    
    delay(2000); // Delay to prevent frequent requests
  }
}

void setup() 
{
  Serial.begin(9600); // Initialize serial communication for debugging
  
  // Connect to WiFi
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) 
  {
    delay(500);
    Serial.print("."); // Print progress dots while connecting
  }
  Serial.println("\nWiFi connected");

  // Set sensor pins as input
  pinMode(sensor1, INPUT);
  pinMode(sensor2, INPUT);
  pinMode(sensor3, INPUT);
  
  // Set LED pins as output
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);
}

void loop() 
{
  // Check if sensor1 is triggered
  if (digitalRead(sensor1) == LOW) 
  {
    count1++;                 // Increment counter for sensor1
    digitalWrite(led1, HIGH); // Turn on LED1
    sendToThingSpeak(count1, 1); // Send data to ThingSpeak
    delay(200);               // Short delay
    digitalWrite(led1, LOW);  // Turn off LED1
  }

  // Check if sensor2 is triggered
  if (digitalRead(sensor2) == LOW) 
  {
    count2++;                 // Increment counter for sensor2
    digitalWrite(led2, HIGH); // Turn on LED2
    sendToThingSpeak(count2, 2); // Send data to ThingSpeak
    delay(200);               // Short delay
    digitalWrite(led2, LOW);  // Turn off LED2
  }

  // Check if sensor3 is triggered
  if (digitalRead(sensor3) == LOW) 
  {
    count3++;                 // Increment counter for sensor3
    digitalWrite(led3, HIGH); // Turn on LED3
    sendToThingSpeak(count3, 3); // Send data to ThingSpeak
    delay(200);               // Short delay
    digitalWrite(led3, LOW);  // Turn off LED3
  }
}

Credits

Kritika
6 projects โ€ข 4 followers
Vaishnavi
2 projects โ€ข 2 followers
Beginner
Vikas Sharma
4 projects โ€ข 7 followers
Dr. Umesh Dutta
42 projects โ€ข 61 followers
Working as Director of Innovation Centre at Manav Rachna, India. I am into development for the last 12 years.

Comments