How to Measure Voltage Using Voltage Divider and ADC

Microcontrollers cannot measure high voltages directly because their ADC (Analog-to-Digital Converter) has a limited input range, typically 0–3.3V or 0–5V. To measure higher voltages, a voltage divider circuit is used to scale the voltage down to a safe level.

What is a Voltage Divider?

A voltage divider uses two resistors to reduce input voltage.

Formula:

image.png

Where:

image.png

image.png

Why Voltage Divider is Needed

Directly connecting high voltage to ADC can:

  • Damage microcontroller
  • Produce incorrect readings

Voltage divider ensures:

  • Safe input range
  • Accurate measurement

Example Calculation

If measuring 12V with 3.3V ADC:

Choose:

  • R1 = 10kΩ
  • R2 = 3.3kΩ

image.png

Safe for ADC input.

Converting ADC Value to Voltage

After reading ADC:

image.png

This converts digital value back to actual voltage.

image.png

Practical Considerations

  • Use precise resistor values
  • Avoid very high resistance (noise sensitive)
  • Add capacitor for filtering
  • Calibrate for accuracy

Common Mistakes

  • Wrong resistor ratio
  • Ignoring ADC reference voltage
  • No filtering → noisy signal
  • Measuring voltage above design limit

Applications

Voltage divider is used in:

  • Battery monitoring
  • Power supply measurement
  • Solar system monitoring
  • Sensor scaling

Voltage divider is a simple and essential technique for measuring higher voltages using microcontroller ADC. With proper design and calibration, it provides safe and accurate voltage measurement for embedded systems.

#TestAndMeasurement#
#VoltageDivider#
#ADC#
#EmbeddedSystem#
#Electronics#
#Arduino#

Test & Measurement
IoT Security: Real Threat Vectors and OWASP IoT Top 10

Firmware Extraction and Analysis

8738138089483653120

For an adversary with physical access to the device (or a device discarded in e-waste), extracting the firmware is trivial. An SPI flash clip (e.g., Pomona SOIC-8 clip) connected to a $30 USB logic analyzer or programmer (e.g., CH341A) allows reading the entire contents of the external flash memory chip in minutes, often without even desoldering it from the PCB. Tools like binwalk can then analyze the extracted binary, identifying file system partitions, extracting stored certificates, private keys, hardcoded Wi-Fi passwords, API tokens, and MQTT credentials.

Critical Design Rule: Store your device's certificate private key in hardware-protected storage. Options include:

• The Digital Signature (DS) peripheral on Espressif ESP32 series MCUs, which uses eFuse-protected keys that are never exposed to software.
• An external secure element such as the Microchip ATECC608A, which provides hardware-based key storage and cryptographic acceleration with tamper resistance.
A private key stored in plaintext within unprotected SPI flash is a liability waiting to be exploited. Once that key is extracted, an adversary can indefinitely impersonate your legitimate device to your cloud backend.

Man-in-the-Middle on Unencrypted Connections
If your device sends telemetry data over plain HTTP (port 80) or unencrypted MQTT (port 1883), anyone on the same local network segment, or any compromised router along the network path, can passively read and actively modify that data. This threat vector enables:
• Injection of false sensor readings (e.g., reporting a false high temperature to trigger a cooling system).
• Replay of previously captured commands (e.g., re-sending an "unlock door" command).
• Extraction of authentication tokens passed in clear text.

Transport Layer Security (TLS) prevents this. Proper TLS configuration requires certificate validation, not just encryption. Enabling TLS but accepting any self-signed certificate ("TLS without verification") provides encryption against passive eavesdropping but offers zero protection against an active Man-in-the-Middle (MITM) compromise. The device must validate the server's certificate against a trusted Certificate Authority (CA) or a pre-provisioned public key pinned in firmware.

Insecure OTA Update Channels
The Over-the-Air (OTA) firmware update mechanism is one of the highest-value threat targets in an IoT system. If an adversary can compromise the update channel, they can push malicious firmware to the entire deployed fleet simultaneously. Common vulnerabilities include:
• Update metadata or binaries fetched over HTTP (trivially MITM-prone).
• Firmware accepted from any server (no URL whitelist or validation).
• No cryptographic signature verification on the firmware image (any binary is accepted as valid).
• No anti-rollback protection (allowing an adversary to downgrade a device to an older, vulnerable firmware version with known CVEs).

8738316229249974272

OWASP IoT Top 10: The Engineer’s Reference:

