Vasudhendra Badami

Author
Vasudhendra Badami

Blogs
With years spent in HR trenches, Vasudhendra is passionate about what makes organizations tick—people. Their writing dives deep into behavioral interviews, talent strategy, and employee experience.
author’s Articles

Insights & Stories by Vasudhendra Badami

Whether you're building your first team or scaling culture across regions, Vasudhendra Badami's articles offer human-first insights rooted in real practice.
Clear all
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Filter
Filter

MQTT protocol - Powering Facebook messenger to IoT devices

In 2011, Lucy Zhang, Ben Davenport and Jon Perlow joined Facebook and started building the Facebook messenger. A major hurdle in their endeavor was long latency when sending a message. The method that they were using to send messages was reliable but slow. They were also able to optimize it to a certain extent. A few weeks before the launch, they explored the Messaging Queuing Telemetry Transport (MQTT) protocol. With the help of MQTT, Lucy Zhang and team were able to establish and maintain a persistent connection with the Facebook servers without reducing the battery life.

So, what is MQTT protocol?

Created in 1999 by Dr. Andy Stanford-Clark of IBM and Arlen Nipper of Arcom, MQTT is a lightweight messaging protocol on top of TCP/IP protocol. MQTT is designed for constrained devices (devices with low memory and network bandwidth) and wireless networks with varying levels of latency due to unreliable connection.

MQTT protocol is a client-server, publisher/subscriber, open, and light-weight messaging transport protocol. At the heart of MQTT is the central communication point known as MQTT broker. It is responsible for dispersing messages to rightful clients.

Each client which publishes a message to the MQTT broker includes the routing information, known as topic. Clients may subscribe to multiple topics and broker all the messages published matching the topic. The clients don't have to know each other to receive information; they just have to subscribe to relevant topics.

For instance, imagine a simple network of three clients, i.e A, B and C, where each is connected to a broker via a TCP connection. Client-B and Client-C subscribe to topic: temperature.

MQTT Protocol architecture

Client-A publishes 34.5 for topic temperature. The broker identifies this and forwards this message to all the subscribers, which in this case are Client-B and Client-C.

Working of MQTT protocol

The publisher-subscriber architecture of MQTT makes it a highly scalable solution, without creating dependencies between data producers and consumers.

Message format of MQTT protocol

All the messages of MQTT have a small code footprint, hence it is popular as a lightweight messaging protocol. Each MQTT message consists of the following:

  • Fixed header (2 bytes)
  • Optional variable header
  • Message payload (<= 256MB)
  • Quality of Service (QoS) level

MQTT supports one-to-one, one-to-many, and many-to-many communication.

By lowering the amount of data transmitted, MQTT makes itself a perfect protocol for constrained IoT devices.

Message payloads are encoded in binary. In an open network where the recipient is from a different manufacturer will face issues decoding it as there is no information of how message payload is encoded.

Quality of Service (QoS) level for MQTT protocol

The quality of service levels determines how the content is managed. MQTT uses three different QoS levels. It is important to choose the right QoS level for every message because it determines how the client and server communicate to deliver the message. The QoS levels of MQTT are as follows:

  • QoS 0 : Messages delivered per the best efforts of the operating environment, but message loss can occur
  • QoS 1 : Messages delivery assured but duplicates can be created
  • QoS 2 : Message to deliver exactly once

MQTT provides us with an option to set the appropriate QoS level, but remember, higher the QoS, lower the performance.

Security of MQTT protocol

MQTT allows you to pass username and password as an MQTT packet. Encryption of a message across the network can be handled independently of MQTT with Secure Sockets Layer (SSL). It has a minimal authentication feature built in. Username and password are sent as clear text. To make it secure, Secure Sockets Layer (SSL)/ Transport Layer Security (TLS) must be employed, but SSL/TLS is not a lightweight protocol.

Many industry experts believe MQTT will play a major role in IoT by contributing to fields such as inventory tracking, and medical IoT..

How Fukushima nuclear disaster powered smart farming in Japan

On March 11, 2011, the most intense earthquake in Japanese history hit its north east coast — magnitude 9.0. The earthquake was so powerful that it severely damaged buildings, road, and rail infrastructure in Tokyo, which was 373 km away from the epicenter. This was an undersea megathrust earthquake.

