Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mods for DMA NeoPixel on GPIO3 and classic wifi connect #46

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
e2e07ce
Update ESP8266HueEmulator.ino
krulkip Nov 20, 2016
b83458f
Update README.md
krulkip Nov 20, 2016
0e90ffb
Update .travis.yml
krulkip Nov 26, 2016
41b62cb
Update .travis.yml
krulkip Nov 26, 2016
606686a
Create install.sh
krulkip Nov 26, 2016
5ce8772
Update .travis.yml
krulkip Nov 26, 2016
d5de425
Update .travis.yml
krulkip Nov 26, 2016
ac8dc75
Update .travis.yml
krulkip Nov 26, 2016
0817180
Update install.sh
krulkip Nov 26, 2016
5b6876d
Update .travis.yml
krulkip Nov 27, 2016
014210d
Update install.sh
krulkip Nov 27, 2016
b3284d2
Update install.sh
krulkip Nov 27, 2016
8f67272
Update install.sh
krulkip Nov 27, 2016
c2d1f75
Update ESP8266HueEmulator.ino
krulkip Nov 27, 2016
cb9f28d
Update .travis.yml
krulkip Nov 27, 2016
4c45da2
Update install.sh
krulkip Nov 27, 2016
21d5f40
Update .travis.yml
krulkip Nov 27, 2016
fb1b98b
Update .travis.yml
krulkip Nov 27, 2016
acdac49
Update .travis.yml
krulkip Nov 27, 2016
9ef76f6
Update .travis.yml
krulkip Nov 27, 2016
5eefbcf
Update .travis.yml
krulkip Nov 27, 2016
abec707
Update .travis.yml
krulkip Nov 27, 2016
13fe12a
Update .travis.yml
krulkip Nov 27, 2016
287334a
Update .travis.yml
krulkip Nov 27, 2016
6e30ce0
Delete .travis.yml
krulkip Nov 27, 2016
b7b3b1a
Create travis.yml
krulkip Nov 27, 2016
197fe76
Rename travis.yml to .travis.yml
krulkip Nov 27, 2016
6d7d4fb
Update .travis.yml
krulkip Nov 27, 2016
1afd076
Update .travis.yml
krulkip Nov 27, 2016
95fadab
Update .travis.yml
krulkip Nov 27, 2016
91bf79b
Update .travis.yml
krulkip Nov 27, 2016
60e6306
Update ESP8266HueEmulator.ino
krulkip Nov 27, 2016
1124483
Update .travis.yml
krulkip Nov 27, 2016
7c9d2d5
Update ESP8266HueEmulator.ino
krulkip Nov 27, 2016
7b9781f
Delete install.sh
krulkip Nov 27, 2016
d5074c7
Update README.md
krulkip Nov 27, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ before_install:
install:
- mkdir -p $HOME/arduino_ide/libraries/
- cd $HOME/arduino_ide/libraries/
- git clone --branch 2.1.4 https://github.com/Makuna/NeoPixelBus.git
- git clone --branch 2.2.4 https://github.com/Makuna/NeoPixelBus.git
- git clone https://github.com/interactive-matter/aJson.git
- sed -i -e 's|#define PRINT_BUFFER_LEN 256|#define PRINT_BUFFER_LEN 4096|g' aJson/aJSON.h
- cd -
Expand Down
19 changes: 10 additions & 9 deletions ESP8266HueEmulator/ESP8266HueEmulator.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <NeoPixelBus.h>
#include <NeoPixelAnimator.h> // instead of NeoPixelAnimator branch
#include "LightService.h"

#include <SPI.h>
// these are only used in LightHandler.cpp, but it seems that the IDE only scans the .ino and real libraries for dependencies
#include <ESP8266WebServer.h>
#include "SSDP.h"
Expand All @@ -28,8 +28,9 @@ unsigned int transitionTime = 800; // by default there is a transition time to t