Rank Vulnerability Engineering Fix
1 Weak, guessable, or hardcoded passwords Force credential change at first boot; no shared factory defaults in production.
2 Insecure network services Firewall by default; only open ports explicitly required for operation.
3 Insecure ecosystem interfaces Authenticate all API calls; no unauthenticated endpoints exposed.
4 Lack of secure update mechanism HTTPS for transport + signed firmware images + anti-rollback protection.
5 Use of insecure or outdated components Maintain Software Bill of Materials (SBOM); establish patch process for CVEs.
6 Insufficient privacy protection Data minimization; encrypt Personally Identifiable Information (PII) at rest and in transit.
7 Insecure data transfer and storage TLS 1.2/1.3 everywhere; no plaintext protocols (HTTP, Telnet, FTP) in production.
8 Lack of device management Ability to remotely disable, quarantine, and update devices via cloud platform.
9 Insecure default settings Secure-by-default configuration; minimal threat surface out of the box.
10 Lack of physical hardening Disable JTAG/SWD via eFuse; implement tamper detection; debug interfaces only on dev units.
Wireless & IOT
IoT Security: Real Threats and Why You Cannot Ignore This

IoT Security: Real Threats, Real Defenses, and Why You Cannot Ignore This

October 21, 2016. A botnet called Mirai took down DNS provider Dyn. Twitter, Netflix, Reddit, The Guardian all became unreachable for millions of users. The campaign involved approximately 600,000 compromised IoT devices: IP cameras, DVRs, home routers. How were they compromised?

Default credentials. Username: admin. Password: admin. Or password. Or 12345. That's it. 600,000 devices, billions of dollars in economic impact, because manufacturers shipped products with default passwords, they never forced users to change.

The IoT Security Problem Is Structural

8738135350758195200

Most security vulnerabilities in traditional software, SQL injection, cross-site scripting (XSS), buffer overflows, result from developer mistakes that can often be fixed with a patch delivered over the network. IoT security vulnerabilities are frequently structural: they result from fundamental design decisions made before a single line of firmware was written and fixing them requires physically replacing hardware already deployed in the field.

Consider these scenarios:

• A network-connected device with no OTA update capability cannot be patched against newly discovered vulnerabilities.
• A device with hardcoded credentials in firmware cannot have those credentials rotated or revoked.
• A device with an unencrypted external flash chip cannot protect stored secrets retroactively, the data is already exposed.

These are not bugs; they are architectural failures. The engineering implication is clear: security must be a design constraint from day zero. It is not a feature to be added at the end of development. It is not a checklist item to be reviewed the week before launch. It is a fundamental requirement that we must shape every hardware component selection and every firmware architectural decision.

How Real Threat Actors Target IoT Devices?

Network Scanning and Default Credentials

Shodan is a search engine for internet-connected devices. It continuously scans the entire IPv4 address space and catalogs every device with open ports and identifiable banners. There are Shodan search queries that reliably return 100,000+ IP cameras, industrial control systems (ICS), and smart home hubs with exposed Telnet (port 23) or HTTP (port 80) administrative interfaces. A disturbing percentage of these are still running with factory default credentials.

This is not sophisticated hacking; it is automation. A simple Python script can iterate through a list of common default credential pairs (admin/admin, root/root, admin/password, support/support) against thousands of open Telnet or SSH ports per hour. The success rate remains depressingly high because many manufacturers prioritize "it works out of the box" over "it is secure by default.

Wireless & IOT
The ESP Family, AI Acceleration, RISC-V, and How to Choose

The ESP Family: From a $1 Wi-Fi Chip to a Full Microcontroller Ecosystem

Before, we covered the foundational ESP chips: the ESP8266 that ignited the maker revolution, the classic ESP32 that still dominates IoT projects, and the security-focused ESP32-S2. Now we turn to the cutting edge, chips that bring AI acceleration to the edge, embrace the open RISC-V architecture, and enable next-gen smart home standards like Matter.

The Advanced Chips, What Are They Actually!

ESP32-S3, The One That pushes the boundary between microcontrollers and edge AI processors

This is where it gets exciting. The S3 uses dual Xtensa LX7 cores (a proper step up from the LX6) and adds the Processor Instruction Extensions (PIE), a set of SIMD vector instructions specifically designed for neural network inference and signal processing workloads. It supports Octal-SPI PSRAM up to 8 MB at 640 Mbps, and includes native USB OTG. Pair it with a camera module and you have a vision AI system for under $10 in BOM cost.

