Convert Figma logo to code with AI

particle-iot logodevice-os

Device OS (Firmware) for Particle Devices

1,048
510
1,048
161

Top Related Projects

13,539

Espressif IoT Development Framework. Official development framework for Espressif SoCs.

4,667

Arm Mbed OS is a platform operating system designed for the internet of things

10,675

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.

Contiki-NG: The OS for Next Generation IoT Devices

4,911

RIOT - The friendly OS for IoT

Quick Overview

Device OS is an open-source firmware for IoT devices developed by Particle. It provides a robust and secure foundation for connected products, offering features like over-the-air updates, cloud connectivity, and a comprehensive set of libraries for hardware interaction.

Pros

  • Extensive hardware support for various microcontrollers and IoT modules
  • Built-in cloud connectivity and OTA update capabilities
  • Rich ecosystem of libraries and tools for rapid development
  • Strong focus on security and reliability

Cons

  • Learning curve for developers new to embedded systems
  • Limited customization options for certain low-level functionalities
  • Dependency on Particle's cloud infrastructure for some features
  • Resource requirements may be high for very constrained devices

Code Examples

  1. Blinking an LED:
int led = D7;

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

void loop() {
    digitalWrite(led, HIGH);
    delay(1000);
    digitalWrite(led, LOW);
    delay(1000);
}
  1. Reading a sensor and publishing data:
#include "Particle.h"

int sensorPin = A0;

void setup() {
    pinMode(sensorPin, INPUT);
}

void loop() {
    int sensorValue = analogRead(sensorPin);
    Particle.publish("sensor-reading", String(sensorValue), PRIVATE);
    delay(30000);
}
  1. Subscribing to cloud events:
void setup() {
    Particle.subscribe("myEvent", myHandler);
}

void myHandler(const char *event, const char *data) {
    // Handle the event
    Particle.publish("response", "Event received: " + String(data));
}

Getting Started

  1. Install the Particle CLI:

    npm install -g particle-cli
    
  2. Set up your Particle device:

    particle setup
    
  3. Create a new project:

    particle project create myProject
    cd myProject
    
  4. Edit your code in src/myProject.ino

  5. Compile and flash your device:

    particle flash <device-name>
    

Competitor Comparisons

13,539

Espressif IoT Development Framework. Official development framework for Espressif SoCs.

Pros of esp-idf

  • More extensive hardware support, covering a wide range of ESP32 variants
  • Highly customizable and flexible for advanced users
  • Larger community and ecosystem, with more third-party libraries and resources

Cons of esp-idf

  • Steeper learning curve, especially for beginners
  • Requires more low-level configuration and setup
  • Less integrated cloud connectivity features out-of-the-box

Code Comparison

device-os example:

SYSTEM_MODE(AUTOMATIC);

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

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

esp-idf example:

#include "driver/gpio.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"

void app_main() {
    gpio_set_direction(GPIO_NUM_2, GPIO_MODE_OUTPUT);
    while (1) {
        gpio_set_level(GPIO_NUM_2, 1);
        vTaskDelay(1000 / portTICK_PERIOD_MS);
        gpio_set_level(GPIO_NUM_2, 0);
        vTaskDelay(1000 / portTICK_PERIOD_MS);
    }
}

The device-os code is simpler and more Arduino-like, while esp-idf requires more setup and uses FreeRTOS tasks. esp-idf offers more control but with added complexity.

4,667

Arm Mbed OS is a platform operating system designed for the internet of things

Pros of mbed-os

  • Broader hardware support with a larger ecosystem of compatible boards
  • More comprehensive RTOS features and advanced networking capabilities
  • Extensive documentation and community support

Cons of mbed-os

  • Steeper learning curve for beginners compared to device-os
  • Less integrated cloud connectivity features out-of-the-box
  • Potentially more complex setup process for new projects

Code Comparison

mbed-os example:

#include "mbed.h"

DigitalOut led(LED1);

int main() {
    while (true) {
        led = !led;
        ThisThread::sleep_for(500ms);
    }
}

device-os example:

#include "Particle.h"

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

void loop() {
    digitalWrite(D7, HIGH);
    delay(500);
    digitalWrite(D7, LOW);
    delay(500);
}

Both examples demonstrate LED blinking, but mbed-os uses RTOS features and C++11 chrono literals, while device-os follows an Arduino-like structure with setup() and loop() functions, making it more approachable for beginners.

10,675

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.

Pros of Zephyr

  • Broader hardware support, including a wide range of microcontrollers and boards
  • More extensive documentation and community support
  • Highly configurable and modular architecture

Cons of Zephyr

  • Steeper learning curve due to its complexity and extensive features
  • Potentially larger memory footprint for simple applications

Code Comparison

Device OS (Particle):