// Settings for the NeoPixels
#define pixelCount 30
#define pixelPin 2 // Strip is attached to GPIO2 on ESP-01
NeoPixelBus<NeoGrbFeature, NeoEsp8266Uart800KbpsMethod> strip(pixelCount, pixelPin);
//#define pixelPin 2
//NeoPixelBus<NeoGrbFeature, NeoEsp8266Uart800KbpsMethod> strip(pixelCount, pixelPin);
NeoPixelBus<NeoRgbFeature, Neo800KbpsMethod> strip(pixelCount);// strip attached to GPIO3 - RX on wemos D1 mini
NeoPixelAnimator animator(pixelCount, NEO_MILLISECONDS); // NeoPixel animation management object

HsbColor getHsb(int hue, int sat, int bri) {
Expand Down Expand Up @@ -104,24 +105,23 @@ class PixelHandler : public LightHandler {
};

void setup() {

Serial.begin(115200);// needs to be before strip.Begin() to allow NeoPixel DMA RX pin to work
// this resets all the neopixels to an off state
strip.Begin();
strip.Show();

// Show that the NeoPixels are alive
delay(120); // Apparently needed to make the first few pixels animate correctly
Serial.begin(115200);


WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
infoLight(white);

if (WiFi.waitForConnectResult() != WL_CONNECTED) {
Serial.println("WiFi Failed");
// Show that we are connected
if (WiFi.status() != WL_CONNECTED) {
// Show that we are connecting
infoLight(red);
while (1) delay(100);
Serial.print(".");
}

// Port defaults to 8266
Expand Down Expand Up @@ -164,6 +164,7 @@ void setup() {
}

void loop() {
ArduinoOTA.handle();
LightService.update();

static unsigned long update_strip_time = 0; // keeps track of pixel refresh rate... limits updates to 33 Hz
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# ESP8266HueEmulator [![Build Status](https://travis-ci.org/probonopd/ESP8266HueEmulator.svg)](https://travis-ci.org/probonopd/ESP8266HueEmulator)
# ESP8266HueEmulator [![Build Status](https://travis-ci.org/krulkip/ESP8266HueEmulator.svg)](https://travis-ci.org/krulkip/ESP8266HueEmulator)
This sketch emulates a Philips Hue bridge running on an ESP8266 using the Arduino IDE. Right now this is a proof-of-concept; contributions are highly welcome. Hue client apps can [discover](../../wiki/Discovery) the emulated bridge and begin talking to it using the Hue protocol.

![phihue_e27_starterset_430x300 jpg](https://cloud.githubusercontent.com/assets/2480569/8511601/e692e61c-231f-11e5-842d-4fedd6f900b4.jpg)

__Optionally__, vou can use a strip of individually addressable WS2812b NeoPixels and attach it to GPIO2. The sketch talks to a strip of NeoPixels connected to GPIO2 of the ESP8266 with no additional circuitry. Right now the sketch uses the NeoPixels to tell that it is powered on, connected to the WLAN etc., and can switch on the first 3 NeoPixels using a Hue client (e.g., the iOS app).
__Optionally__, vou can use a strip of individually addressable WS2812b NeoPixels and attach it to GPIO3. The sketch talks to a strip of NeoPixels connected to GPIO3 of the ESP8266 with no additional circuitry. Right now the sketch uses the NeoPixels to tell that it is powered on, connected to the WLAN etc., and can switch on the first x NeoPixels using a Hue client (e.g., the iOS app). Currently only first version of the app is working. The number of NeoPixels that work depend on the amount of memory made available in the buffer. Currently 4096 means 14 NeoPixels can work. (See comments below)

To make this work, the sketch advertises its service with the so-called "Simple Service Discovery Protocol" (SSDP) that is also used as discovery protocol of Universal Plug and Play (UPnP). This sketch uses the ESP8266SSDP library from https://github.com/me-no-dev/Arduino

Expand Down