I've seen ESP32-S3 boards running face detection at 10–15 FPS, wake-word detection, and real-time spectral analysis, tasks that a few years ago required a dedicated DSP chip. The PIE instructions give you roughly 2–5× the neural network throughput of a standard LX6 core, depending on the model and quantization. For edge AI applications, this chip is genuinely impressive. The S3 also includes 45 programmable GPIOs and a native DVP camera interface for DMA-based frame capture.

8738312875744813056

C3, C6, H2, The RISC-V New Wave

Espressif's decision to adopt RISC-V for the C and H series was a bold move, and it's paying off. The ESP32-C3 is a single-core 160 MHz RISC-V chip with BLE 5.0 and Wi-Fi 4, essentially a modern replacement for the ESP8266 with BLE added and better toolchain support. It includes 400 KB of SRAM and is priced around $0.90 in volume.

The ESP32-C6 is the one to watch for smart home applications. It adds Wi-Fi 6 (802.11ax) and 802.15.4 (Thread + Zigbee), making it the first ESP chip that's genuinely Matter-ready out of the box. It runs a 160 MHz RISC-V core with 512 KB of SRAM and BLE 5.3. If you're building anything for the smart home market, the C6 is worth designing around right now.

The ESP32-H2 drops Wi-Fi entirely and focuses on 802.15.4 (Thread/Zigbee) plus BLE 5.3. It's optimized for battery-powered mesh endpoints where Wi-Fi overhead would drain your battery life. The H2 achieves the lowest deep sleep current of the family (~2.5 µA) and the lowest active TX current (~72 mA at 0 dBm). It runs a RISC-V core at 96 MHz and includes 320 KB of SRAM.

How to Actually Pick One

Your Need Best Pick Why
Simple WiFi, lowest BOM cost ESP32-C3 BLE 5.0 + WiFi, modern RISC-V core,~$0.90 in volume
General IoT, rich peripherals ESP32 (classic) 10+ years of community, libraries, examples
AI / vision / voice ESP32-S3 PIE vector acceleration + Octal PSRAM + DVP camera interface
USB device (HID/CDC/MSC) ESP32-S3 or S2 Native USB OTG, no CH340 needed
Matter / smart home hub ESP32-C6 Wi-Fi 6 + Thread/Zigbee built in
Zigbee/Thread mesh endpoint ESP32-H2 No Wi-Fi overhead, longest battery life
Legacy design upgrade ESP32-C3 Drop-in ESP8266 replacement with BLE

One Last Thing Before You Pick a Chip

Check supply availability before committing to a design. The semiconductor shortage of 2021–2022 taught everyone a painful lesson: the "cheapest" chip is worthless if you can't get it. Espressif publishes longevity commitments for their flagship products, the company guarantees a minimum supply period of 12 years from product launch for all listed devices. The ESP32-WROOM-32E module is guaranteed to be available until at least January 1, 2028. Newer modules like the ESP32-S3-MINI carry support periods extending to 2033. For a product you plan to manufacture for years, verify the supply chain before the first PCB spin

Wireless & IOT
Timer in Microcontrollers: Basic Concept and Use Cases

Timers are fundamental components in microcontrollers used to measure time, generate delays, and control periodic events. Almost every embedded system relies on timers for tasks such as blinking LEDs, generating PWM signals, or handling time-based interrupts.

What is a Timer?

A timer is a hardware counter inside a microcontroller that increments or decrements based on a clock signal.

Basic idea:

  • Timer counts clock ticks

When it reaches a value → event occurs

image.png

Types of Timers

1. Basic Timer

  • Used for simple delay
  • Counts up to a specific value

2. Timer with Interrupt

  • Generates interrupt when overflow occurs
  • Used for periodic tasks

3. PWM Timer

  • Generates PWM signal
  • Used for motor and LED control

Timer Operation

Timer works based on:

  • Clock frequency
  • Prescaler (to slow down counting)
  • Counter value

Example:

If clock = 1 MHz and prescaler = 1000

→ Timer increments every 1 ms

image.png

Using Timer for Delay

Instead of using blocking delay functions, timers can generate precise delays.

Advantages:

  • Non-blocking
  • More accurate
  • Efficient CPU usage

Timer Interrupt Example

Timers can trigger interrupts periodically.

Practical Applications

Timers are used in:

  • LED blinking
  • PWM generation
  • Motor control
  • Communication timing
  • Real-time systems

Engineering Insight

  • Avoid excessive use of delay()
  • Use timer interrupt for real-time tasks
  • Combine timer with interrupt for efficient systems

