Code Monkey home page Code Monkey logo

ot-ledstrip's Introduction

ot-ledstrip

What Is This?

This is a custom application for Nordic Semiconductors OpenThread capable ICs, like the nRF52840, with the purpose of wirelessly controlling RGB LED strips.

It works by joining or forming a specified OpenThread network and then exposing a COAP server to the network. At the moment only one COAP resource (PUT /rgb) is implemented. Resources like /brightness, /rgb or /hue might follow soon. Other Thread nodes on the same network can then write to these resources to control the LED strip.

It includes a simple PWM driver for SK6812 or compatible LEDs (also known as Adafruit NeoPixels).

Iโ€™m using this in a smart home setup similar to Phillips Hue or IKEA Tradfri. A Raspberry Pi acts as an OpenThread to IP bridge and also exposes an Apple HomeKit IP accessory for each strip to my home network. I can then easily control the strips using the Home app or Siri on all my Apple devices. (The bridge is not part of this repo.)

Getting Started

Building this project requires Arms GCC compiler for Cortex-M based microcontrollers, as well as Nordics SDK for Thread. Executing ./script/bootstrap from the projects root directory should automatically download and extract these dependencies.

This repo contains the necessary configuration to be opened in Visual Studio Code. There are several tasks like Build or Flash and C/C++ configurations for the different supported targets. (I also have a very convenient GDB debugging configuration in the works which will follow soon.)

You can change the number of LEDs and the PWM output pin in src/ledstrip.h.

The Thread network credentials can be set in the sdk_config.h files or using a CLI over USB like in the following.

$ screen /dev/*somedevice* 115200
> thread stop
> dataset init new
> dataset panid *somepanid*
> dataset channel *somechannel*
> dataset masterkey *somemasterkey*
> dataset commit active
> thread start

Using coap-client on Linux one can then write RGB hex values to the /rgb resource to change the color of the led strip like in the following.

$ coap-client -m put coap://[*someip*%wpan0]:5683/rgb -e ff0000 # red
$ coap-client -m put coap://[*someip*%wpan0]:5683/rgb -e 00ff00 # green
$ coap-client -m put coap://[*someip*%wpan0]:5683/rgb -e 0000ff # blue

The whole thing is work in progress so don't expect it to work right away. It's more like an inspiration how you could build your own smart home. Feel free to contribute or open issues.

Hardware

I'm using nRF52840 dongles (also known as PCA10059). They require an additional logic level shifter to be used with the SK6812 leds.

ot-ledstrip's People

Contributors

leonrinkel avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

aceslick911

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.