Vikash Intership 12
Vikash Intership 12
B.Tech - ECE
Sagar Institute of Science and Technology, Gandhi Nagar, Bhopal.
+91 9171740862
[email protected]
July 24, 2024 – March 21, 2025
TABLE OF CONTENTS
TITLE PAGE NO.
1. EXECUTIVE SUMMARY 1
1.1 Introduction 1
1.2 Project Objectives 2
1.3 Features and Functionalities 2
2. TECHNOLOGIES OVERVIEWS 2
2.1 Firebase Cloud 2
2.2 Arduino IDE 3
2.3 Morey OS 4
2.4 PCB Design 5
2.5 BMP581 Sensor 7
2.6 SX1278 Lora Module 8
2.7 SC Servo Driver with ESP32 9
3. INTERNSHIP GOAL 11
3.1 Role and Responsibilities 11
3.2 Learning Goals 12
3.3 Thanks Giving 13
4. PROJECT DESCRIPTIONS 14
4.1 Scope and Objectives 14
4.2 Robotic Arm 14
4.3 Adicine Box 16
4.4 Gateway 18
5. TESTING PROCESS 19
5.1 Nokia5110 19
5.2 TFT9341 LCD 20
6. CHALLENGES FACED 22
6.1 Technical Challenges 22
6.2 Troubleshooting and Problem-Solving 23
6.3 Communication and Collaboration 24
7. PROJECT RESULTS 24
7.1 Automation 24
7.2 Reminder 24
7.3 Monitoring 24
7.4 Short Range Communication 24
8. PROTOCOLS USED 26
8.1 I2C 26
8.2 UART 26
8.3 SPI 26
8.4 HTTP/HTTPS 26
8.5 LoraWAN 27
8.6 Firebase REST API 27
8.7 RF Communication Customer Protocol 27
9. CONCLUSION 27
10. MONTH-WISE DETAILED WORK REPORT 28
DrmzTech System Innovations Pvt. Ltd.
1. EXECUTIVE SUMMARY
INTRODUCTION
This internship report provides an in-depth overview of my professional journey at DRMZ
SYSTEM INNOVATIONS PVT. Ltd., where I had the opportunity to apply and expand my
technical knowledge through real-world projects in the domain of embedded systems and IoT.
Throughout the duration of the internship, I was actively involved in designing and developing
IoT-based solutions using microcontrollers such as ESP8266 and ESP32, where I
implemented wireless connectivity and integrated Firebase Realtime Database for monitoring
and controlling data in real time. I gained substantial experience working with serial
communication protocols using modules like CP2102 and CP1310, which enabled seamless
data exchange between devices and allowed me to understand the fundamentals of UART
communication in embedded systems.
One of the key aspects of my internship involved developing logic to control and automate
GPIO operations based on received inputs and acknowledgment patterns, contributing to
efficient device-state management. I also contributed to RF communication projects using
LoRa (SX1278) and standard RF transmitter/receiver modules, which strengthened my
understanding of long-range wireless communication in IoT networks. In addition to coding
and hardware integration, I engaged in troubleshooting and debugging tasks, where I learned
how to identify and resolve real-time issues in hardware setups and firmware logic.
My work further extended to supporting PCB-level testing and verification, which allowed
me to become familiar with the practical considerations in circuit design and implementation.
The internship provided a collaborative environment where I worked alongside experienced
engineers, helping me understand the standard product development lifecycle, from concept
and design to implementation and validation. Overall, this experience has been instrumental in
enhancing my technical capabilities, sharpening my problem-solving skills, and preparing me
to confidently tackle challenges in embedded systems and IoT development in a professional
setting.
Project Objectives
The main objectives of the internship included:
• Skill Development: Building expertise in emerging technologies such as
Firebase Integration, PCB design, robotics, Embedded System and Testing.
• Project Implementation: Applying theoretical concepts to develop
practical, real-world solutions.
1
DrmzTech System Innovations Pvt. Ltd.
2. TECHNOLOGY OVERVIEW
2.1 Firebase
During my internship, I utilized Firebase Cloud services to enable real-time
communication between IoT devices (ESP8266/ESP32) and a cloud-based
platform. Firebase, developed by Google, is a powerful Backend-as-a-Service
2
DrmzTech System Innovations Pvt. Ltd.
• Arduino IDE was used to write logic for GPIO control, serial communication, and
Firebase integration.
3
DrmzTech System Innovations Pvt. Ltd.
Library Management
• Utilized Arduino’s Library Manager to install essential libraries for Firebase and Wi-
Fi connectivity.
• Ensured compatibility with ESP boards through proper versioning.
• Added ESP8266 and ESP32 board support through Board Manager URLs.
• Enabled flashing of firmware directly to the modules via USB or CP2102 USB-to-
Serial adapter.
• Used the built-in Serial Monitor to view real-time logs, debug data flow, and verify
acknowledgments from the RF module or Firebase server.
• Code was uploaded via USB to the ESP module using CP2102 interface.
• Configured baud rates and COM ports as per the module’s specifications.
2.3 Morey OS
Morey OS is a lightweight, modular operating system designed specifically for resource-
constrained embedded platforms (e.g., AVR- or ARM-based microcontrollers). It provides just
enough structure and abstraction to enable responsive, multitasking firmware without the
complexity or overhead of a full-fledged desktop or server OS. Embedded in your custom IDE
alongside headers like Digital.h, Serial.h, and util/delay_blocking.h, Morey OS serves as the
backbone for task scheduling, hardware abstraction, and timing services in your projects.
Key Features
• Preemptive Task Scheduler
o Supports multiple concurrent “threads” (tasks), each with its own priority.
o Time-slice or priority-based preemption ensures high-priority tasks (e.g., sensor
sampling) meet real-time deadlines.
• Lightweight Footprint
o Minimal RAM and Flash usage—ideal for small MCUs.
o Configurable kernel size: include only the services you need.
4
DrmzTech System Innovations Pvt. Ltd.
PCB (Printed Circuit Board) Design is a crucial part of electronics design, as it serves as the
foundation for building and connecting electronic components. The design of a PCB involves
creating the layout and connections for electrical components that will be mounted on the
5
DrmzTech System Innovations Pvt. Ltd.
board. This ensures that electrical signals can flow properly between components and that the
overall system functions as expected.
6
DrmzTech System Innovations Pvt. Ltd.
o Perform a DRC to ensure that all traces, pads, vias, and other elements comply
with the design rules (e.g., minimum trace width, clearance between traces,
etc.).
o This check helps to prevent manufacturing errors and ensures that the board will
be functional and manufacturable.
6. Gerber File Generation:
o After completing the layout and design verification, generate Gerber files,
which are industry-standard files used by PCB manufacturers to produce the
board.
o Gerber files include information about the layers (copper, solder mask,
silkscreen), drill files (for vias and component holes), and other necessary
manufacturing details.
7. Bill of Materials (BOM):
o A BOM is a list of all components used in the PCB design, including part
numbers, quantities, and descriptions.
o The BOM helps with component procurement and ensures that all parts are
available for assembly.
8. Assembly and Testing:
o After manufacturing, the PCB goes through assembly where components are
soldered to the board.
o After assembly, perform testing to ensure the board functions correctly. This
could include visual inspection, electrical testing (e.g., continuity checks), and
functional testing (e.g., verifying signal paths).
3.5 BMP581 Sensor
The BMP580/BMP581/BMP585 is an absolute barometric pressure sensor. Its small
dimensions, its low power consumption and the highend performance allow the
implementation in a wide range of applications.
Target Application
• Enhancement of GPS navigation (e.g. dead-reckoning, slope detection)
• Indoor navigation (floor detection, elevator detection)
• Outdoor navigation
• Sports applications like calorie counting, fitness activity identification
• Emergency caller location
• Weather forecast
7
DrmzTech System Innovations Pvt. Ltd.
8
DrmzTech System Innovations Pvt. Ltd.
Lora -Transmitter
Lora-Receiver
9
DrmzTech System Innovations Pvt. Ltd.
This ESP32-based bus servo control board is designed for versatile robotic applications. It
supports the control of up to 253 bus servos via a web interface, enabling servo programming
to modify IDs and modes (servo/motor). The board provides real-time feedback on servo
parameters such as angle, load, voltage, and mode. It features a serial communication interface
for integration with higher-level systems and an onboard OLED screen to display essential
information. This makes it ideal for robotics projects like robotic arms, hexapods, humanoids,
and wheeled robots that require precise servo control and feedback.
Features
• Allows controlling up to 253 SC, ST series serial bus servos at the same time (adequate
power supply required).
• Wide range voltage input 6-12V (the input voltage and the servo voltage must be
matched).
• Built-in WiFi and Bluetooth, as well as ESP-NOW support, for remote control and
servo debugging.
• Compact size and space-saving, suitable for integration into sorts of space-limited
projects.
10
DrmzTech System Innovations Pvt. Ltd.
3. INTERNSHIP OVERVIEW
Role and Responsibilities
1. Embedded Systems Development:
• Programmed microcontrollers (ESP8266, ESP32, Arduino Uno) using
Arduino IDE.
• Developed and debugged real-time embedded applications involving sensor
data processing and GPIO control.
2. Wireless Communication Implementation:
• Worked with LoRa (SX1278) and LoRaWAN (Dragino LA66) modules for
long-range communication.
• Designed and tested custom protocols for serial data exchange using RF
modules (e.g., RW630 and RW54).
3. IoT Integration with Firebase:
• Integrated ESP8266/ESP32 modules with Firebase Realtime Database using
HTTPS/REST protocols.
• Created structured JSON paths for controlling GPIO states and updating
real-time data from sensors.
4. Serial Communication Protocol Design:
• Developed custom communication formats for acknowledgment and data
handling (e.g., #FE80...{(M1,AbcdeFGH)}).
• Handled UART communication with modules like CP2102, CP1310 for
real-time data transfer.
5. Sensor and Actuator Interface:
• Interfaced various peripherals including PIR sensors, ultrasonic sensors, and
relays.
• Created logic for GPIO control based on sensor input and remote command
reception.
6. Real-Time Monitoring & Control:
• Designed systems to send sensor data (temperature, humidity, etc.)
wirelessly and display/control remotely.
• Implemented feedback mechanisms and data logging via Firebase.
7. Debugging and Optimization:
• Performed troubleshooting of hardware and software issues during data
transmission.
11
DrmzTech System Innovations Pvt. Ltd.
12
DrmzTech System Innovations Pvt. Ltd.
DRMZ Team:
I would like to extend my heartfelt thanks to the entire DRMZ team for the incredible
opportunity to join as an intern. This journey has been nothing short of amazing—a truly
enriching learning experience that has contributed immensely to my personal and professional
growth. I’m deeply appreciative of the trust, encouragement, and guidance you’ve offered me
throughout my time here. Being part of such a dynamic, skilled, and forward-thinking team has
been both inspiring and fulfilling. Thank you for welcoming me and for making this internship
so memorable.
For My Colleagues and Senior: A heartfelt thank you to my amazing colleagues for your
constant guidance, collaboration, and encouragement. Your support and willingness to share
knowledge have made this internship both enjoyable and enriching. I have learned so much
from working alongside all of you, and I deeply appreciate the positive and welcoming
environment you’ve created.
Thank you all for making my internship experience truly memorable!
13
DrmzTech System Innovations Pvt. Ltd.
Each project was designed to address specific real-world challenges. The scope
included:
• Robotic Arm: Designed and developed a robotic arm using SC servos for precise
movement control.
• Smart Switch Board : Enhancing ease of control for household appliances.
• Adicine medical box : A Medical Reminder and Carry box with
Apk.
RoArm-M1 is a versatile robotic arm based on the ESP32 architecture, designed for precision
and flexibility. It has 5 degrees of freedom, including a gripper for holding objects, and uses
high-torque ST3215 serial bus servos (30kg.cm capacity) for smooth and powerful movement.
The arm provides real-time feedback on position, voltage, current, and temperature, ensuring
precise control and safety.
It comes with built-in WiFi, an OLED display, and RGB-LED lights, making it easy to monitor
and control. RoArm-M1 supports multiple control modes, such as angle control, inverse
kinematics, motion replay, and leading-following via ESP-NOW. It can connect to PCs,
Raspberry Pi, or Jetson Nano through USB, allowing for JSON-formatted serial
communication for accurate command execution.
With open-source support, RoArm-M1 is ideal for robotics research, AI-driven automation,
and education, offering an easy-to-use yet powerful robotic solution.
The scope of the project includes the end-to-end design, integration, and control of a robotic
arm system that demonstrates real-time servo coordination and programmable movements. The
major areas of focus are:
a) Mechanical Design and Assembly The robotic arm consists of a where each joint is driven
by a dedicated SC series servo motor. The mechanical structure was designed to ensure stability
and flexibility, with carefully selected materials to withstand the required payload and torque.
14
DrmzTech System Innovations Pvt. Ltd.
b) Actuation with SC Servos The system uses SC servos due to their reliable serial bus
communication, real-time feedback, and programmable motion modes (servo/motor mode).
Their ability to be daisy-chained simplifies the wiring and scalability of the system.
c) End Effector Development A [e.g., two-finger gripper] is developed as the arm’s end
effector. It is designed to handle light-to-medium weight objects, with a focus on grip precision
and adaptability to different shapes.
d) Control System Architecture The robotic arm is controlled via ESP32 platform. This
microcontroller handles communication with the SC servos over UART and runs the logic for
motion commands, feedback monitoring, and task sequences.
e) Software and Interface Control software is developed to operate the robotic arm manually
and through pre-defined sequences. Depending on the system, this may include:
f) Feedback Implementation The servo’s built-in feedback (position, load, speed) is utilized
for:
g) Power Management A robust power system is designed to supply consistent voltage and
current to the servos, considering peak loads and safety limits. Proper regulation and
distribution are ensured
to avoid brownouts or servo reset issues.
• To achieve accurate and synchronized control of servo motors through serial bus
communication.
• To develop a control system capable of executing pick-and-place operations.
• To utilize real-time feedback from the servos for precise joint movement and system
diagnostics.
• To create a user interface (manual or programmable) for controlling the arm’s
movement
• To implement basic automation tasks such as object manipulation or repeatable
movement sequences.
• To ensure safe operation with appropriate power management and overload
handling.
4.2 Adicine Medical Box
Smart Medical Box with Integrated Android Application In this project, a Smart Medical Box
has been designed and developed to support individuals—especially the elderly and chronically
ill—in managing their medication schedules more efficiently and safely. The system includes
both hardware and software components developed by me. System Overview: The hardware
features a microcontroller-based circuit with a real-time clock (RTC), display module
(LCD/OLED), buzzer, indicator LEDs, and support for Bluetooth and Wi-Fi communication.
The box stores different medicines in separate compartments, and each one is linked to a
scheduled time and name of the medicine. An Android application (APK) was developed to
allow users to set medicine reminders, connect to the box via Bluetooth/Wi-Fi, and update
medicine schedules.
Key Features:
16
DrmzTech System Innovations Pvt. Ltd.
• Real-Time Reminders: Alerts users with a buzzer and displays the medicine name at
the exact scheduled time.
• App Integration: Android application allows setting up medicine schedules, names,
dosages, and connecting via Bluetooth or Wi-Fi.
• Dual Connectivity: Works with both Bluetooth for local control and Wi-Fi for remote
monitoring or integration with Firebase/cloud storage.
• User-Friendly Interface: Simple, clean interface for both the hardware display and the
mobile app, suitable for elderly users.
• Missed Dose Notification: Optionally sends an alert if a scheduled dose is missed.
• Secure Compartment Control: Optional locking mechanism for compartments to
release only when it’s time for that specific medicine.
Benefits:
• Improved Medication Adherence: Ensures timely intake of prescribed medicine,
reducing health risks due to missed doses.
• Caregiver Support: Enables family members or healthcare providers to monitor or set
schedules remotely.
• All-in-One System: Combines scheduling, alerting, and real-time updates in one
system.
17
DrmzTech System Innovations Pvt. Ltd.
Smart Switch Board is an IoT-based system designed to control and monitor electrical
appliances remotely via the internet. This system uses a combination of microcontrollers,
Firebase Realtime Database, smart LEDs, and an optional gateway for centralized
management. It allows users to operate switches from a web interface and view the real-time
status of connected devices.
System Architecture
The core of the smart switch board is built around a microcontroller such as an ESP32 or
ESP8266, which connects to the internet over Wi-Fi. Each switch controls a relay that can
toggle an appliance (like a light or fan) ON or OFF. Smart LEDs are embedded alongside each
switch to visually indicate its current state.
The system is integrated with Google Firebase, a cloud-based real-time database that stores and
synchronizes the state of each switch. When a user toggles a switch from the web interface, the
new state is instantly updated in Firebase, and the microcontroller reflects this change by
actuating the corresponding relay and LED.
Gateway Integration gateway, dedicated ESP32 module, acts as a central controller for multiple
smart switch nodes. It aggregates data from different boards and communicates with Firebase
efficiently. The gateway also handles scenarios where internet connectivity is intermittent by
buffering data and pushing updates when the network is restored. This enhances system
reliability and scalability, especially in large deployments.
Features
18
DrmzTech System Innovations Pvt. Ltd.
5. TESTING
The Nokia 5110 LCD Display Module gets its name from the iconic Nokia 5110/3310 mobile
phones, where it was originally used as a display unit. Now, it has found a significant place
among electronics hobbyists and engineers for displaying graphics and text in embedded
systems and DIY projects.
Overview
The Nokia 5110 is a low-cost, monochrome graphic LCD module consisting of an 84x48 pixel
display. It is extremely easy to use and ideal for projects involving graphic output. The module
comes mounted on a solderable PCB and is controlled by the Philips PCD8544 LCD driver,
which integrates all the necessary functions for display control including internal generation of
supply and bias voltages.
19
DrmzTech System Innovations Pvt. Ltd.
Key Features
RST — D3
CE — D4
DC — D5
DIN — D6
CLK — D7
BL — GND
Vcc — 5V
GND — GND
Operation at Different Voltages
3.3V Operation: Although designed for 3.3V, it can work with 5V MCUs by using simple 10kΩ
resistors as level shifters. Due to the PCD8544’s internal clamps, these resistors safely limit
current without needing complex level shifting circuits.5V Operation: The module can also
operate directly at 5V, which simplifies interfacing. However, using the same 10kΩ resistors is
recommended to reduce streaks or artifacts on the display.
The Nokia 5110 LCD is widely adopted in embedded systems, offering a reliable and low-
power solution for visual outputs. It can be easily integrated and is backed by numerous
community tutorials and examples, making it a go-to display for beginners and experts alike.
This 2.8-inch ILI9341 TFT display with a 6:00 o'clock viewing direction is well-suited for
devices that need to be easily readable above eye level without fading. It provides a reliable
solution for industrial applications, including
• Testing Equipment: The high resolution and color accuracy of TFT LCD modules make
them ideal for visual inspection applications, such as quality control in manufacturing,
agricultural inspection, and surveillance.
• Medical Devices: The display module can be used in medical devices, such as in patient
monitoring systems, medical imaging systems, and medical laboratory equipment. Its
high resolution, color accuracy, and durability make it ideal for displaying critical
patient information and control settings.
Its compact size, low power consumption, and easy integration make it an ideal choice for
many applications.
21
DrmzTech System Innovations Pvt. Ltd.
6. CHALLENGES FACED
During the course of my internship, I encountered several technical challenges that helped me
grow both as a learner and as a problem-solver. Some of the key challenges are detailed below:
1. Interfacing and Compatibility Issues : One of the first hurdles I faced was interfacing
various modules such as the Nokia 5110 LCD with microcontrollers like the Arduino UNO and
ESP8266. Differences in operating voltages (3.3V vs. 5V) and SPI communication protocols
required careful handling and proper level shifting to ensure stable operation.
2. Display Distortion and Voltage Stability : While working with the Nokia 5110 LCD, I
observed screen flickering and display distortion. This issue was traced back to unstable supply
22
DrmzTech System Innovations Pvt. Ltd.
voltage and insufficient current limiting resistors. Solving it required experimenting with
various resistor values and improving the power supply configuration.
5. Debugging and Testing Time: Debugging real-time embedded systems is always time-
consuming. Errors in hardware connections, wrong pin configurations, and subtle logic bugs
often required a systematic approach of testing each component individually, monitoring serial
output, and using LEDs for state indication.
23
DrmzTech System Innovations Pvt. Ltd.
Solution: Fixed incorrect Firebase host URL and updated the authentication token. Ensured
the database path used in the code matched the Firebase structure.
2. Issue: Incorrect GPIO Pin Responses Based on Serial Acknowledgment
Problem: The ESP module was not accurately updating GPIO states based on received
acknowledgment data.Troubleshooting: Parsed and analyzed the serial string format for
anomalies. Verified logic conditions for uppercase (ON) and lowercase (OFF) values.Ensured
synchronization between sent and received acknowledgment patterns.
Solution: Optimized the parsing function using character-by-character comparison and
ensured array bounds were respected. Validated all 8 GPIO states before pushing to Firebase.
3. Issue: LoRa Module Not Receiving Data Problem: The SX1278 LoRa module wasn't
receiving data from the sender.
Troubleshooting: Verified wiring and power supply. Checked both sender and receiver were
set to the same frequency and bandwidth. Used LEDs and Serial.print to confirm the
transmission was happening.
Solution: Corrected mismatched frequency and enabled automatic gain control for better
reception. Data started flowing as expected.
4. Issue: Serial Data Containing Garbage Values
Problem: Received serial strings had unwanted characters, affecting data parsing.
Troubleshooting:Isolated the issue to incorrect baud rate settings.
Added buffer clearing and delay after reading serial data.
Solution: Set the correct baud rate on both modules and filtered non-printable characters in the
received string.
6.3 COMMUNICATION AND COLLABORATION
Collaborating with team members and receiving continuous support and feedback from our
team leader played a vital role in the smooth execution of our internship project. From the
beginning, we emphasized the importance of communication by conducting regular team
meetings to track progress, set short-term goals, and identify any technical or organizational
challenges. These meetings provided a platform to share individual insights, learn from one
another, and brainstorm innovative solutions. When faced with technical difficulties, our
collaborative approach enabled us to troubleshoot issues more efficiently by leveraging the
diverse skill sets and perspectives within the team. This collective problem-solving process not
only enhanced our technical knowledge but also strengthened our teamwork and adaptability.
7. PROJECT RESULTS
24
DrmzTech System Innovations Pvt. Ltd.
7.1 AUTOMATION
The implementation of automation in my internship project delivered efficient and reliable
results. Devices such as LEDs, motors, and relays were successfully controlled in real time
using Firebase cloud updates. The automated system responded instantly to user commands,
eliminating manual switching and reducing errors. The acknowledgment mechanism ensured
accurate execution and provided feedback for each action. Automation also enabled continuous
monitoring and logging of device states, improving transparency and enabling future analytics.
Overall, the project demonstrated how automation enhances performance, scalability, and user
convenience in IoT systems. It proved especially effective for applications in smart homes and
remote device management, showcasing the practical benefits of automated control in real-
world scenarios.
7.2 MONITORING
Monitoring was a crucial aspect of my internship project, ensuring real-time visibility and
control of connected devices. Using Firebase Realtime Database, the system continuously
tracked the status of each device, including GPIO outputs and acknowledgment responses. Any
change in the system—whether triggered manually or automatically—was instantly reflected
on the cloud interface, allowing users to view the live status from anywhere. This remote
monitoring capability reduced the need for physical inspections and enabled proactive
responses to faults or command failures. Historical data logging also supported future analysis
and system optimization. The monitoring feature enhanced system transparency, reliability, and
user trust, making the solution suitable for applications such as smart energy systems, home
automation, and industrial control.
7.3 SHORT RANGE COMMUNICATION
Short-range communication was implemented using RF modules like the SX1278 and RW630,
enabling wireless data exchange between devices without relying on the internet. This method
was useful for transmitting control commands and receiving acknowledgments over distances
up to several hundred meters. The system used serial communication protocols to ensure
reliable message delivery and low latency. Short-range communication added robustness to the
project, especially in scenarios with limited internet access, and proved effective for quick,
local control in smart automation setups.
7.4 REMINDER
The reminder functionality of the Smart Medical Box was successfully implemented and tested.
The system effectively provides timely alerts to users based on the schedule set through the
custom Android application. At the predefined time, the box triggers a buzzer sound, displays
25
DrmzTech System Innovations Pvt. Ltd.
the name of the medicine on the screen, and activates an LED indicator near the respective
compartment. This ensures that the user is clearly informed about which medicine to take and
when.
The synchronization between the mobile app and the hardware through Bluetooth/Wi-Fi
modules worked reliably, allowing real-time schedule updates and notifications. The reminder
system proved especially beneficial for elderly users and those on complex medication
routines, significantly reducing the chances of missed or incorrect dosages.
Overall, the reminder feature enhanced the usability and practicality of the Smart Medical Box,
making it a reliable solution for daily medicine management.
8. PROTOCOLS USED
• I2C (Inter-Integrated Circuit): I2C is a two-wire communication protocol used for
connecting low-speed devices like sensors, EEPROMs, and ADCs in embedded
systems. It supports multiple masters and slaves using a clock (SCL) and data (SDA)
line. Its simplicity and low pin count make it ideal for communication between ICs on
the same board.
• UART (Universal Asynchronous Receiver/Transmitter): UART is a hardware
communication protocol used for asynchronous serial communication between two
devices. It transmits data in a byte-wise fashion using only two lines: TX (transmit) and
RX (receive). Common in microcontroller systems, UART doesn't require a clock
signal, making it simple and reliable for point-to-point communication.
• SPI (Serial Peripheral Interface): SPI is a high-speed, full-duplex serial
communication protocol commonly used to interface microcontrollers with peripherals
like sensors, memory chips, and displays. It uses four lines: MISO, MOSI, SCLK, and
SS. SPI is faster than I2C but requires more pins, making it suitable for applications
needing high-speed data exchange.
• HTTP/HTTPS (Hypertext Transfer Protocol): HTTP is a protocol used for
communication between web clients and servers, mainly for accessing web pages.
HTTPS is the secure version that uses encryption via SSL/TLS. Both are stateless and
used widely in IoT to send sensor data or receive commands from cloud platforms using
RESTful APIs.
26
DrmzTech System Innovations Pvt. Ltd.
27
DrmzTech System Innovations Pvt. Ltd.
Leave Taken: July(2 d), Aug(4 d), Sept(3 d), Octo(6 d), Nov(8 d), Dec(11 d), Jan(3 d), Feb(3
d) Mar(4 d).
28
DrmzTech System Innovations Pvt. Ltd.
29
DrmzTech System Innovations Pvt. Ltd.
30
DrmzTech System Innovations Pvt. Ltd.
31
DrmzTech System Innovations Pvt. Ltd.
32
DrmzTech System Innovations Pvt. Ltd.
11. References
1. https://github.com/sudeshmoreyos/Morey_os-demo-1.0
2. https://www.waveshare.com/modbus-poe-eth-relay.htm1
3 https://www.bosch-sensortec.com/products/environmental-sensors/pressure-
sensors/bmp581
4. http://how2electronics.com/interfacing-sx1278-lora-module-with-arduino/
5. https://firebase.google.com/
6. https://docs.arduino.cc/libraries//
7. https://cdn-shop.adafruit.com/datasheets/ILI9341.pdf/
12 APPENDIX
12.1 Firebase Code for sending command and Acknowledged to Gateway
#include <ESP8266WiFi.h>
#include <Firebase_ESP_Client.h>
#include "addons/TokenHelper.h"
#include "addons/RTDBHelper.h"
// Wi-Fi credentials
#define WIFI_SSID "Iqoo"
#define WIFI_PASSWORD "11111111"
33
DrmzTech System Innovations Pvt. Ltd.
// Firebase objects
FirebaseData stream;
FirebaseData fbdo;
FirebaseAuth auth;
FirebaseConfig config;
// Initialize Wi-Fi
void initWiFi() {
Serial.println("Connecting to Wi-Fi...");
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
while (WiFi.status() != WL_CONNECTED) {
delay(100); // Faster retry intervals
Serial.print(".");
}
Serial.println("\nConnected to Wi-Fi.");
}
34
DrmzTech System Innovations Pvt. Ltd.
}
}
if (incomingChar == '}') {
int startIndex = incomingData.indexOf("{(M1,") + 5;
int endIndex = incomingData.indexOf(")}");
// Update the state based on whether the subkey is upper or lower case
int state = isUpperCase(subkeys.charAt(i)) ? 1 : 0;
35
DrmzTech System Innovations Pvt. Ltd.
if (!hasUpdates) {
Serial.println("No updates were made.");
}
}
incomingData = ""; // Clear the incoming data after processing
}
}
}
36
DrmzTech System Innovations Pvt. Ltd.
if (path.startsWith("/")) {
path = "/users/" + userId + "/reception" + path; // Adjust the path to match the expected
structure
}
// Check if the subKey starts with 'A' (indicating a GPIO key or state key)
if (subKey.startsWith("A")) {
37
DrmzTech System Innovations Pvt. Ltd.
// Check if the incoming data type is integer and matches the GPIO state
if (data.dataTypeEnum() == fb_esp_rtdb_data_type_integer) {
int state = data.intData(); // Get the state (0 or 1)
Serial.println("State for A" + String(gpioNum) + ": " + String(state)); //
Debugging
38
DrmzTech System Innovations Pvt. Ltd.
} else {
Serial.println("Handling GPIO key: " + subKey); // Debugging
}
} else {
Serial.println("SubKey does not start with A."); // Debugging
}
} else {
Serial.println("Path is not within the reception structure."); // Debugging
}
}
void setup() {
Serial.begin(4800); // Initialize serial at 4800 baud rate
initWiFi(); // Initialize Wi-Fi
// Firebase config
config.api_key = API_KEY;
config.database_url = DATABASE_URL;
auth.user.email = USER_EMAIL;
auth.user.password = USER_PASSWORD;
39
DrmzTech System Innovations Pvt. Ltd.
void loop() {
checkWiFiConnection(); // Ensure Wi-Fi connection
handleSerialInput(); // Handle incoming serial input
delay(100); // Add a small delay to avoid overwhelming the loop
}
12.2 Gateway code to read serials
.c file
#include "morey_os.h"
#include "Serial.h"
40
DrmzTech System Innovations Pvt. Ltd.
void setup(void)
{
Serial.begin(4800,SERIAL_8N1);
Serial1.begin(4800,SERIAL_8N1);
Serial2.begin(4800,SERIAL_8N1);
Serial3.begin(4800,SERIAL_8N1);
TASK_CREATE(serial_copy0,"Serial copy021");
TASK_AUTOSTART(&serial_copy0);
TASK_RUN(serial_copy0)
{
BEGIN();
while(1)
{
Serial.println("Serial_0");
if(Serial.available()>0){
Serial1.println("Serial_0");
}
DELAY_SEC(1);
}
END();
}
Config file
#ifndef CONFIG_H
41
DrmzTech System Innovations Pvt. Ltd.
#define CONFIG_H
#define SERIAL_ENABLE
#define SERIAL1_ENABLE
#define SERIAL2_ENABLE
#define SERIAL3_ENABLE
#endif
Makefile code
PROJECT = test_gateway_march7
MOREY_OS_PATH = ../..
ARCH = AVR_MEGA
CONTROLLER = MEGA2560
include $(MOREY_OS_PATH)/Makefile.include
#include <SCServo.h>
void setup() {
Serial.begin(115200); // Debug communication
Serial1.begin(1000000, SERIAL_8N1, S_RXD, S_TXD); // Servo communication
42
DrmzTech System Innovations Pvt. Ltd.
delay(1000);
Serial.println("Enter command in the format: {ID,Degree,Speed}");
}
43
DrmzTech System Innovations Pvt. Ltd.
if (id == 2) {
if (position >= 820 && position <= 970) {
if (posID4 < 400) return true; // id4 should be initially < 400 for id2 movement in this
range
return false; // If id4 is not < 400 initially, restrict movement
}
if (position < 840 && position >= 740 && !((posID3 > 70 && posID4 < 420) || (posID3 >
300))) return false;
if (position < 740 && position >= 600 && !((posID3 > 130 && posID4 < 420) || (posID3
> 300))) return false;
if (position < 600 && position >= 400 && !(posID3 > 450)) return false;
if (position < 400 && position >= 230 && !((posID3 > 350) || (posID3 > 680 && posID4
== 220))) return false;
}
44
DrmzTech System Innovations Pvt. Ltd.
return true;
}
void loop() {
if (Serial.available()) {
String input = Serial.readStringUntil('\n');
input.trim();
45
DrmzTech System Innovations Pvt. Ltd.
if (position == -1) {
Serial.println("Invalid servo ID. Use IDs between 1 and 6.");
return;
}
if (!isValidMove(id, position)) {
Serial.println("Invalid move. Condition not met.");
return;
}
if (id == 1) {
sms_sts.WritePosEx(id, position, speed, acc);
} else {
sc.WritePosEx(id, position, speed, acc);
}
delay(500);
46
DrmzTech System Innovations Pvt. Ltd.
Serial.print(id);
Serial.print(" New Position: ");
Serial.println(currentPos);
} else {
Serial.print("Servo ID ");
Serial.print(id);
Serial.println(": Read Position Error");
}
} else {
Serial.println("Invalid input format. Use {ID,Degree,Speed}");
}
} else {
Serial.println("Invalid format. Use {ID,Degree,Speed}");
}
}
}
int counter = 0;
void setup() {
Serial.begin(9600);
while (!Serial);
Serial.println("LoRa Sender");
47
DrmzTech System Innovations Pvt. Ltd.
void loop() {
Serial.print("Sending packet: ");
Serial.println(counter);
counter++;
delay(5000); // Wait 5 seconds before sending next packet
}
Receiver Code
#include <SPI.h>
#include <LoRa.h>
void setup() {
Serial.begin(9600);
while (!Serial);
48
DrmzTech System Innovations Pvt. Ltd.
Serial.println("LoRa Receiver");
void loop() {
// try to parse packet
int packetSize = LoRa.parsePacket();
if (packetSize) {
// received a packet
Serial.print("Received packet: ");
// read packet
while (LoRa.available()) {
Serial.print((char)LoRa.read());
}
// print RSSI (signal strength)
Serial.print(" with RSSI ");
Serial.println(LoRa.packetRssi());
}
}
49
DrmzTech System Innovations Pvt. Ltd.
50