Timers are essential for controlling time-based operations in microcontrollers. Understanding how timers work enables engineers to build efficient, responsive, and real-time embedded systems.

#Microcontrollers#
#Timer#
#EmbeddedSystem#
#RealTimeSystem#
#Arduino#
#Electronics#

Microcontrollers
What is Debouncing and Why It Matters in Digital Input

In embedded systems, reading digital inputs such as buttons or switches seems simple. However, mechanical switches do not produce clean signals. Instead, they generate rapid fluctuations called bounce, which can cause multiple unintended triggers.

Debouncing is the process of eliminating these false signals to ensure reliable input detection.

What is Switch Bounce?

When a button is pressed or released, the contact does not settle instantly. It rapidly toggles between HIGH and LOW before stabilizing.

This results in:

  • Multiple detections for one press
  • Unstable system behavior

image.png

Why Debouncing is Important

Without debouncing:

  • Counters may increase multiple times
  • Systems may misinterpret input
  • Control logic becomes unreliable

Debouncing ensures that one physical press equals one digital event.

Hardware Debouncing

A simple method uses RC filtering:

  • Resistor + capacitor smooth the signal
  • Reduces rapid fluctuations

Common approach:

  • Add capacitor across switch
  • Use pull-up or pull-down resistor

image.png

Software Debouncing

More flexible and commonly used.

Basic idea:

  • Detect input change
  • Wait for short delay (e.g., 10–50 ms)
  • Confirm stable state

Example (Arduino):

if (buttonState != lastState) {
  delay(20);
  if (buttonState == HIGH) {
  // valid press
  }
}

Advanced Debouncing

For better performance:

  • Use timer-based debounce (non-blocking)
  • Use state machine logic
  • Combine with interrupt systems

Practical Applications

Debouncing is essential in:

  • Push buttons
  • Keypads
  • Rotary encoders
  • User interface systems

Engineering Insight

  • Hardware debounce = stable but less flexible
  • Software debounce = flexible but needs proper timing
  • Best approach → combine both for critical systems

Debouncing is a simple but critical technique in embedded systems. Proper handling of switch input ensures reliable operation and prevents unexpected behavior in digital systems.

#Microcontrollers#
#Debouncing#
#EmbeddedSystem#
#DigitalInput#
#Arduino#
#Electronics#

Microcontrollers
UART vs I2C vs SPI: Communication Protocol Comparison

Communication between components is essential in embedded systems. Three commonly used protocols are UART, I2C, and SPI. Each protocol has its own characteristics, advantages, and suitable use cases.

This article compares these protocols to help you choose the right one for your application.

UART (Universal Asynchronous Receiver/Transmitter)

UART is a simple serial communication protocol using two lines:

  • TX (Transmit)
  • RX (Receive)

Characteristics:

  • Asynchronous (no clock line)
  • Point-to-point communication
  • Easy to implement

image.png

I2C (Inter-Integrated Circuit)

I2C uses two lines for multiple devices:

  • SDA (Data)
  • SCL (Clock)

Each device has a unique address.

Characteristics:

  • Multi-device communication
  • Uses addressing system
  • Slower than SPI

image.png

SPI (Serial Peripheral Interface)

SPI uses multiple lines:

  • MOSI (Master Out Slave In)
  • MISO (Master In Slave Out)
  • SCLK (Clock)
  • CS (Chip Select)

Characteristics:

  • High-speed communication
  • Full-duplex (send & receive simultaneously)
  • Requires more pins

image.png

Comparison Table

Feature UART I2C SPI
Lines 2 2 4+
Speed Medium Low High
Complexity Low Medium Medium
Multi-device No Yes Yes
Full Duplex Yes No Yes

When to Use Each Protocol

Use UART for:

  • Simple communication
  • Debugging (serial monitor)
  • Device-to-device communication

Use I2C for:

  • Multiple sensors
  • Limited pin availability
  • Moderate speed requirements

Use SPI for:

  • High-speed data transfer
  • Displays (TFT, OLED)
  • Memory devices (SD card)

Engineering Insight

  • UART is easiest but limited
  • I2C saves pins but slower
  • SPI is fastest but uses more wiring

Choosing the right protocol depends on system requirements such as speed, number of devices, and hardware complexity.

UART, I2C, and SPI are essential communication protocols in embedded systems. Understanding their differences allows engineers to design more efficient and reliable systems.

