30 / 10 / 2024
TASK 1 : Simon Says
What is Simon Says?
Simon Says is a memory game where a player must repeat a sequence of actions. In the classic version, a player listens to a sequence of colors and must press the corresponding buttons in the same order. If they make a mistake, the game ends, and they typically start over.
Building Simon Says with ESP32 Components Needed:
- ESP32 Microcontroller: The brain of the project.
- Pushbuttons: To allow user input.
- LEDs: To provide visual cues.
- Resistors: For button pull-down configuration.
- Breadboard and Jumper Wires: For connections.
Takeaways
- Microcontroller Familiarization: Working with the ESP32 helps in understanding GPIO manipulation and using libraries for interaction.
2.Logic Implementation: Implementing the game logic reinforces programming skills in a fun and interactive way.
3.Debugging Skills: The need to troubleshoot the game setup fosters problem-solving and critical thinking skills.
Difficulties faced : I tried this task so many times each time I didn't get the expected result at last I learnt to know how to use GPIO pins and build a logic based game.
https://github.com/user-attachments/assets/23afea25-cfbd-4dca-8261-138279522365
https://github.com/user-attachments/assets/c2ce7384-9813-4200-a5e2-5fa495c9beaf
Task 2 : Basics Of MQTT protocol and other communication protocols
Protocols
Introduction to MQTT
What is MQTT?
MQTT (Message Queuing Telemetry Transport) is a lightweight messaging protocol optimized for low-bandwidth, high-latency environments. It is widely used in IoT applications, allowing devices to communicate efficiently.
Key Features
- Publish/Subscribe Model: Devices subscribe to topics and receive messages without direct connections
- Lightweight: Minimizes data transmission, ideal for constrained networks.
- Quality of Service (QoS): OoS has three levels of message delivery reliability (0, 1, 2).
- Retained Messages: Brokers retain the last message for new subscribers.
Types of Communication Protocols in IoT :
- HTTP:
- Usage: Web communication.
- Pros: Widely adopted.
- Cons: High overhead, not ideal for real-time applications.
- CoAP:
- Usage: For resource-constrained devices.
- Pros: Lightweight, supports multicast.
- Cons: Less widely supported.
- AMQP:
- Usage: Enterprise messaging.
- Pros: Reliable and secure.
- Cons: More complex than MQTT.
- WebSocket:
- Usage: Real-time communication.
- Pros: Full-duplex communication.
- Cons: Complexity in implementation.
- Bluetooth Low Energy (BLE):
- Usage: Short-range communication.
- Pros: Low power consumption.
- Cons: Limited range.
Networking Protocols
- TCP/IP: Reliable communication with data integrity.
- UDP: Low latency, no delivery guarantee.
- IPv6: Vast address space, improved routing.
Takeaways
- MQTT: Understanding its features and applications in IoT.
- Communication Protocols: Familiarity with various protocols and their pros/cons.
- Networking Protocols: Importance in IoT data transmission.
Task 3: Basics of Creating a website
Introduction
Creating a website involves both front-end and back-end development. The front-end is what users see and interact with, while the back-end manages server-side operations.
Front-End Development
Technologies Used
- HTML: Structure of the webpage.
- CSS: Styling of the webpage.
- JavaScript: Adds interactivity.
Task 6: Sending Data to ThingSpeak
Introduction
This task involves using an ESP32 microcontroller to send temperature sensor data to ThingSpeak, a cloud-based IoT analytics platform. We will post the data using ThingSpeak's API, visualize it, and then retrieve the dataset for further analysis.
Steps Involved
1. Setting Up the ESP32
Required Components
- ESP32 microcontroller
- Temperature sensor (e.g., DHT11 or DS18B20)
- Jumper wires
2. Visualizing Data on ThingSpeak
- Graphing: After posting data, log in to ThingSpeak and create a channel to visualize the temperature data against time.
- Real-time Updates: ThingSpeak automatically updates the graph with incoming data.
Takeaways
- Publishing Data: Learned how to send data from an ESP32 to a cloud platform (ThingSpeak) using its API.
- Data Visualization: Gained experience in visualizing real-time data with graphs.
Task 7: Communication Using I2C Protocol
Introduction
In this task, we implemented communication between an ESP32 and an Arduino using the I2C (Inter-Integrated Circuit) protocol. The objective was to send a message from the ESP32 to the Arduino via I2C, with the message input through a web server hosted on the ESP32.
Implementation
ESP32 Code
The ESP32 was programmed to act as a web server, allowing users to input a message through a simple HTML form. Upon submission, the ESP32 sent the message to the Arduino over the I2C protocol. Key components of the implementation included:
- WiFi Setup: Connecting the ESP32 to a WiFi network to allow remote access.
- Web Server Initialization: Establishing routes to handle HTTP GET requests for the web interface.
- Message Transmission: Using the Wire library to send the user-provided message to the Arduino.
Arduino Code
The Arduino was configured to receive messages sent from the ESP32. The code included:
- I2C Initialization: Setting up the Arduino as an I2C slave with a specific address.
- Receive Event Handling: Implementing a function that triggers when a message is received over I2C, allowing the Arduino to read and process the message.
Workflow
- The user accessed the ESP32's web server using a browser.
- The user entered a message into the form and submitted it.
- The ESP32 transmitted the message to the Arduino via I2C.
- The Arduino received the message and processed it (e.g., printing it to the Serial Monitor for confirmation).
Learning Outcomes
- Understanding I2C Protocol: This task provided a clear understanding of the I2C protocol, which enables multiple devices to communicate over a two-wire interface. It highlighted the simplicity of I2C for connecting microcontrollers.
- Web Server Interaction: Gained practical experience in creating a web server on the ESP32, enabling user input for message transmission. This knowledge is essential for developing interactive IoT applications.
- Real-Time Data Handling: Learned how to implement real-time data transmission. The ability to send messages from the ESP32 to the Arduino immediately demonstrated the effectiveness of I2C in facilitating communication.
Task 8: Flashing Morse Code
Introduction
In this task, we set up an ESP32 microcontroller to flash Morse code using an LED. The message to be converted into Morse code was received from a web server hosted on the ESP32. This project demonstrates the practical application of web servers for communication and the conversion of textual input into visual signals.
Implementation
ESP32 Code
The ESP32 was programmed to host a web server that allowed users to input a message. The server processed the message, converted it to Morse code, and then flashed an LED accordingly. Key components included:
- WiFi Setup: Connecting the ESP32 to a WiFi network for remote access.
- Web Server Initialization: Creating routes to handle HTTP GET requests, enabling users to submit their messages via a web form.
- Morse Code Conversion: Implementing a function to convert text input into Morse code.
- LED Control: Using digital output to control the LED, flashing it according to the Morse code timing.
Workflow
- Web Interface: The user accessed the ESP32’s web server through a browser, where they could input a message.
- Message Submission: Upon submission, the ESP32 received the message and converted it to Morse code.
- LED Flashing: The ESP32 flashed the LED in Morse code, with dots represented by short flashes and dashes by longer flashes.
Learning Outcomes
- Understanding Morse Code: This task provided an opportunity to learn about Morse code and how to represent text as a series of flashes.
- Web Server Interaction: Gained practical experience in hosting a web server on the ESP32, allowing for real-time user interaction and data submission.
- Real-Time Communication: Demonstrated a real-life application of using a web server for communication, effectively transforming user input into visual signals.
Task 9: Soil Moisture Sensor
Introduction
In this task, we implemented a system to measure the soil moisture level using a capacitive soil moisture sensor. The moisture level was displayed on the serial monitor, and alerts were provided when the moisture level dropped below a specified threshold. This project aims to enhance plant care by monitoring soil moisture and enabling timely irrigation.
Implementation
Components Used
- Capacitive Soil Moisture Sensor: This sensor measures the moisture content in the soil by detecting changes in capacitance.
- Microcontroller (e.g., Arduino or ESP32): Used to read data from the sensor and manage alerts.
- Buzzer or LED (optional): To provide visual or audible alerts when the soil moisture level is low.
Code Implementation
The microcontroller was programmed to perform the following tasks:
- Sensor Initialization: Setting up the capacitive soil moisture sensor to read analog values.
- Moisture Level Measurement: Continuously reading the moisture level from the sensor.
- Threshold Comparison: Comparing the measured value against a predefined threshold to determine if watering is necessary.
- User Alerts: Sending alerts to the user through the serial monitor when the moisture level is below the threshold.
Learning Outcomes
- Soil Moisture Measurement: Learned how to effectively use a capacitive soil moisture sensor to measure moisture levels in soil.
- Data Processing and Monitoring: Developed skills in processing sensor data and displaying it on the serial monitor, enabling real-time monitoring of soil conditions.
- User Alerts: Gained experience in setting thresholds for moisture levels and providing alerts to encourage timely irrigation.
- Embedded Programming: Enhanced programming skills by working with analog sensors and microcontroller logic.