Skip to content
  • 0 Votes
    1 Posts
    102 Views
    A
    Hardware speaks in bits, and C is how you answer. Nearly every peripheral bring-up is the same loop: read the register map row, build the mask, write it, read it back to verify. Engineers who are fluent in that loop bring up drivers in an afternoon; everyone else spends a week toggling the wrong bit. The core skills Bit manipulation as a first language. Setting, clearing, toggling and testing individual bits with shifts and masks — REG |= (1 << EN), REG &= ~(3 << MODE), if (REG & READY) — is the vocabulary of every driver you'll ever write. Practice until masks feel like plain reading. → Bit manipulation and register programming → Hands-on bit manipulation exercises Structs as register maps and sensor data. A well-laid-out struct overlays a peripheral's registers or packs a sensor reading (SensorReading_t with temperature, humidity, timestamp) into something every layer of firmware can share. Unions pull double duty for protocol payloads where the same bytes mean different things by message type. → Functions, structs, unions and macros Functions, macros and the HAL habit. Raw register writes scattered through application code rot fast. A thin hardware-abstraction layer — sensor_init(), sensor_read(), one place per peripheral — means a pin change or a sensor swap touches one file, not forty. Know when a macro beats a function (and when it hides a double-evaluation bug). Headers and sources that scale. One giant main.c dies at a few hundred lines. Split by peripheral and by concern, guard every header, keep ISRs thin and fast, and let the build tell you about mistakes with warnings-as-errors before the hardware does. Start at the Embedded C deep track for the full six-part treatment. Share a driver snippet, a mask trick, or a HAL layout that survived contact with real hardware. Tag with c-lang.
  • 0 Votes
    1 Posts
    84 Views
    A
    Desktop C forgives you. Firmware C doesn't. The same program that runs fine on a laptop can corrupt memory or miss an interrupt on a microcontroller — because of what the compiler and the hardware actually do with your code. The bugs that keep showing up here The missing volatile. A flag shared between main code and an interrupt handler works perfectly at -O0 and breaks at -O2, because the compiler cached it in a register. It never re-read memory — you never told it the value could change behind its back. The canonical shape looks like this: volatile bool data_ready = false; // set in ISR, polled in main loop void ADC_ISR(void) { data_ready = true; } void loop(void) { if (data_ready) { // re-read from memory every time data_ready = false; process_sample(); } } Drop the volatile and the compiler hoists the read out of the loop — the loop never sees the interrupt fire. Diagnosing it: if it works at -O0 but breaks at -O2, suspect a missing qualifier before suspecting hardware. Any variable touched both inside and outside an ISR gets volatile. No exceptions, no "but it works on my machine". → Interrupts and ISR patterns Structs that don't match the hardware. You overlay a struct on a peripheral register map, but the compiler inserts padding where you didn't expect it, and now every field after the gap writes to the wrong address. On desktop this is a curiosity; on hardware it configures a peripheral into nonsense. Learn struct layout and padding, then verify with sizeof and offsetof instead of trusting the layout. → Memory, pointers and data representation Read-modify-write that isn't atomic. GPIO_REG |= (1 << PIN) looks harmless until an interrupt fires between the read and the write and modifies a neighbouring pin — your write-back silently undoes it. On real firmware this shows up as a pin that "randomly" changes state once a week. Critical regions and atomic access exist for exactly this reason. Integer promotion adds a second trap: your uint8_t arithmetic quietly becomes int mid-expression, signed-vs-unsigned comparisons go sideways, and shifting into the sign bit is undefined behaviour the compiler is allowed to punish. → Writing robust embedded C Start at the Embedded C track and work through it in order. Post the smallest reproducer plus your compiler flags and optimisation level. Tag with c-lang.
  • 0 Votes
    1 Posts
    208 Views
    A
    A connected device without security is a loaded gun pointed at your own network — and MQTT isn't the answer to every device-side problem either. This companion post covers the two things that turn a working prototype into shippable firmware: locking it down, and reaching beyond MQTT where it fits. Lock it down Mutual TLS, done right. Server-only TLS leaves devices talking to impostors. Both sides prove identity — the device verifies the server, the server verifies the device. Two field gotchas: actually validate the CA chain (skipping verification "temporarily" becomes permanent), and sync the clock first — certificates look invalid on a device that thinks it's 1970. → Why security matters — real attacks → Certificate-based auth and device tokens Trust the code you run. Secure boot stops modified firmware from executing; signed OTA with hash verification plus automatic rollback stops a bad or malicious update from bricking the fleet. Credentials live in protected on-device storage with a provisioning flow — never as string literals in source. Assume anyone can dump your flash; design so a dump alone isn't enough. → The secure boot concept → Credential storage on the device → Secure OTA with signed firmware Reach beyond MQTT HTTP/REST for on-device APIs and cloud calls, WebSocket for local dashboards, Modbus RTU for industrial sensors on RS-485 that isn't going away, and BLE provisioning so users can configure WiFi credentials without hardcoding them. → HTTP and REST from the device → WebSocket basics for local dashboards → Modbus RTU for industrial devices → BLE provisioning of WiFi credentials Capstone A fully connected, secure IoT device — TLS-authenticated MQTT link to GrapesIoT, a clean topic schema, LWT-based presence detection, and offline buffering that survives a broker outage. Share your build in the lab submissions area when it's done. Post questions here and tag with security, tls or ble. For the device-to-cloud path (networking, MQTT, patterns), see the companion post above.
  • 0 Votes
    1 Posts
    97 Views
    A
    What is IoT & Connectivity? A device that only blinks an LED is not an IoT device. IoT starts the moment your firmware opens a socket, sends data somewhere, and receives a command back. That sounds simple. In practice it means dealing with unstable WiFi, broker authentication, encrypted connections, dropped packets, industrial sensors that speak 30-year-old protocols, and devices that must keep working even when the internet doesn't. Block 3 is about building firmware that connects to the real world — reliably, securely, and in a way that doesn't fall apart the moment something goes wrong in the field. What you'll be able to do after this Read a Wireshark capture of an MQTT session and know exactly what's happening at every step Design a topic schema that works for a single device today and a fleet of thousands tomorrow Write WiFi + MQTT reconnection logic that actually handles every failure case Implement TLS mutual auth and store credentials correctly on the device Get data out of a Modbus RTU sensor and route it to the cloud Build firmware that buffers data locally during outages and syncs when connectivity returns What's covered 3.1 Networking The foundation everything else builds on. Most firmware engineers treat the network stack as a black box and then can't debug it when it misbehaves. This section fixes that — TCP/IP mechanics, how WiFi events actually fire on ESP32, and what TLS is doing before your first MQTT packet is sent. → 3.1 Networking sessions 3.2 MQTT Deep Dive MQTT looks simple until you hit production. This goes inside the protocol — packet structure, what QoS actually guarantees, topic schema design that scales, retained messages and LWT for device presence, connecting to EMQX and GrapesIoT, and a systematic debugging method for when things break. → 3.2 MQTT sessions 3.3 Communication Patterns Knowing the protocol isn't enough — you need to know how to use it well. Pub-sub vs request-response, command-acknowledge patterns, the difference between a telemetry reading and an alarm, and how to buffer data in a ring buffer so a WiFi outage doesn't lose sensor history. → 3.3 Communication Pattern sessions 3.4 Security Real IoT devices have been used to take down the internet (Mirai botnet) and physically destroy industrial equipment. Security here is not theoretical — real attack case studies, secure boot, certificate-based auth, correct credential storage in NVS, and signed OTA updates. This is the section that separates hobbyist firmware from production firmware. → 3.4 Security sessions 3.5 Protocols Beyond MQTT MQTT isn't the answer to everything. HTTP/REST for on-device APIs, WebSocket for local dashboards, Modbus RTU for industrial sensors on RS-485 (which isn't going away), and BLE provisioning so users can configure WiFi credentials without hardcoding them. → 3.5 Protocols sessions Capstone A fully connected, secure IoT device — TLS-authenticated MQTT connection to GrapesIoT, proper topic schema, LWT-based presence detection, and offline buffering that survives a broker outage. Submitted to the lab forum and reviewed against a checklist. → Block 3 Labs — submit here Start at embiq.grapesiot.com/embedded-iot/block3 — each section links to its sessions from there. Post questions in this category and tag with the section number (e.g. 3.2) so the right people see it.
  • 0 Votes
    1 Posts
    305 Views
    A
    Industry Problems Board Companies and startups post real engineering problems here. Students who solve them get: Recognition on their Embiq profile Direct introduction to the company Potential internship or job offer For companies: Post problems with the tag industry-problem. Include context, constraints, and what a good solution looks like. For students: Attempt problems publicly — show your reasoning, not just the answer. Multiple approaches welcome. This is the closest thing to a real technical interview the forum offers.
  • šŸš€ Projects Showcase — How to Post

    Projects Showcase
    1
    0 Votes
    1 Posts
    175 Views
    A
    Projects Showcase Share your completed projects here. Format: Project name: Block / Track: Hardware: [components used] Description: [what it does] Code: [GitHub link or paste] Demo: [video link or photos] Challenges: [what was hard] All projects are reviewed by industry mentors. Outstanding projects get featured on embiq.in.
  • 0 Votes
    1 Posts
    175 Views
    A
    Troubleshooting Index Search this page (Ctrl+F) for your error message before posting. GrapesIDE & Toolchain Error Cause Solution A fatal error occurred: Failed to connect to ESP32 Board not in flash mode Hold BOOT button while clicking Upload No serial port found Driver not installed Install CH340 or CP2102 driver Sketch too large Binary exceeds flash Change Partition Scheme to "No OTA (2MB)" 'x' was not declared in this scope Missing #include or typo Add the correct header file implicit conversion loses integer precision Type mismatch Cast explicitly or fix variable type warning: unused variable Variable declared but never used Remove or use the variable. Enable -Werror — this must be fixed ESP32 Hardware Error / Symptom Cause Solution ADC reads 0 or noise during WiFi ADC2 conflicts with WiFi Switch to ADC1 channels (GPIO32-39) GPIO reads random values (floating) No pull-up/pull-down Add 10kĪ© pull-up or enable internal pull-up Device resets randomly Brownout — supply voltage too low Measure VCC under load. Use better USB cable/adapter Serial output garbled Wrong baud rate in monitor Match Serial.begin() rate exactly LED on but dim GPIO current limit exceeded Add current-limiting resistor FreeRTOS Error / Symptom Cause Solution Guru Meditation Error: Core panic'd Stack overflow, null deref, WDT Decode with addr2line — see Block 2 Crash Lab Task watchdog got triggered: taskName Task running without vTaskDelay Add vTaskDelay(pdMS_TO_TICKS(1)) in loop Device freezes randomly Deadlock between mutexes Check mutex acquisition order — always same order across tasks assert failed: queue.c Queue full with no space Increase queue size or consume faster Device reboots every N seconds WDT not being reset Add esp_task_wdt_reset() or vTaskDelay in busy tasks MQTT & Connectivity Error / Code Cause Solution PubSubClient state -2 (CONNECT_FAILED) Wrong credentials or broker down Check username/password/token PubSubClient state -4 (TIMEOUT) Wrong broker IP/port, firewall Verify host, port 8883 for TLS PubSubClient state 5 (UNAUTHORIZED) ACL blocked the topic Check topic matches your device_id exactly TLS certificate verify failed Wrong CA cert or device clock wrong Sync NTP before TLS connect TLS handshake timeout Heap too low for TLS Need >50KB free heap — check esp_get_free_heap_size() WiFi connects but MQTT fails TLS port blocked by ISP/router Try port 8083 (WS) or check firewall rules Messages not arriving QoS mismatch Check publisher and subscriber QoS match GrapesIoT Platform Symptom Cause Solution Device shows offline in dashboard LWT not configured or WiFi down Check MQTT connection and LWT topic OTA command sent but device ignores Device not subscribed to /down/# Check subscription in firmware Dashboard shows old data Retained message from previous session Clear retained by publishing empty payload Alarm not triggering Wrong field path in rule config Check dot-notation path matches payload key GrapesIDE Specific Issue Solution Autocomplete not working Restart IntelliSense: Ctrl+Shift+P → Reload Window Board not detected on Mac Allow USB accessories in System Settings → Privacy Build slow Exclude .pio folder from antivirus Last updated by instructor. Post below if you have a new error+solution to add.
  • šŸ“‹ Block 5 Capstone — How to Submit

    Block 5 Capstone block-5 labs
    1
    0 Votes
    1 Posts
    295 Views
    A
    How to Submit Your Lab Every lab submission must include: Session number and lab name (e.g. "Lab 2.1.1 — UART Deep Dive") What it does — one paragraph description Code — paste your firmware using code blocks Evidence — serial output screenshot OR wiring photo OR video link What you learned — one sentence Format example: Lab: 2.1.1 — UART Two-Board Communication Description: Connected two ESP32 boards via UART. Board A sends a SensorReading_t struct every 2 seconds. Board B receives, parses, and prints. // your code here Serial output: [INF][1234] Received: temp=27.4, hum=62.1 What I learned: UART needs shared GND — forgot this and got garbage data for 20 minutes. Tag your post with the block tag e.g. block-2
  • šŸ“‹ Block 4 Labs — How to Submit

    Block 4 Labs block-4 labs
    1
    0 Votes
    1 Posts
    153 Views
    A
    How to Submit Your Lab Every lab submission must include: Session number and lab name (e.g. "Lab 2.1.1 — UART Deep Dive") What it does — one paragraph description Code — paste your firmware using code blocks Evidence — serial output screenshot OR wiring photo OR video link What you learned — one sentence Format example: Lab: 2.1.1 — UART Two-Board Communication Description: Connected two ESP32 boards via UART. Board A sends a SensorReading_t struct every 2 seconds. Board B receives, parses, and prints. // your code here Serial output: [INF][1234] Received: temp=27.4, hum=62.1 What I learned: UART needs shared GND — forgot this and got garbage data for 20 minutes. Tag your post with the block tag e.g. block-2
  • šŸ“‹ Block 3 Labs — How to Submit

    Block 3 Labs block-3 labs
    1
    0 Votes
    1 Posts
    154 Views
    A
    How to Submit Your Lab Every lab submission must include: Session number and lab name (e.g. "Lab 2.1.1 — UART Deep Dive") What it does — one paragraph description Code — paste your firmware using code blocks Evidence — serial output screenshot OR wiring photo OR video link What you learned — one sentence Format example: Lab: 2.1.1 — UART Two-Board Communication Description: Connected two ESP32 boards via UART. Board A sends a SensorReading_t struct every 2 seconds. Board B receives, parses, and prints. // your code here Serial output: [INF][1234] Received: temp=27.4, hum=62.1 What I learned: UART needs shared GND — forgot this and got garbage data for 20 minutes. Tag your post with the block tag e.g. block-2
  • šŸ“‹ Block 2 Labs — How to Submit

    Block 2 Labs block-2 labs
    1
    0 Votes
    1 Posts
    141 Views
    A
    How to Submit Your Lab Every lab submission must include: Session number and lab name (e.g. "Lab 2.1.1 — UART Deep Dive") What it does — one paragraph description Code — paste your firmware using code blocks Evidence — serial output screenshot OR wiring photo OR video link What you learned — one sentence Format example: Lab: 2.1.1 — UART Two-Board Communication Description: Connected two ESP32 boards via UART. Board A sends a SensorReading_t struct every 2 seconds. Board B receives, parses, and prints. // your code here Serial output: [INF][1234] Received: temp=27.4, hum=62.1 What I learned: UART needs shared GND — forgot this and got garbage data for 20 minutes. Tag your post with the block tag e.g. block-2
  • šŸ“‹ Block 1 Labs — How to Submit

    Block 1 Labs block-1 labs
    1
    0 Votes
    1 Posts
    153 Views
    A
    How to Submit Your Lab Every lab submission must include: Session number and lab name (e.g. "Lab 2.1.1 — UART Deep Dive") What it does — one paragraph description Code — paste your firmware using code blocks Evidence — serial output screenshot OR wiring photo OR video link What you learned — one sentence Format example: Lab: 2.1.1 — UART Two-Board Communication Description: Connected two ESP32 boards via UART. Board A sends a SensorReading_t struct every 2 seconds. Board B receives, parses, and prints. // your code here Serial output: [INF][1234] Received: temp=27.4, hum=62.1 What I learned: UART needs shared GND — forgot this and got garbage data for 20 minutes. Tag your post with the block tag e.g. block-2
  • 0 Votes
    1 Posts
    288 Views
    A
    Block 2 — Embedded Core Resources All session content at docs.embiq.in/block2/ Session Topic 2.1.1 UART Deep Dive 2.1.2 SPI — Master/Slave, Timing 2.1.3 I2C — Addressing, Clock Stretch 2.1.4 ADC — Sampling, Noise 2.2.1 Interrupts & NVIC 2.2.2 GPIO Debounce 2.2.3 Timer & PWM 2.2.4 Interrupt Bugs 2.3.1 Why RTOS 2.3.2 FreeRTOS Tasks 2.3.3 Queues 2.3.4 Semaphores & Mutexes 2.3.5 Memory Management 2.3.6 RTOS Bugs 2.4.1 State Machines 2.4.2 HAL Design 2.4.3 Error Handling & Watchdog 2.4.4 Event-Driven Architecture
  • 0 Votes
    1 Posts
    191 Views
    A
    Block 1 — Foundation Resources All session content lives at docs.embiq.in/block1/ Session Topic Docs Link 1.1.1 Voltage, Current & Power → docs 1.1.2 Reading Datasheets → docs 1.1.3 Multimeter & Oscilloscope → docs 1.1.4 Component Identification → docs 1.2.1 MCU vs CPU vs MPU → docs 1.2.2 Memory Map → docs 1.2.3 GPIO Deep Dive → docs 1.2.4 Clock System + First Flash → docs 1.3.1 Bit Manipulation → docs 1.3.2 Pointers in Embedded C → docs 1.3.3 volatile / const / static → docs 1.3.4 Structs & HAL → docs 1.4.1 GrapesIDE Workflow → docs 1.4.2 Serial Logging → docs 1.4.3 Compiler Errors → docs 1.4.4 Git & Version Control → docs Post questions in this category. Tag with the session number e.g. 1.1.2
  • 0 Votes
    1 Posts
    329 Views
    A
    Welcome! Tell us about yourself Reply to this topic and introduce yourself: Name / Nickname College or Company What block you are on What you are building or want to build One thing you want to learn from Embiq We read every introduction. Looking forward to meeting you!
  • 🧭 How to Ask a Good Technical Question

    Start Here help howto
    1
    0 Votes
    1 Posts
    138 Views
    A
    How to Ask a Good Technical Question Getting a fast, accurate answer depends entirely on how you ask. Follow this template: The Template What I am trying to do: [One sentence describing your goal] What I tried: [Steps you already attempted] What happened: [Exact error message, unexpected behaviour, or symptom — copy-paste, don't paraphrase] My setup: Board: ESP32 / [other] IDE: GrapesIDE v[version] Block / Session: [e.g. Block 2, Session 2.1.1] My code: // paste relevant code here // not 500 lines — only the relevant function Serial output: paste serial monitor output here Golden Rules One question per post Copy-paste error messages exactly Show what you already tried Never say "it doesn't work" without saying what it does instead Never post screenshots of code — paste the code directly
  • 0 Votes
    1 Posts
    141 Views
    A
    Welcome to Embiq Community! This is the official discussion forum for the Embiq Embedded & IoT training program by SmartFRS Solutions. What this forum is for Asking questions about course topics Sharing your lab results and projects Helping fellow students debug issues Connecting with industry mentors What this forum is NOT for Course content (that lives at docs.embiq.in) Spam or off-topic posts Before posting a question Search the forum — your question may already be answered Check the Troubleshooting Index first Include: what you tried, what happened, your code (use code blocks) Forum Rules Be respectful — everyone is learning Use code blocks for all code snippets Mark a reply as Solved when your question is answered Tag your posts with relevant tags (esp32, freertos, mqtt etc.) Welcome aboard. Let's build India's embedded ecosystem together.