#Microcontrollers#
#UART#
#I2C#
#SPI#
#EmbeddedSystem#
#Communication#

Microcontrollers
Understanding PWM for Motor and LED Control

Pulse Width Modulation (PWM) is a widely used technique in microcontrollers to control power delivered to devices such as motors, LEDs, and heaters. Instead of changing voltage directly, PWM controls the duty cycle of a digital signal to simulate analog output.

What is PWM?

PWM is a signal that switches between HIGH and LOW at a fixed frequency. The ratio of ON time to total period is called the duty cycle.

  • 0% → always OFF
  • 50% → half ON, half OFF
  • 100% → always ON

image.png

How PWM Controls Output

Even though PWM is digital, devices respond to the average power.

Example:

  • LED → brightness changes
  • Motor → speed changes

Higher duty cycle → more power delivered.

PWM Parameters

Key parameters:

  • Frequency → how fast signal switches
  • Duty Cycle → percentage of ON time

Both affect system behavior.

PWM for LED Control

PWM allows smooth brightness control without changing voltage.

Advantages:

  • Energy efficient
  • Stable brightness
  • No heat loss like linear control

image.png

PWM for Motor Control

PWM controls motor speed by adjusting average voltage.

  • Low duty → slow speed
  • High duty → fast speed

Used in:

  • DC motors
  • Fans
  • Robotics

Practical Example

Using Arduino:

analogWrite(ledPin, 128); // 50% duty cycle (0–255)

Common Issues

  • Wrong frequency → flickering or noise
  • Low resolution → rough control
  • Electrical noise in motor systems

Applications

PWM is widely used in:

  • Motor speed control
  • LED dimming
  • Power regulation
  • Switching power supplies

PWM is a powerful and efficient method to control analog behavior using digital signals. By adjusting duty cycle and frequency, microcontrollers can precisely control devices in various applications.

#Microcontrollers#
#PWM#
#EmbeddedSystem#
#MotorControl#
#LEDControl#
#Electronics#

Microcontrollers
How ADC Works in Microcontrollers (Simple Explanation)

Analog signals such as temperature, voltage, and current cannot be processed directly by microcontrollers because they operate digitally. To convert analog signals into digital values, an Analog-to-Digital Converter (ADC) is used.

This article explains how ADC works in microcontrollers and how it is used in practical applications.

What is ADC?

ADC (Analog-to-Digital Converter) converts a continuous analog signal into a discrete digital value that can be processed by a microcontroller.

Example:

  • 0–3.3V input → 0–4095 (for 12-bit ADC)

This allows the system to interpret real-world signals in digital form.

Basic Working Principle

The ADC samples the input voltage and converts it into a digital number based on resolution.

General formula:

image.png

Where:

  • Vin = input voltage
  • Vref = reference voltage
  • n = ADC resolution

image.png

ADC Resolution

Resolution determines how precise the measurement is.

Resolution Levels
8-bit 256
10-bit 1024
12-bit 4096

Higher resolution → better accuracy.

Sampling Process

ADC works in steps:

  1. Sample input voltage
  2. Hold the value
  3. Convert to digital
  4. Store result

This process repeats continuously.

image.png

Practical Example

Using ESP32 (12-bit ADC):

  • Vref = 3.3V
  • Vin = 1.65V

image.png

This value can be used to calculate actual voltage or sensor data.

Common Issues

  • Noise affects accuracy
  • Wrong reference voltage
  • Poor grounding
  • Non-linear ADC behavior

Practical Applications

ADC is used in:

  • Voltage measurement
  • Current sensing
  • Temperature sensors
  • Analog sensors

ADC is a fundamental component in embedded systems that enables microcontrollers to read real-world analog signals. Understanding how ADC works helps improve measurement accuracy and system performance.

#Microcontrollers#
#ADC#
#EmbeddedSystem#
#AnalogSignal#
#ElectronicsBasics#
#Arduino#

Microcontrollers
Physical Layer Protocols and the Decision Framework

IoT Protocols: The Definitive Engineering Guide to Choosing the Right One

Before, we covered application layer protocols, MQTT, HTTP, and CoAP. Now we move down the stack to the physical and data link layers, where bits travel across wires and radio waves. These choices determine power consumption, range, and infrastructure cos

8738133194529832960

Physical Layer Protocols: How Bits Actually Travel