Fifty minutes after the earthquake, tsunami waves as high as 13 meters hit the eastern part of Japan, leaving more than 15,500 dead, 6,000 injured, and 2,500 people missing. The tsunami struck so hard that it resulted in a Level-7 nuclear disaster in Fukushima (in Japanese, Fukushima means Fortune Island); it is the second nuclear disaster in the history of mankind which was given level-7 criticality after the Chernobyl disaster in 1986.

Fukushima had six separate boiling water reactors maintained by Tokyo Electric Power Company (TEPCO). Due to the powerful earthquake and tsunami, the nuclear power plant in Fukushima was subjected to serious structural damage. This resulted in hydrogen-air explosion on top of each nuclear reactor, releasing huge amounts of radioactive particles including Iodine-131, Caesium-134/137, Tellurium-129m, and Strontium 90 into the atmosphere. These radioactive particles contaminated air, soil, and water in and around Fukushima.

Unfortunately, Fukushima was one of the most agriculturally important regions in Japan. There are close to two million farmers in Japan, of which 70,000 are in Fukushima. The farmers of Fukushima had to deal with radioactive contamination of their soil, crops, livestock, and the marine ecosystem in addition to the tragedy caused by the tsunami. Due to radioactive contamination everywhere, the government of Japan imposed restrictions on the growing and selling of crops, dairy products, and seafood.

Now, Japan needed to increase its production to make up for the agricultural loss in Fukushima and, very importantly, it needed food products without radioactive contaminants. If this is not achieved, Japan would head toward a food crisis.

In Kameoka (a satellite town to the west of the Japanese city of Kyoto), the Japanese agriculture technology company SPREAD had started working on a smart farming system on barren land. SPREAD built a vegetable factory in a 2868.22 m2-area.

Inside the doors of this warehouse-like agriculture complex, SPREAD uses vertical farming system.

SPREAD vegetable factory grew lettuce in a soil-less and sunless ecosystem.

SPREAD vertical farming system.
Inside SPREAD vegetable factory

In an interview with CNN on September 19, 2016, Shinji Inada, the president of SPREAD, said, "The turning point was the incident in 2011 at the Fukushima nuclear facility. After what happened there, people became more aware of the importance of safe food and it kind of turned the tables for us."

Here a sophisticated form of hydroculture known as the Hydroponics method is used, where plants are grown in an aqueous solution of mineral nutrients with water as a solvent. In this method, terrestrial plants are grown with roots exposed to a mineral nutrient solution.

Hydroponics method of farming
Hydroponics method of farming

Since this is an indoor farm, LED lights on top of each shelf provide adequate light for photosynthesis and the growth of lettuce.

indoor farm with LED lights on top
Indoor vertical farm with LED lights on top

At this vegetable factory, human involvement is restricted to sowing the seeds; later, everything till the harvest is taken care of by robots and sensors.

With the help of modern sensor technology, the following factors are measured:

  • Lighting
  • Level of nutrients in the mineral solvent
  • Humidity level inside the setup
  • Temperature level inside the setup
  • Level of CO2

To maintain these factors at the optimal level, robots are installed which take corrective measures.

The lettuce is grown in a highly controlled environment at this facility. As a result of not using any fertilizer, the lettuce grown at this agriculture facility is richer in beta-carotene (an antioxidant) than farm-grown lettuce.

The setup has stacker cranes which carry the stacks to the robots for harvesting after they have reached maturity. It takes 40 days for a lettuce head to be ready for harvest, whereas it takes two months for farm-grown lettuce. After the harvest, the lettuces are moved to the packaging section without any outside intervention. There are either retail or packaging boxes wholesale used for that purpose. The SPREAD’s facility at Kameoka has an output capacity of 21,000 lettuces per day.

This innovative move by SPREAD is not only providing vegetables free from radioactive contamination but also contributing to the ecology to a great extent. Here is how:

Water Recycling

Water used for cultivation of lettuce in the vegetable factory is reused after filtration and purification. At this facility, 98% of water is recycled, and it significantly reduces the water consumption—a mere 0.83 liters is used to grow one head of lettuce.

Water recycling in SPREAD vegetable factory
Water recycling system at SPREAD vegetable factory

Zero damage due to pesticides

Since this vegetable factory uses the hydroponics method to cultivate lettuce, pesticides are not required during the cultivation lifecycle. Hence, soil and water contamination is prevented and the balance of microbes and insects in ecosystem is preserved.

Reduction in energy consumption

SPREAD has developed specialized LED lights and an air conditioning system to be used at their vegetable factory, reducing the energy consumption by 30%.

