0% found this document useful (0 votes)
40 views7 pages

Unit 4

The document outlines techniques for writing embedded code, emphasizing efficient memory management, performance optimization, and debugging strategies for resource-constrained IoT devices. It also discusses various business models in IoT, highlighting the evolution from craft-based to mass production and the importance of adapting to new technologies. Key elements include the Business Model Canvas, funding sources, and lean startup methodologies for successful IoT ventures.

Uploaded by

surajdhapshi07
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views7 pages

Unit 4

The document outlines techniques for writing embedded code, emphasizing efficient memory management, performance optimization, and debugging strategies for resource-constrained IoT devices. It also discusses various business models in IoT, highlighting the evolution from craft-based to mass production and the importance of adapting to new technologies. Key elements include the Business Model Canvas, funding sources, and lean startup methodologies for successful IoT ventures.

Uploaded by

surajdhapshi07
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Techniques for Writing Embedded Code

Embedded code is software that runs directly on microcontrollers (MCUs) or system-on-


chips (SoCs) in IoT devices. Unlike general-purpose software, embedded code must be
efficient, memory-aware, power-optimized, and reliable, since devices are resource-
constrained and often battery-powered.

1. Memory Management
 Why Important:
o Embedded devices have limited memory (RAM in KBs, Fl ash in MBs).
o Poor management → crashes, instability, battery drain.
 Strategies:
o Avoid memory fragmentation (no heavy use of malloc/free in real-time
code).
o Use static memory allocation where possible.
o Use circular buffers for streaming data (e.g., sensor inputs).
 Example: Instead of dynamically allocating a buffer each time for UART
communication, pre-allocate a static buffer and reuse it.

2. Types of Memory

Embedded systems typically use multiple memory types:

 ROM (Read-Only Memory):


o Stores firmware (program code).
o Non-volatile (retains content after power-off).
o Example: Flash memory in Arduino.
 RAM (Random Access Memory):
o Temporary storage for variables, stack, and heap.
o Volatile (clears on reset).
o Example: Arduino Uno has only 2 KB RAM.
 EEPROM (Electrically Erasable Programmable ROM):
o Stores small amounts of persistent data.
o Useful for configuration values (e.g., Wi-Fi credentials).
 Cache (in advanced MCUs/SoCs):
o Temporary high-speed memory for faster execution.
3. Making the Most of Your RAM
 Best Practices:
o Use fixed-size arrays instead of dynamic allocations.
o Optimize variable types (use uint8_t instead of int if range fits).
o Store constants in Flash/PROGMEM instead of RAM.
o Reuse buffers and memory blocks.
 Example:
o Wrong (wastes memory):
o int sensorValues[1000]; // but only 50 are needed
o Right (optimized):
o uint16_t sensorValues[50];

4. Performance and Battery Life


 Challenges: IoT devices are often battery-powered, so code must balance
performance with power efficiency.
 Optimization Techniques:
o Use sleep modes when sensors/MCU are idle.
o Avoid busy-wait loops; use interrupts.
o Optimize algorithms (e.g., fixed-point arithmetic instead of floating-point).
o Reduce communication overhead (Wi-Fi/4G are power-hungry → batch data).
 Example:
o Instead of sending sensor data every second, aggregate readings and send
every 5 minutes.

5. Libraries
 Why Use:
o Speeds up development.
o Provides tested, reusable code for sensors, communication, and protocols.
 Risks:
o Some libraries are memory-heavy (not optimized for small MCUs).
o May include unused features → code bloat.
 Best Practice:
o Use lightweight libraries (e.g., TinyWire instead of full Wire library for I2C).
o Read library source to understand performance implications.
 Example: In Arduino, using Adafruit_SSD1306 for OLED may consume > 1KB
RAM → choose a lighter library if device has only 2 KB RAM.

6. Debugging
 Challenges in Embedded Systems:
o Limited interfaces (no console or screen).
o Code runs on bare metal → bugs may crash system silently.
 Techniques:

1. Serial Debugging: Print debug messages to UART/USB.


2. LED Debugging: Use onboard LEDs for status signals.
 Example: Blink once = sensor OK, blink twice = sensor fail.
3. Debugging Tools:
 JTAG, SWD (Serial Wire Debug), logic analyzers, oscilloscopes.
4. Watchdogs: Hardware/software timers to reset system if stuck.
5. Unit Testing: Test individual modules before integrating.

 Example:
o If a sensor isn’t giving data, use serial prints at each step (init, read, process) to
locate failure.

Summary
 Memory management is critical — use static allocations, optimize variable types,
and minimize dynamic memory.
 Types of memory (ROM, RAM, EEPROM, Flash) must be used wisely.
 Optimize RAM with lightweight data structures and reuse buffers.
 Performance & battery life rely on efficient code, low-power modes, and reduced
communication.
 Libraries speed up prototyping but must be chosen carefully to avoid bloat.
 Debugging requires creative approaches (serial, LEDs, watchdogs, hardware
debuggers).

Business Models in IoT


1. A Short History of Business Models
 Definition: A business model is a framework that explains how a company creates,