Wi-Fi: The Bandwidth Champion
802.11 b/g/n offers up to ~150 Mbps and ~100 m range indoor. In IoT, bandwidth is not the limit, power is. Current draw can reach 138–335 mA, making Wi-Fi suitable mainly for mains-powered or infrequent-transmission devices.
Best for: smart home hubs, cameras, high data sensors, cloud-connected devices needing low latency or high throughput.

BLE 5.x: The Battery-Friendly Workhorse
BLE 5 improved range (up to ~400 m with coded PHY), speed (up to 2 Mbps), and efficiency. It works in two modes: connection (wearables, continuous data) and advertising (beacons, tracking, broadcasts). BLE Mesh extends coverage via multi-hop networking.
Best for: wearables, proximity systems, low-power sensors, smart devices.

Zigbee / Thread: Mesh Networks for Smart Homes
Both use IEEE 802.15.4 at 2.4 GHz (~250 kbps, ~100 m per hop). Zigbee uses its own network layer, while Thread is IPv6-based via 6LoWPAN, making it more internet-native.
Thread is gaining strong adoption due to Matter (Apple, Google, Amazon, etc.). Border routers connect mesh to IP networks.
Best for: smart lighting, home automation, scalable mesh systems.

LoRa / LoRaWAN: Long Range, Ultra Low Power
LoRa uses chirp spread spectrum for long-range (15+ km) and very low data rates (~250 bps at max range). Devices can run for years on batteries.
LoRaWAN adds network management but is limited by duty cycle (often 1% in EU), restricting data volume heavily.
Best for: environmental monitoring, agriculture, slow sensor updates.

NB-IoT & LTE-M: Cellular IoT
Both use cellular networks with SIM-based connectivity.

  • NB-IoT: very low power, high latency, tiny data, best for static sensors (meters, infrastructure).
  • LTE-M: higher speed, lower latency, supports mobility and voice.
    Costs scale per device via SIM subscriptions.
    Best for: wide-area deployment without gateways.

RS-485 / Modbus: Industrial Standard
A wired, differential protocol resistant to noise. Supports long distances, up to 247 devices, and deterministic timing (1–10 ms cycles). Still widely used in factories.
Best for: industrial automation, reliable wired sensor networks.

The Decision Framework

Use Case Best Protocol Why
Smart home device (mains powered) Wi-Fi + MQTT High bandwidth, easy integration, no infrastructure
Wearable / health monitor BLE 5.x Ultra-low power, paired to phone
Smart building sensors Zigbee or Thread Mesh, low power, no per-device cost
Agricultural field sensor LoRaWAN Kilometer range, year-long battery
Vehicle / asset tracking LTE-M Cellular coverage, mobility support
Industrial floor sensor RS-485 / Modbus Deterministic, EMI immune, proven
Consumer Smart home (new) Thread / Matter Future-proof, cross-ecosystem
Wireless & IOT
Application Layer Protocols MQTT, HTTP, and CoAP

IoT Protocols: The Definitive Engineering Guide to Choosing the Right One

I've seen a startup spend three months integrating LoRaWAN into a product for a smart building application only to discover that the 10-second duty cycle limit on the protocol made their 1-second alert response requirement impossible. Protocol choice is architecture. Get it wrong early and you'll pay for it for the life of the product.

Start With Use Case, Not Protocol

The protocol conversation usually starts wrong: "We want to use MQTT" or "Let's go with LoRa" as if the protocol is a preference, like choosing a favorite color. Protocols are engineering constraints with specific trade-offs. The right question is: what is your data rate, range, power, latency, and infrastructure requirements? The protocol that satisfies all of them is the right choice.

Let me walk through the major protocols with the engineering lens they deserve, starting at the top of the stack: the application layer.

Application Layer Protocols: How Data Is Formatted and Routed

8738131223512727552

MQTT: The Default for Good Reason

MQTT was designed in 1999 by Andy Stanford-Clark (IBM) and Arlen Nipper (Arcom, now Eurotech) for oil pipeline monitoring via satellite link. The design constraints were: unreliable network (satellite), constrained bandwidth, constrained device (SCADA terminal), and the requirement that disconnected devices receive messages they missed. The protocol that emerged from those constraints is perfectly suited for IoT, 25+ years later.

The publishing-subscribe model is the key innovation. Devices don't communicate directly with each other or with applications, everything goes through a broker. This decoupling means you can add new subscribers (dashboards, analytics pipelines, automation systems) without touching the device firmware. Add a new analytics subscriber to your fleet's topic tree and suddenly you have data visibility you didn't have before, without a firmware update.