SPREAD is currently working on a second vegetable factory at Keihanna, with an output capacity of 30,000 heads of lettuce per day with 86.7% reduction in water usage.

Ubuntu Core 16: Building secure and interoperable IoT ecosystems

I have attended several IoT conferences, informal meetups, webinars, and podcasts. The most common questions during networking or Q&A sessions revolve around security and interoperability of IoT devices.

These concerns are valid, especially in light of recent Distributed Denial of Service (DDoS) attacks affecting Internet-connected devices.

To build consumer trust, companies in the IoT space—both hardware and software—are heavily investing in R&D to tackle these concerns sustainably.

In one such initiative, Canonical, the company behind Ubuntu, launched Ubuntu Core 16. Also known as Snappy, this is a minimal operating system designed for IoT devices. At its core are secure, remotely upgradeable Linux packages called 'snaps'.

Device Security

Ubuntu Core 16 secures IoT devices by delivering the entire operating system—including kernel, libraries, and applications—as snaps. The OS automatically updates to defend against new threats.

Snaps ensure security and reliability through the following features:

  • Read-only
  • Tamper-proof
  • Digitally signed
  • Stored as images

This architecture makes it very difficult to breach devices remotely without physical access.

Being transactional in nature, Ubuntu Core 16 automatically rolls back any failed updates, giving developers the freedom to innovate without compromising system stability.

The system retains multiple updates and selects the healthiest for installation. If an update fails, rollback ensures continuity.

Each Snap includes a meta/snap.yaml file, where developers can define:

  • Security requirements
  • Integration details with the system
  • Update schedules

This automates the update process, removing the need for human intervention.

Device Interoperability

Ubuntu Core 16 enables snaps to communicate and work together via:

  • Interfaces: Bridges between snaps
  • Plugs: Consumer snaps requesting services
  • Slots: Producer snaps offering services

Interfaces, plugs and slots in Ubuntu Core 16

Snaps Interfaces Example

Plug (Consumer Snap)

name: consumer_snap_name
plugs:
  db:
    interface: mysql

Slot (Producer Snap)

name: producer_snap_name
slots:
  db:
    interface: mysql

This setup enables both snaps to share a database. Additionally, snaps can share files with:

  • Other snaps from the same vendor
  • Community-maintained shared snaps using content-sharing interfaces

Additional Features of Ubuntu Core 16

Compatible with desktops, servers, and devices like Intel Joule, Qualcomm Dragonboard, Samsung Artik, Raspberry Pi2 and Pi3.

  • Keeps files compressed and signed using SquashFS blobs, avoiding file scattering across disks.
  • Compact OS with an image size of only 350 MB.
  • System and application updates use xdelta diffs—only changed code is updated.
  • Separation of kernel/device drivers and OS/snaps allows parallel development by different teams.

The term "Ubuntu" originates from Southern Africa and stands for “the belief in a universal bond of sharing that connects all humanity.” While technology can simplify and connect, it must be rooted in ethical principles.

No advanced system can safeguard humanity unless guided by sensible and humane ideologies. Building smart systems begins with building a thoughtful ecosystem of responsible people.

Arduino programming for beginners-1

After understanding the hardware of the Arduino UNO board in the previous article, let's now get started with Arduino programming.

Arduino programs are written in the Arduino Integrated Development Environment (IDE). Arduino IDE is a special software that allows you to write sketches (programs) for different Arduino boards. The Arduino programming language is based on a simple hardware programming language called Processing, which is similar to the C language. After writing a sketch in the Arduino IDE, it should be uploaded to the Arduino board for execution.

The first step in programming the Arduino board is downloading and installing the Arduino IDE. It runs on Windows, Mac OS X, and Linux. Download the software from the official website and follow the installation instructions.

Now let’s discuss the basics of Arduino programming.

The structure of an Arduino program includes two main blocks:

  • Preparation
  • Execution
void setup() {
  // initialization statements
}

void loop() {
  // execution statements
}

The setup() function runs once when the program starts. It’s used to initialize pin modes and start serial communication. Even if there are no statements, the function must be included.

void setup() {
  pinMode(pin-number, OUTPUT); // set pin as output
  pinMode(pin-number, INPUT);  // set pin as input
}

After setup(), the loop() function runs repeatedly and contains the main program logic.

void loop() {
  digitalWrite(pin-number, HIGH); // turn ON
  delay(1000); // wait 1 second
  digitalWrite(pin-number, LOW);  // turn OFF
  delay(1000); // wait 1 second
}

Note: Arduino measures time in milliseconds.

