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 provided144
𝐒𝐦𝐚𝐫𝐭𝐒𝐞𝐧𝐬𝐞 - 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
5 projects • 3 followers
Contact
Vaishnavi
2 projects • 1 follower
Beginner
Contact
Vikas Sharma
4 projects • 6 followers
Contact
Dr. Umesh Dutta
42 projects • 60 followers
Working as Director of Innovation Centre at Manav Rachna, India. I am into development for the last 12 years.
Contact

Comments

Please log in or sign up to comment.