SYSTEM_MODE(AUTOMATIC);

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

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

Zephyr:

#include <zephyr/kernel.h>
#include <zephyr/drivers/gpio.h>

#define LED_PIN DT_ALIAS_LED0_GPIOS_PIN

void main(void) {
    const struct device *dev = DEVICE_DT_GET(DT_ALIAS_LED0_GPIOS_CONTROLLER);
    gpio_pin_configure(dev, LED_PIN, GPIO_OUTPUT_ACTIVE);

    while (1) {
        gpio_pin_toggle(dev, LED_PIN);
        k_msleep(1000);
    }
}

The Device OS code is simpler and more Arduino-like, while Zephyr's code is more low-level and requires more setup. Zephyr offers more control but with added complexity.

Contiki-NG: The OS for Next Generation IoT Devices

Pros of Contiki-NG

  • More extensive support for IoT protocols and standards
  • Highly modular and customizable for various hardware platforms
  • Active open-source community with frequent updates

Cons of Contiki-NG

  • Steeper learning curve for beginners
  • Less integrated cloud connectivity compared to Device OS
  • May require more manual configuration for specific use cases

Code Comparison

Contiki-NG example (main process):

PROCESS(hello_world_process, "Hello world process");
AUTOSTART_PROCESSES(&hello_world_process);

PROCESS_THREAD(hello_world_process, ev, data)
{
  PROCESS_BEGIN();
  printf("Hello, world\n");
  PROCESS_END();
}

Device OS example (setup and loop):

void setup() {
  Serial.begin(9600);
}

void loop() {
  Serial.println("Hello World!");
  delay(1000);
}

Contiki-NG focuses on event-driven programming with processes, while Device OS uses a more traditional setup/loop structure familiar to Arduino users. Contiki-NG offers more fine-grained control over system resources, but Device OS provides a simpler programming model for IoT devices.

4,911

RIOT - The friendly OS for IoT

Pros of RIOT

  • More extensive hardware support, covering a wider range of microcontrollers and boards
  • Highly modular architecture, allowing for easier customization and optimization
  • Larger and more active community, resulting in frequent updates and contributions

Cons of RIOT

  • Steeper learning curve due to its more complex architecture
  • Less integrated cloud connectivity features compared to Device OS
  • May require more manual configuration for certain use cases

Code Comparison

RIOT example (main.c):

#include "thread.h"
#include "msg.h"

int main(void)
{
    msg_t msg;
    msg_receive(&msg);
    return 0;
}

Device OS example (application.cpp):

#include "Particle.h"

void setup() {
    Particle.subscribe("myEvent", myHandler);
}

void loop() {
    Particle.publish("myEvent", "Hello World");
    delay(1000);
}

RIOT focuses on a more low-level, POSIX-like API, while Device OS provides a higher-level, Arduino-style interface with built-in cloud connectivity features. RIOT offers more flexibility but requires more expertise, whereas Device OS simplifies IoT development at the cost of some customization options.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

CircleCI

Particle Device OS Firmware

This is the main source code repository of the Particle firmware libraries.

Getting Started

To get started building firmware locally, see Getting Started.

Resources

Build System

Application Firmware Development

System Firmware Development

Modules

Platforms

CREDITS AND ATTRIBUTIONS

The firmware uses the GNU GCC toolchain for ARM Cortex-M processors, ARM's CMSIS libraries, and Arduino's implementation of Wiring.

LICENSE

Unless stated elsewhere, file headers or otherwise, all files herein are licensed under an LGPLv3 license. For more information, please read the LICENSE file.

If you have questions about software licensing, please contact Particle support.

LICENSE FAQ

This firmware is released under LGPL version 3, what does that mean for you?

  • You may use this commercially to build applications for your devices! You DO NOT need to distribute your object files or the source code of your Application under LGPL. Your source code belongs to you when you build an Application using this System Firmware.

When am I required to share my code?

  • You are NOT required to share your Application Firmware or object files when linking against libraries or System Firmware licensed under LGPL.

  • If you make and distribute changes to System Firmware licensed under LGPL, you must release the source code and documentation for those changes under a LGPL license.

Why?

  • This license allows businesses to confidently build firmware and make devices without risk to their intellectual property, while at the same time helping the community benefit from non-proprietary contributions to the shared System Firmware.

Questions / Concerns?

  • Particle intends for this firmware to be commercially useful and safe for our community of makers and enterprises. Please Contact Us if you have any questions or concerns, or if you require special licensing.

(Note! This FAQ isn't meant to be legal advice, if you're unsure, please consult an attorney)

CONTRIBUTE

Want to contribute to the Particle firmware project? Follow this link to find out how.

CONNECT

Having problems or have awesome suggestions? Connect with us here.