QoS 0 sends once and hopes for the best, use for telemetry you can afford to lose ("at most once"). QoS 1 guarantees delivery but allows duplicates use for alarms and state changes where "at least once" is acceptable. QoS 2 guarantees exactly-once delivery the overhead is significant (four-way handshake), so only use it where duplicates cause real problems (billing, irreversible commands).

Last Will and Testament (LWT) is one of MQTT's most useful features and it's consistently underused. When you connect, you specify a "will" message, a topic and payload the broker publishes if your device disconnects ungracefully. This gives you automatic offline detection without any server-side logic.

HTTP/REST, Universal but Heavyweight

HTTP is the language of the web, and many IoT devices use it. The advantages: every platform speaks HTTP, debugging is easy (Postman, curl), and integration with web services is trivial. The disadvantages for IoT: request-response model requires polling for commands (wasteful for battery devices), headers add 500+ bytes of overhead per request (vs MQTT's 2-byte header), and there's no native push from server to device without Web Sockets.

HTTP is appropriate for: devices that only upload data (no commands needed), low-frequency uploads (once per minute or less), integration with existing web APIs, and scenarios where the device has mains power and bandwidth is cheap. HTTP is inappropriate for: battery devices, high-frequency data, bidirectional real-time communication.

CoAP: HTTP's Constrained Cousin

CoAP (Constrained Application Protocol) takes the REST mental model (URIs, GET/POST/PUT/DELETE) and puts it on UDP instead of TCP, with a 4-byte header instead of ~500 bytes. It adds "observe" mode where a server can push updates to a client without polling, elegant for resource-constrained devices. CoAP is used in LwM2M device management and some LPWAN applications, but it has less community and tooling than MQTT. Use it if you're already in an ecosystem that requires it; don't seek it out otherwise.

Wireless & IOT
IoT Domains, Communication Patterns, and Why Projects Fail

IoT vs. IIoT vs. AIoT: Why the Labels Matter

Understanding the nuances between these acronyms is critical for establishing the correct reliability requirements, security postures, and safety margins for your design.

Term Domain Key Characteristic Example
IoT Consumer/Commercial User convenience, cost-sensitive Smart thermostat, wearable, smart lock
IIoT Industrial/Manufacturing Reliability, functional safety, data fidelity Predictive maintenance, SCADA, smart grid
AIoT Any domain ML inference at the edge (TinyML) Face recognition, anomaly detection, keyword spotting
WoT Web/Integration Standard web protocols for device interoperability RESTful device APIs, W3C Thing Description
V2X Automotive Ultra-low latency (<10ms), safety-critical Vehicle-to-infrastructure (C-V2X) communication

These distinctions matter immensely. They imply different reliability requirements (e.g., five-nines vs. best-effort), different security postures (hardware root of trust vs. symmetric key), and different consequences of failure. A smart light bulb failing to respond is an annoyance. An IIoT pressure sensor providing incorrect readings in a natural gas pipeline is a safety hazard. Design rigor must scale accordingly.

The IoT Communication Patterns

8738123055432978432

Device-to-Cloud (D2C) The Most Common
The device authenticates to a cloud broker (e.g., AWS IoT Core, Azure IoT Hub) using X.509 certificates or tokens, publishes telemetry over MQTT or HTTP, and subscribes to command topics. It is simple, scalable, and well-understood. The critical drawback: the device is completely dependent on internet connectivity. No WAN link equals no monitoring and no remote control.

Device-to-Gateway-to-Cloud (D2G2C), The Resilient Pattern
Resource-constrained devices (BLE sensors, Zigbee nodes, or legacy 4–20 mA transmitters) cannot connect directly to the internet. They communicate to a local gateway that performs protocol translation, data aggregation, and local processing. This is the pattern employed in serious industrial deployments. The gateway can operate autonomously during WAN outages, maintaining local control logic and caching data for later synchronization when connectivity is restored. This "Edge Computing" capability is mandated by the IEC 62264 standard for enterprise-control system integration.

Device-to-Device (D2D), For Real-Time Local Control
When latency requirements are strict (under 10 ms), a cloud round-trip is architecturally impossible. D2D is used in industrial control systems and robotics where actuators must respond immediately to sensor state changes. Zigbee binding and Thread networks are classic implementations of this low-latency local mesh.

Why IoT Projects Fail (And How to Not Be That Story)
I have witnessed many IoT projects fail. Not in dramatic, fiery explosions, but in quiet, frustrating ways: Devices that work perfectly on the lab bench but fail in the field due to RF co-channel interference or power supply ripple. Systems that scale seamlessly from 1 to 100 devices but collapse at 1,000 because the MQTT broker wasn't tuned for maximum concurrent connections or the database wasn't partitioned for write throughput. Sensors that drift out of specification within six months due to inadequate environmental stress screening. Firmware that accumulates memory leaks due to heap fragmentation and requires a watchdog timer reset every week.

The common thread in all these failures: decisions made during the prototyping phase that were never re-examined before production. "The prototype worked, so we shipped it."* Do not do this. Prototypes are designed to prove a concept. Products are designed to operate reliably, at scale, in the real world, for years. These are distinct engineering disciplines with distinct verification and validation (V&V) processes.

Before you ship a single unit, ensure you have: performed field-testing in the actual deployment environment (not just the office), stress-tested your backend at 10x the expected device count, instrumented your firmware with health metrics (e.g., heap usage, uptime, link quality), designed robust failure recovery paths (including watchdog timers and brown-out detection), and planned a secure Over-the-Air (OTA) update strategy. This is the essential work that separates a reliable product from a fragile prototype.

Wireless & IOT
SLM 316L Stainless Steel Case Study: The "Artistic" Precision of Metal 3D Printing 🏗️

8740539797316681728

SLM 316L Stainless Steel Case Study: The "Artistic" Precision of Metal 3D Printing 🏗️

Have you ever seen metal 3D printed art? We’re pushing the limits of intricate detail with SLM technology.

From iconic landmarks to complex parts, 316L Stainless Steel makes the impossible possible.

🛡️ Industrial Strength: Superior tensile strength (600 MPa) with excellent corrosion resistance.

✨ Perfect Detail.

💡 The Verdict:

For designs that need both beauty and strength, SLM Metal 3D Printing is the answer.

🚀 Get your custom metal parts started (From $8):

👉 https://jlc3dp.com/3d-printing-quote?from=fiona

#JLC3DP #SelectiveLaserMelting #Metal3DPrinting #SLM #316LStainlessSteel #3DPrinting #IndustrialDesign #iconic landmarks #3Dprintedart #3DPrintingCommunity #3DPrintingMaterials #3dprints

SLM (Metal)
ESP8266 Deep Dive — ADC and Final Verdict

Speed up deep sleep wake: Store your Wi-Fi channel and BSSID in RTC memory (rtcData.bssid, rtcData.channel) on the first successful connection. Use WiFi.begin(ssid, password, channel, bssid, true) on subsequent wakes to skip the channel scan. This cuts reconnect time from ~5 seconds to ~1 second a massive battery savings.

The ADC Problem You Need to Know About
The ESP8266 has one ADC input (A0), with a 10-bit resolution and a 0–1V input range. There's a catch that trips up beginners constantly: you cannot use analogRead() reliably while Wi-Fi is active. The Wi-Fi component uses the same ADC that analogRead() uses. Intensive use of analogRead() can cause the Wi-Fi to have issues.

8738103320624893952

The workaround: call WiFi.forceSleepBegin() before your ADC read, call yield(), read the ADC, then call WiFi.forceSleepWake() to resume. This works but adds latency. For designs where you need continuous ADC readings with Wi-Fi active, use an external ADC (ADS1115 via I2C) instead.

When to Still Use the ESP8266 in 2025

8738104056028581888

Honest answer: for most new designs, use the ESP32-C3 instead. Same cost, better architecture, BLE added, more RAM, better ADC. The ESP32-C3 is generally intended by Espressif to replace the well-known ESP8266. All ESP32 variants have roughly 5× the amount of RAM compared to ESP8266.

But the ESP8266 is still valid when you have existing ESP8266 code and don't want to port it, when you're manufacturing an existing product with established supply chain, when you need to match a specific module footprint, or when you're teaching and have existing course material built around it.

The ESP8266 isn't dead. It's just not the first choice anymore. The chip that democratized Wi-Fi IoT deserves respect, just not unconditional loyalty.

If your firmware is already stable, certified, and deployed in the field, switching to a newer chip like ESP32-C3 introduces validation overhead, potential bugs, and certification costs that may not be justified. On the other hand, for any new design, the long-term benefits of a modern architecture, better memory headroom, improved peripherals, and active ecosystem support, almost always outweigh the short-term convenience of sticking with the ESP8266. The key is not to treat the ESP8266 as outdated, but to recognize it as a mature, well-understood platform and choose it deliberately, not by habit.

Wireless & IOT