GithubHelp home page GithubHelp logo

christmas-tree-lights's Introduction

christmas-tree-lights

Firmware build

ESP32 powered controller for WS2812 based pixel LED strip (chain) with HTTP API and GitHub Actions workflow for OTA.

Prerequisites

Install Visual Studio Code with PlatformIO extension.

Quick start

First setup

  1. Clone the repo and open it in Visual Studio Code. Platformio should automatically install all project dependencies.

  2. Rename credentials-template.h to credentials.h and type your WiFi an Husarnet credentials there (you will find you Husarnet Join Code at https://app.husarnet.com).

  3. Click "PlatformIO: upload" button to flash your ESP32 board connected to your laptop. You will find the following log in the serial monitor:

    **************************************
    Christmas Tree Lights
    **************************************
    
    ๐Ÿ“ป 1. Connecting to: FreeWifi Wi-Fi network .. done
    
    โŒ› 2. Waiting for Husarnet to be ready ... done
    
    ๐Ÿš€ HTTP server started
    
    Visit:
    http://pixel-led-chain:8080/
    
    Known hosts:
    my-laptop (fc94:a4c1:1f22:ab3b:b04a:1a3b:ba15:84bc)
    pixel-led-chain (fc94:f632:c8d9:d2a6:ad18:ed16:ed7e:9f3f)
  4. HTTP API examples:

    • curl http://pixel-led-chain:8080/mode=0 - set modeRGB=0(rainbow theme)
    • curl http://pixel-led-chain:8080/color=red - set modeRGB=5 and rgb={255,0,0} (all LEDs red)
    • curl http://pixel-led-chain:8080/color=yellow - set modeRGB=5 and rgb={255,255,0} (all LEDs yellow):
    • curl http://pixel-led-chain:8080/color=green - set modeRGB=5 and rgb={0,255,0} (all LEDs green):

Internet OTA with GitHub Actions

  1. Create the folowing GitHub repository secrets (Settings > Secrets > New repository secret):

    Secret Sample Value Desription
    WIFI_SSID FreeWifi just your WiFi network name
    WIFI_PASS hardtoguess ... and password
    HUSARNET_JOINCODE fc94:...:932a/xhfqwPxxxetyCExsSPRPn9 find your own secret Join Code at your user account at https://app/husarnet.com > choosen network > add element button. Anyone with this Join Code can connect to your Husarnet network
  2. Push changes to your repo:

    git add *
    git commit -m "triggering the workflow"
    git push
  3. In ~3 minutes the GitHub workflow should finish its job. Visit: http://my-esp32:8080 URL with a sample "Hello world" website hosted by your ESP32.

    Of course your laptop need to be connected to the same Husarnet network - you will find quick start guide showing how to do it here: https://husarnet.com/docs/

Tips

Erasing flash memory of ESP32

  1. Connect ESP32 to your laptop

  2. Install platformio CLI

    pip install -U platformio
  3. Make flash erase:

    pio run --target erase

Monitoring network traffic on hnet0 interface

sudo tcpflow -p -c -i hnet0

Accesing a webserver hosted by ESP32 using a public domain

Here is a blog post showing how to configure Nginx Proxy Manager to provide a public access to web servers hosted by Husarnet connected devices: https://husarnet.com/blog/reverse-proxy-gui

It can be also used o provide the access to a web server hosted by ESP32 using a nice looking link like: https://my-awesome-esp32.mydomain.com.

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.