Let’s Try Two Experiments

  • Blinking the LED
  • Fade-in and fade-out the LED

Building the breadboard circuit is just as important as writing the Arduino code.

Components Required:

  • Arduino UNO R3 - 1
  • Breadboard - 1
  • Breadboard connectors - 3
  • LED - 1
  • 1K resistor - 1

Blinking LED

Steps:

  1. Connect the Arduino to your computer via USB.
  2. Connect digital pin 13 to the positive rail of the breadboard; GND to the negative.
  3. Connect the positive rail to a terminal strip through a 1K resistor.
  4. Fix the LED below the resistor on the strip.
  5. Connect the LED's cathode to the negative rail.

Blinking LED circuit

Code Version-1:

int LED = 13;

void setup() {
  pinMode(LED, OUTPUT);
}

void loop() {
  digitalWrite(LED, HIGH);
  delay(1000);
  digitalWrite(LED, LOW);
  delay(1000);
}

Code Version-2:

void setup() {
  pinMode(13, OUTPUT);
}

void loop() {
  digitalWrite(13, HIGH);
  delay(1000);
  digitalWrite(13, LOW);
}

Arduino IDE

Fade-in and Fade-out the LED

Note: Use digital pin 9 instead of 13 in the above circuit.

Fade LED circuit

Code Version-1:

int led = 9;
int brightness = 0;
int fade = 5;

void setup() {
  pinMode(led, OUTPUT);
}

void loop() {
  analogWrite(led, brightness);
  brightness = brightness + fade;

  if (brightness <= 0 || brightness >= 255) {
    fade = -fade;
  }

  delay(30);
}

Code Version-2:

int led = 9;

void setup() {
  pinMode(led, OUTPUT);
}

void loop() {
  for (int fade = 0; fade <= 255; fade += 5) {
    analogWrite(led, fade);
    delay(30);
  }
}

Both programs use analogWrite() on a PWM-capable digital pin. PWM pins simulate analog output.

Congrats! You’ve completed level-1 of Arduino programming. In level-2, you’ll explore conditional statements, loops, and I/O operations. Continue learning here.

A tour of the Arduino UNO board

After understanding the hardware of the Arduino UNO board in the previous article, let's now get started with Arduino programming.

Arduino programs are written in the Arduino Integrated Development Environment (IDE). The Arduino IDE is software that lets you write sketches (Arduino programs) for various Arduino boards. The programming language is based on Processing, which resembles the C language. Once written, the sketch is uploaded to the board for execution.

The first step is downloading and installing the Arduino IDE, which is available for Windows, macOS, and Linux. Download the appropriate version from the official site and follow installation instructions.

Structure of Arduino Programs

Every Arduino program has at least two parts:

  • Preparation block – setup()
  • Execution block – loop()
void setup() {
  // initialization code
}

void loop() {
  // repeated execution code
}

setup() runs once when the program starts and is typically used to set pin modes or start serial communication. Even if unused, it must be defined.

void setup() {
  pinMode(pin_number, OUTPUT);
  pinMode(pin_number, INPUT);
}

loop() executes repeatedly after setup(). It's used to read inputs, write outputs, and handle logic.

void loop() {
  digitalWrite(pin_number, HIGH);  // turn on
  delay(1000);                     // wait 1 second
  digitalWrite(pin_number, LOW);   // turn off
  delay(1000);                     // wait 1 second
}

Note: Time is measured in milliseconds in Arduino.

Experiments

  • Blinking the LED
  • Fade-in and fade-out the LED

Components Required

  • Arduino UNO R3 – 1
  • Breadboard – 1
  • Breadboard connectors – 3
  • LED – 1
  • 1K resistor – 1

Blinking LED

Steps to build the circuit:

  1. Connect Arduino to system via USB cable.
  2. Connect digital pin 13 to breadboard positive rail; GND to negative.
  3. Use a 1K resistor between positive rail and terminal strip.
  4. Place LED in terminal strip below resistor.
  5. Connect LED cathode (short lead) to breadboard ground rail.
Circuit diagram of blinking LED with Arduino UNO

Code Version 1

int LED = 13;

void setup() {
  pinMode(LED, OUTPUT);
}

void loop() {
  digitalWrite(LED, HIGH);
  delay(1000);
  digitalWrite(LED, LOW);
  delay(1000);
}

Code Version 2

void setup() {
  pinMode(13, OUTPUT);
}