delivers, and captures value.
 In the pre-industrial era, goods were handcrafted and sold locally (craft-based
model).
 With the industrial revolution, businesses shifted to mass production, emphasizing
economies of scale and standardized goods.
 In the digit al and IoT era, business models extend beyond physical products to
include services, data, connectivity, and platforms.

2. Space and Time


 Space: Refers to the geographic reach of a business. IoT allows products/services to
scale globally (e.g., connected cars, smart home devices).
 Time: Refers to speed of production, delivery, and iteration. With IoT and cloud,
updates can be rolled out instantly (e.g., OTA firmware updates).
 Space-time compression in IoT → Businesses can serve a global audience in real-
time.

3. From Craft to Mass Production


 Craft era: Customized, labor-intensive production, suited for niche markets.
 Mass production era: Standardized goods, lower cost, mass accessibility.
 IoT era: A mix of both → Mass personalization where standardized platforms (like
Arduino, Raspberry Pi, sensors) are combined with custom software/services.

4. The Long Tail of the Internet


 Concept: Small, niche products can collectively form a large market online.
 IoT enables niche devices/services (e.g., pet trackers, smart agriculture sensors).
 Platforms like Amazon, Etsy, or Kickstarter allow niche IoT startups to thrive by
directly reaching consumers.

5. Learning from History


 Each technological revolution reshaped business models:
o Steam engine → Industrial manufacturing.
o Electricity → Mass production and scale.
o Internet → Digital services and long-tail commerce.
o IoT → Data-driven services, predictive maintenance, and connected
ecosystems.
 Lesson: Adapting business models to new tech is essential for survival.

6. The Business Model Canvas (BMC)


A strategic tool to design/analyze IoT businesses.
Key elements:

1. Customer Segments – Who uses the IoT product (consumers, enterprises,


governments).
2. Value Propositions – What problem the IoT solution solves.
3. Channels – Distribution: online platforms, app stores, hardware retail.
4. Customer Relationships – Subscription, community, support, APIs.
5. Revenue Streams – Product sales, subscriptions, freemium models, ads.
6. Key Resources – Sensors, cloud platforms, data analytics, patents.
7. Key Activities – Manufacturing, software updates, API development.
8. Key Partners – Hardware suppliers, telecom operators, cloud providers.
9. Cost Structure – Hardware production, R&D, data hosting, customer acquisition.

7. Who Is the Business Model For?


 Entrepreneurs/Startups – To raise funding and scale.
 Enterprises – To pivot toward connected services.
 Investors – To assess profitability.
 Policy Makers – To regulate and support ecosystems.

8. Models of IoT Business


a) Make Thing, Sell Thing

 Traditional hardware sales model.


 Example: Selling a smart thermostat or fitness band.
 Limitation: One-time revenue, lacks recurring income.

b) Subscriptions

 Customers pay monthly/yearly fees.


 Example: Cloud storage for IoT cameras, connected car services.
 Advantage: Predictable revenue, customer lock-in.

c) Customisation

 Personalization for specific needs.


 Example: Smart wearables for healthcare monitoring, agriculture-specific IoT
devices.
 Balances economy of scale + niche solutions.

d) Be a Key Resource

 Provide critical tech others depend on.


 Example: ARM (processor IP licensing), AWS IoT Core (cloud).
 Profit from licensing, royalties, or service usage fees.

e) Provide Infrastructure: Sensor Networks

 Companies deploy and manage large-scale IoT infrastructure.


 Example: Sigfox (LPWAN IoT network), Helium (blockchain-based IoT
connectivity).

f) Take a Percentage

 Platforms act as intermediaries, earning a share from transactions.


 Example: App stores for IoT devices, smart marketplaces.

9. Funding an Internet of Things Startup


a) Hobby Projects and Open Source

 Many IoT startups begin as DIY projects (Arduino, Raspberry Pi).


 Open-source ecosystems lower barriers to entry.

b) Venture Capital

 VCs invest in high-growth IoT startups.


 Attractive areas: smart homes, industrial IoT, healthcare IoT.

c) Government Funding

 Grants and subsidies support IoT adoption in smart cities, agriculture, healthcare.

d) Crowdfunding

 Platforms like Kickstarter/Indiegogo allow testing ideas with early adopters.


 Example: Pebble smartwatch (a famous crowdfunded IoT project).

10. Lean Startups in IoT


 Build → Measure → Learn → Pivot methodology.
 Create minimum viable products (MVPs) using prototyping platforms.
 Use community feedback, rapid prototyping, and cloud APIs to iterate fast.
 Helps reduce risks in high-cost hardware-driven IoT projects.

Summary
 IoT business models combine lessons from history (craft, mass production, internet)
with new approaches based on data, connectivity, and platforms.
 Models range from simple product sales to subscription, customization,
infrastructure provision, and platform ecosystems.
 Funding sources include VC, government, crowdfunding, and open-source
communities.
 The Business Model Canvas provides a structured framework for IoT ventures.
 Lean startup methods and community engagement are crucial for success in the fast-
changing IoT market.

You might also like