Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/c-klinger/esp8266-arduino-wifirgb
A RESTful API implementation to control an RGB LED Strip using an ESP8266 microcontroller.
https://github.com/c-klinger/esp8266-arduino-wifirgb
arduino esp2688 home-automation iot rest rest-api rgb rgb-controller rgb-led rgb-ledstrip wifi
Last synced: about 1 month ago
JSON representation
A RESTful API implementation to control an RGB LED Strip using an ESP8266 microcontroller.
- Host: GitHub
- URL: https://github.com/c-klinger/esp8266-arduino-wifirgb
- Owner: c-klinger
- License: other
- Created: 2018-04-23T19:06:05.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-09-09T15:57:58.000Z (over 2 years ago)
- Last Synced: 2023-03-06T21:18:05.826Z (almost 2 years ago)
- Topics: arduino, esp2688, home-automation, iot, rest, rest-api, rgb, rgb-controller, rgb-led, rgb-ledstrip, wifi
- Language: C
- Homepage:
- Size: 53.7 KB
- Stars: 32
- Watchers: 6
- Forks: 9
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# esp8266-arduino-wifirgb
A RESTful API implementation to control an RGB LED Strip using an ESP8266 microcontroller. Supports RGB or HSV color model. There is a [german post](https://chrisklinger.de/2018/05/arduino-esp8266-wifi-steuerung-fuer-einen-rgb-led-strip/) on my blog containing more details about the project.
## Schematics
![WifiRGB Schematics](https://github.com/c-klinger/esp8266-arduino-wifirgb/raw/master/schematics/wifirgb_schematics.png)The circuit uses an LD1117V33 voltage regulator with two capacitors as specified in the datasheet. The connection of the ESP-12 is spoecified in th the [improved stability schematic](https://github.com/esp8266/Arduino/blob/master/doc/ESP_improved_stability.png) of the [ESP8266 for Arduino](https://github.com/esp8266/Arduino/). Three IRLB8721 N-channel MOSFETs (one per RGB Stripe channel) are used as power transistors to save our ESP-12 from an early death. The two tactile switches are added for easier programming.
## Code
### Dependencies
The following dependencies have to be installed in Arduino IDE using library or board manager (see project readme) to compile this project. The mentioned versions are tested, other may work as well but may lead to compile issues.
* [esp8266 v.3.0.2](https://github.com/esp8266/Arduino)
* [ArduinoJSON v.6.19.4](https://github.com/bblanchon/ArduinoJson)The following dependencies will be loaded using a [CDN](https://en.wikipedia.org/wiki/Content_delivery_network) for the web ui. There is no need to install them, but an internet connection is needed for the ui to display.
* [iro.js v.5.5.2](https://github.com/jaames/iro.js)
* [jQuery v.3.6.0](https://github.com/jquery/jquery)### Configuration
In the main Arduino Sketch [WifiRGB.ino](https://github.com/c-klinger/esp8266-arduino-wifirgb/blob/master/esp8266-arduino-wifirgb/WifiRGB.ino) some changes need to be done before uploading to the ESP8266 microcontroller.
#### Wifi Network Settings
Required network settings are the Network SSID and password:
```c
const char* ssid = "your_ssid";
const char* password = "your_wifi_password";
const char* deviceName = "wifi-rgb";
```You can choose between a static or -with DHCP- dynamic IP adress. Default is an static IP adress configured in the following code block:
```c
IPAddress clientIP(192, 168, 178, 250); //the IP of the device
IPAddress gateway(192, 168, 178, 1); //the gateway
IPAddress subnet(255, 255, 255, 0); //the subnet mask
```If you want to use DHCP just ignore those settings and comment or remove the following line:
```c
WiFi.config(clientIP, gateway, subnet);
```#### Internal LED
The internal microcontroller LED is used to indicate the Wifi connection status.
```c
#define BUILTIN_LED 2 // internal ESP-12 LED on GPIO2
```#### RGB Output Pins
If you want to use own schematics you can adjust the different output channels in the following code block.```c
#define REDPIN 12
#define GREENPIN 14
#define BLUEPIN 5
```## Usage
### RESTful API
The controller accecpts POST request at http://ip-adress/api/v1/state. The request must contain one of the following JSON objects in body.
#### RGB
```json
{
"state": "ON",
"brightness": 100,
"color": {
"mode": "rgb",
"r": 255,
"g": 125,
"b": 75
},
"mode": "SOLID"
}
```#### HSV
```json
{
"state": "ON",
"brightness": 100,
"color": {
"mode": "hsv",
"h": 250,
"s": 50,
"v": 50
},
"mode": "SOLID"
}
```### Graphical User Interface
A User Interface using [iro.js](https://github.com/jaames/iro.js) is available at http://ip-adress/ui. An Internet connection is required to load additional Javascript libraries from CDN (see dependencies section).
## License
Copyright (c) 2018 Chris Klinger. Licensed under MIT license, see [LICENSE](https://github.com/c-klinger/esp8266-arduino-wifirgb/blob/master/LICENSE.md) for the full license.## Bugs
See .