Skip to content

NeoPixel Ring controller on ESP-01 with Web Interface to support configuration and support for OTA updates. The board can be controlled using MQTT or "secured" HTTP request

License

Notifications You must be signed in to change notification settings

SamueleFurnari/NEOPixelESP01MQTT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

This project contains the implementation of an IoT gizmo to control a NEOPixel Ring. The code was developed and tested for the ESP-01 1M board (which mounts the ESP8266 chip with one mega byte of flash memory).

The code offers:

  • A complete WiFi connection manager, implemented using WiFiManager. The library is used to simplify the management of the connection to the WiFi network (thus avoiding sculpting the network credentials in the code) and eventually to configure the connection to an MQTT server.
  • The ability to interact with an MQTT server, implemented with the PubSubClient library.
  • An HTTP Server that allow user to interact with the board using a couple of HTTP urls. This is implemented using the ESP8266WebServer.
  • Support for OTA Updates implemented using the ArduinoOTA library.
  • Support for hostname resolution, implemented using the Multicast DNS. This allows you to "reach" the board without having to know the IP assigned by your router to the board.

Setting up environment.

The project is developed using Visual Studio Code and PlatformIO. See the official documentation to learn how to install and configure PlatformIO on VSCode.

Project structure

The project is composed by 8 files that contains:

  • The definition and implementation of the class used for animation management (Animator.h, Animator.cpp and hsv.h). It is important and necessary to underline that the code that implements the animations is a re-adaptation of two other open projects:

  • The definition and implementation of the class used to store and load additional configuration from the simulated EEPROM (ConfigStorage.h and ConfigStorage.cpp)

  • The definition and implementation of main code (main.h and main.cpp).

  • The Configuration.h, that contains all the static configuration definition. You can edit this file to easly change the project configuration. You can find more information following.

After first flash flow

After first flash, when you apply power to the board, the WiFiManager configure the board as an Access Point. If you explore the WiFi networks, you should see a protected network that has name starting with RingController_.

Connect to this network using the passkey 1234567890. When the connection is completed, the operating system automatically open the capitivare portal that allow you to configure the connection to the network and eventually configure the MQTT connection.

Click on Save button to save the configuration. The WiFiManager now connects the board to your WiFi network.

If the connection fails, the WiFiManager shows again the Access Point.

Change the configuration

The code is reach of comments that explain all configuration and algorithms, here I report the main configuration parameters related to security. To edit the configuration, open the Configuration.h file.

  • password, is the Access Point password.
  • authValue, is the value that the client must specify as Authorization header in the HTTP request.

HTTP Shortcuts project

In the HTTP Shortcuts folder you can find a json file that was exported from HTTP Shortcuts Android app. You can download the app from the Play store and than import this file to easily control the board from a smartphone connected to the same network of the device.

As an alternative, in the next paragraph you can find the curl for all supported functions and, in another following paragraph, the topic and messages that can be used to interact via MQTT.

HTTP curl

To witch on and off the ring, use this curl:

curl -XGET -H 'Authorization: jfjfrr99e3' 'http://ring_controller.local:82/onOff?v={{OnOff}}'

Replace {{OnOff}} with 0 to switch off the ring; with 1 to switch on the ring.

To reset the configuration, use this curl:

curl -XGET -H 'Authorization: jfjfrr99e3' 'http://ring_controller.local:82/reset'

To change animation, use this curl:

curl -XGET -H 'Authorization: jfjfrr99e3' 'http://Ring_Controller.local:82/setAnimation?v={{Animation}}'

Replace {{Animation}} according to the Value column in the following table to change animation.

Animation Value
Flame A0
Rotating rainbow A1
Rotating red A2
Rotating with change color A3

MQTT

##TODO

About

NeoPixel Ring controller on ESP-01 with Web Interface to support configuration and support for OTA updates. The board can be controlled using MQTT or "secured" HTTP request

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published