void loop() {
  digitalWrite(13, HIGH);
  delay(1000);
  digitalWrite(13, LOW);
  delay(1000);
}

Version 1 makes it easier to reuse or change pin numbers by using a variable.

Arduino IDE

Fade-In and Fade-Out LED

Note: Use pin 9 instead of pin 13 in this setup.

Circuit diagram for fade-in and fade-out with Arduino IDE

Code Version 1

int led = 9;
int brightness = 0;
int fade = 5;

void setup() {
  pinMode(led, OUTPUT);
}

void loop() {
  analogWrite(led, brightness);
  brightness = brightness + fade;

  if (brightness <= 0 || brightness >= 255) {
    fade = -fade;
  }
  delay(30);
}

Code Version 2

int led = 9;

void setup() {
  pinMode(led, OUTPUT);
}

void loop() {
  for (int fade = 0; fade <= 255; fade += 5) {
    analogWrite(led, fade);
    delay(30);
  }
}

analogWrite is used on PWM-capable digital pins to simulate analog output.

Next Steps: In the next article, we’ll explore conditional statements, loops, and analog/digital I/O in depth.

Congratulations! You've completed level-1 of Arduino programming. Move on to level-2 to keep learning!

Architecture of smart cities

Smart city services like smart water management, smart energy, smart mobility, smart buildings, etc., are based on a centralized system. A web of sensors spread across the city feeds data to this centralized system or control center by sensing activities in the physical environment. At the control center, the data is processed and stored as meaningful information. This information is shared across various departments of the city government for better coordination and data-driven decision-making.

This sounds pretty easy to implement, doesn't it?

But practically, it is not easy. Why?

Integrating various devices with different technologies with the existing communication infrastructure is one of the biggest challenges in developing a sustainable and efficient smart city.

ICT Architecture of a Smart City

The Information and Communication Technology (ICT) architecture of a smart city has four layers:

  • Sensing
  • Communication
  • Data
  • Service
Layered architecture of smart cities

Sensing Layer

This layer contains a varied set of IoT nodes deployed across an urban area. These nodes collect data about physical environment activities. An IoT node includes sensors, microchips, power supply, and network elements. Nodes are categorized as:

  • Constrained node: Operates in low-power environments with limited processing and data-transfer capabilities.
  • Unconstrained node: Has no constraints in power, processing, or data-transfer capabilities.

A node may function as constrained or unconstrained based on operational conditions. For example, a proximity sensor in a small office parking lot may be constrained, while the same in a large complex may be unconstrained.

Constrained nodes struggle with XML data due to overhead and parsing complexity. To address this, the W3C proposed the Efficient XML Interchange (EXI) format, which supports constrained devices.

EXI includes two encoding methods:

  • Schema-less encoding: Data is encoded directly and decoded without needing prior knowledge of the schema.
  • Schema-informed encoding: An XML schema is shared between processors, allowing optimized tag representation.

Schema-informed EXI enables constrained IoT nodes to become multipurpose by understanding and generating structured data formats efficiently.

Communication Layer

Every smart city system involves millions of IoT nodes. Each node requires a unique address, facilitated by IPv6 (128-bit address). However, IPv6 overhead is too high for constrained devices. Enter 6LoWPAN—a low-power protocol designed for these nodes.

Bridge routers convert IPv6 packets to 6LoWPAN and vice versa, enabling seamless communication.

Communication technologies include:

  • Unconstrained nodes: Wi-Fi, optic fiber, Ethernet, LTE, UMTS, and powerline communication.
  • Constrained nodes: IEEE 802.11 Low Power, Bluetooth Low Energy, IEEE 802.15.4, RFID, NFC, and PLC.

Data Layer

This is the intelligence layer of a smart city. It involves structured storage and processing of data from IoT nodes. Databases track:

  • All IoT nodes
  • Departments managing the nodes (e.g., water management)
  • Associated departmental data

Statistical models used include:

  • Predictive models: Analyze past and current data to forecast future events.
  • Descriptive models: Explain the relationship between events and their causes.
  • Decision models: Evaluate outcomes of decisions based on influencing factors.

ERP systems also play a role in managing interdepartmental data flows within this layer.

Service Layer

This cross-departmental layer integrates data from various city services (e.g., water, power, pollution, transport) through web and mobile applications. The layer supports not only internal government collaboration but also provides public access to subsets of data for transparency and innovation.

Many cities have addressed urban challenges successfully through smart technology. Notable examples include Barcelona, Tel Aviv, Amsterdam, Seoul, and Stockholm.