mirror of
https://github.com/anklimov/lighthub
synced 2025-12-06 03:39:49 +03:00
ESP8266 and Wiznet 5500 raw support
This commit is contained in:
22
README.md
22
README.md
@@ -1,5 +1,5 @@
|
|||||||
# LightHub
|
# LightHub
|
||||||
is Flexible, Arduino-Mega based SmartHome controller
|
is Flexible, Arduino-Mega/Arduino DUE/ESP8266 based SmartHome controller
|
||||||
|
|
||||||
It allow to connect together:
|
It allow to connect together:
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ Scalability is virtually unlimited: Setup so many controllers you needed in most
|
|||||||
|
|
||||||
Prease refer our Wiki for insructions.
|
Prease refer our Wiki for insructions.
|
||||||
|
|
||||||
Just started preparation to porting firmware to AVR based Arduino DUE and ESP8266/ESP32
|
Finished portation of proejct to Arduino DUE and ESP8266 (ESP32 not tested)
|
||||||
|
|
||||||
Compiled image has been added to compiled/ folder
|
Compiled image has been added to compiled/ folder
|
||||||
use
|
use
|
||||||
@@ -39,7 +39,7 @@ For patched libraries, appropriate GitHub repo URL provided:
|
|||||||
* DS2482_OneWire https://github.com/anklimov/DS2482_OneWire
|
* DS2482_OneWire https://github.com/anklimov/DS2482_OneWire
|
||||||
* FastLED
|
* FastLED
|
||||||
* Wire (standard)
|
* Wire (standard)
|
||||||
* Artnet
|
* Artnet https://github.com/anklimov/Artnet.git
|
||||||
* DmxSimple https://github.com/anklimov/DmxSimple (for AVR) or https://github.com/anklimov/ESP-Dmx (for ESP) or https://github.com/anklimov/DmxDue (for DUE)
|
* DmxSimple https://github.com/anklimov/DmxSimple (for AVR) or https://github.com/anklimov/ESP-Dmx (for ESP) or https://github.com/anklimov/DmxDue (for DUE)
|
||||||
* HTTPClient (for AVR) https://github.com/anklimov/HTTPClient or https://github.com/arduino-libraries/ArduinoHttpClient for other platforms
|
* HTTPClient (for AVR) https://github.com/anklimov/HTTPClient or https://github.com/arduino-libraries/ArduinoHttpClient for other platforms
|
||||||
* aJson https://github.com/anklimov/aJson
|
* aJson https://github.com/anklimov/aJson
|
||||||
@@ -51,8 +51,7 @@ For patched libraries, appropriate GitHub repo URL provided:
|
|||||||
* Ethernet https://github.com/anklimov/Ethernet
|
* Ethernet https://github.com/anklimov/Ethernet
|
||||||
* SPI (standard)
|
* SPI (standard)
|
||||||
|
|
||||||
Portation from AVR Mega 2560 to SAM3X8E (Arduino DUE) is done since v 0.96
|
Portation from AVR Mega 2560 to SAM3X8E (Arduino DUE) done since v 0.96
|
||||||
Next step ESP portation
|
|
||||||
|
|
||||||
#Platforms specific details:
|
#Platforms specific details:
|
||||||
|
|
||||||
@@ -64,5 +63,14 @@ SAM3X8E:
|
|||||||
*both, DMX-in and DMX-out are hardware USART based. Use USART1 (pins 18 and 19) for DMX-out and DMX-in
|
*both, DMX-in and DMX-out are hardware USART based. Use USART1 (pins 18 and 19) for DMX-out and DMX-in
|
||||||
|
|
||||||
ESP:
|
ESP:
|
||||||
*Wifi instead Ether not implemented yet
|
*DMX-OUT on USART1 TX
|
||||||
*DMX-IN not possible to deploy
|
*DMX-IN - not possible to deploy in ESP8266
|
||||||
|
*Modbus - disabled. Might be configured in future on USART0 instead CLI/DEBUG
|
||||||
|
|
||||||
|
since v. 0.97:
|
||||||
|
|
||||||
|
There is first attempt to use Wiznet 5500 (still not stable enough)
|
||||||
|
Need to use compiler directive -D Wiz5500 and https://github.com/anklimov/Ethernet2 library
|
||||||
|
|
||||||
|
First attempt to use platformio toolchain for compiling (work not completed yet)
|
||||||
|
|
||||||
|
|||||||
36
lib/readme.txt
Normal file
36
lib/readme.txt
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
|
||||||
|
This directory is intended for the project specific (private) libraries.
|
||||||
|
PlatformIO will compile them to static libraries and link to executable file.
|
||||||
|
|
||||||
|
The source code of each library should be placed in separate directory, like
|
||||||
|
"lib/private_lib/[here are source files]".
|
||||||
|
|
||||||
|
For example, see how can be organized `Foo` and `Bar` libraries:
|
||||||
|
|
||||||
|
|--lib
|
||||||
|
| |--Bar
|
||||||
|
| | |--docs
|
||||||
|
| | |--examples
|
||||||
|
| | |--src
|
||||||
|
| | |- Bar.c
|
||||||
|
| | |- Bar.h
|
||||||
|
| |--Foo
|
||||||
|
| | |- Foo.c
|
||||||
|
| | |- Foo.h
|
||||||
|
| |- readme.txt --> THIS FILE
|
||||||
|
|- platformio.ini
|
||||||
|
|--src
|
||||||
|
|- main.c
|
||||||
|
|
||||||
|
Then in `src/main.c` you should use:
|
||||||
|
|
||||||
|
#include <Foo.h>
|
||||||
|
#include <Bar.h>
|
||||||
|
|
||||||
|
// rest H/C/CPP code
|
||||||
|
|
||||||
|
PlatformIO will find your libraries automatically, configure preprocessor's
|
||||||
|
include paths and build them.
|
||||||
|
|
||||||
|
More information about PlatformIO Library Dependency Finder
|
||||||
|
- http://docs.platformio.org/page/librarymanager/ldf.html
|
||||||
@@ -180,7 +180,7 @@ for (int i=1; i<17; i++) {Serial.print(dmxin.read(i));Serial.print(";");}
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void onDmxFrame(uint16_t universe, uint16_t length, uint8_t sequence, uint8_t* data)
|
void onDmxFrame(uint16_t universe, uint16_t length, uint8_t sequence, uint8_t* data, IPAddress remoteIP)
|
||||||
{
|
{
|
||||||
#ifdef _dmxout
|
#ifdef _dmxout
|
||||||
for (int i = 0 ; i < length && i<MAX_CHANNELS ; i++)
|
for (int i = 0 ; i < length && i<MAX_CHANNELS ; i++)
|
||||||
|
|||||||
54
lighthub/esp.cpp
Normal file
54
lighthub/esp.cpp
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
#include "options.h"
|
||||||
|
#ifdef __ESP__
|
||||||
|
#include "esp.h"
|
||||||
|
|
||||||
|
ESP8266WiFiMulti wifiMulti;
|
||||||
|
WiFiClient ethClient;
|
||||||
|
|
||||||
|
char mqtt_password[16];
|
||||||
|
|
||||||
|
//default custom static IP
|
||||||
|
//char static_ip[16] = "10.0.1.56";
|
||||||
|
//char static_gw[16] = "10.0.1.1";
|
||||||
|
//char static_sn[16] = "255.255.255.0";
|
||||||
|
|
||||||
|
//flag for saving data
|
||||||
|
bool shouldSaveConfig = false;
|
||||||
|
|
||||||
|
//callback notifying us of the need to save config
|
||||||
|
void saveConfigCallback () {
|
||||||
|
Serial.println("Should save config");
|
||||||
|
shouldSaveConfig = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void espSetup () {
|
||||||
|
Serial.println("Setting up Wifi");
|
||||||
|
shouldSaveConfig = true;
|
||||||
|
//WiFiManager
|
||||||
|
|
||||||
|
WiFiManagerParameter custom_mqtt_password("", "mqtt password", mqtt_password, 16);
|
||||||
|
//Local intialization. Once its business is done, there is no need to keep it around
|
||||||
|
WiFiManager wifiManager;
|
||||||
|
|
||||||
|
wifiManager.setSaveConfigCallback(saveConfigCallback);
|
||||||
|
|
||||||
|
wifiManager.addParameter(&custom_mqtt_password);
|
||||||
|
wifiManager.setMinimumSignalQuality();
|
||||||
|
|
||||||
|
if (!wifiManager.autoConnect()) {
|
||||||
|
Serial.println("failed to connect and hit timeout");
|
||||||
|
delay(3000);
|
||||||
|
//reset and try again, or maybe put it to deep sleep
|
||||||
|
ESP.reset();
|
||||||
|
delay(5000);
|
||||||
|
}
|
||||||
|
|
||||||
|
//if you get here you have connected to the WiFi
|
||||||
|
Serial.println("connected...yeey :)");
|
||||||
|
|
||||||
|
//read updated parameters
|
||||||
|
strcpy(mqtt_password, custom_mqtt_password.getValue());
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
24
lighthub/esp.h
Normal file
24
lighthub/esp.h
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#include <ESP8266WiFi.h>
|
||||||
|
//needed for library
|
||||||
|
#include <DNSServer.h>
|
||||||
|
#include <ESP8266WebServer.h>
|
||||||
|
#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager
|
||||||
|
#include <ESP8266WiFiMulti.h>
|
||||||
|
|
||||||
|
extern ESP8266WiFiMulti wifiMulti;
|
||||||
|
extern WiFiClient ethClient;
|
||||||
|
//WiFiManager wifiManager;
|
||||||
|
|
||||||
|
//define your default values here, if there are different values in config.json, they are overwritten.
|
||||||
|
//length should be max size + 1
|
||||||
|
extern char mqtt_password[16];
|
||||||
|
|
||||||
|
//default custom static IP
|
||||||
|
//char static_ip[16] = "10.0.1.56";
|
||||||
|
//char static_gw[16] = "10.0.1.1";
|
||||||
|
//char static_sn[16] = "255.255.255.0";
|
||||||
|
|
||||||
|
//flag for saving data
|
||||||
|
extern bool shouldSaveConfig;
|
||||||
|
|
||||||
|
void espSetup ();
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -14,17 +14,18 @@ src_dir = lighthub
|
|||||||
platform = atmelavr
|
platform = atmelavr
|
||||||
board = megaatmega2560
|
board = megaatmega2560
|
||||||
framework = arduino
|
framework = arduino
|
||||||
|
build_flags =
|
||||||
|
-D Wiz5500
|
||||||
lib_deps =
|
lib_deps =
|
||||||
https://github.com/livello/Arduino-Temperature-Control-Library.git
|
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
||||||
https://github.com/anklimov/DS2482_OneWire
|
https://github.com/anklimov/DS2482_OneWire
|
||||||
https://github.com/anklimov/DmxSimple
|
https://github.com/anklimov/DmxSimple
|
||||||
https://github.com/anklimov/HTTPClient
|
https://github.com/anklimov/HTTPClient
|
||||||
https://github.com/anklimov/aJson
|
https://github.com/anklimov/aJson
|
||||||
https://github.com/anklimov/CmdArduino
|
https://github.com/anklimov/CmdArduino
|
||||||
https://github.com/anklimov/ModbusMaster
|
https://github.com/anklimov/ModbusMaster
|
||||||
https://github.com/anklimov/DMXSerial
|
https://github.com/anklimov/DMXSerial
|
||||||
https://github.com/anklimov/Ethernet
|
https://github.com/anklimov/Ethernet2
|
||||||
126
|
https://github.com/PaulStoffregen/SPI.git
|
||||||
https://github.com/PaulStoffregen/SPI.git
|
https://github.com/knolleary/pubsubclient.git
|
||||||
https://github.com/knolleary/pubsubclient.git
|
https://github.com/anklimov/Artnet.git
|
||||||
https://github.com/natcl/Artnet.git
|
|
||||||
|
|||||||
100
platformio.txt
Normal file
100
platformio.txt
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
; PlatformIO Project Configuration File (for copy and paste)
|
||||||
|
;
|
||||||
|
; Build options: build flags, source filter
|
||||||
|
; Upload options: custom upload port, speed and extra flags
|
||||||
|
; Library options: dependencies, extra library storages
|
||||||
|
; Advanced options: extra scripting
|
||||||
|
;
|
||||||
|
; Please visit documentation for the other options and examples
|
||||||
|
; http://docs.platformio.org/page/projectconf.html
|
||||||
|
[platformio]
|
||||||
|
src_dir = lighthub
|
||||||
|
[env:due]
|
||||||
|
platform = atmelsam
|
||||||
|
framework = arduino
|
||||||
|
board = due
|
||||||
|
build_flags =
|
||||||
|
-D Wiz5500
|
||||||
|
ib_deps =
|
||||||
|
https://github.com/sebnil/DueFlashStorage
|
||||||
|
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
||||||
|
https://github.com/anklimov/DS2482_OneWire
|
||||||
|
https://github.com/anklimov/DmxDue
|
||||||
|
https://github.com/arduino-libraries/ArduinoHttpClient
|
||||||
|
https://github.com/anklimov/aJson
|
||||||
|
https://github.com/anklimov/CmdArduino
|
||||||
|
https://github.com/anklimov/ModbusMaster
|
||||||
|
https://github.com/anklimov/Ethernet2
|
||||||
|
https://github.com/PaulStoffregen/SPI.git
|
||||||
|
https://github.com/knolleary/pubsubclient.git
|
||||||
|
https://github.com/anklimov/Artnet.git
|
||||||
|
[env:megaatmega2560-5500]
|
||||||
|
platform = atmelavr
|
||||||
|
board = megaatmega2560
|
||||||
|
framework = arduino
|
||||||
|
build_flags = -D Wiz5500
|
||||||
|
lib_deps =
|
||||||
|
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
||||||
|
https://github.com/anklimov/DS2482_OneWire
|
||||||
|
https://github.com/anklimov/DmxSimple
|
||||||
|
https://github.com/anklimov/HTTPClient
|
||||||
|
https://github.com/anklimov/aJson
|
||||||
|
https://github.com/anklimov/CmdArduino
|
||||||
|
https://github.com/anklimov/ModbusMaster
|
||||||
|
https://github.com/anklimov/DMXSerial
|
||||||
|
https://github.com/anklimov/Ethernet2
|
||||||
|
https://github.com/PaulStoffregen/SPI.git
|
||||||
|
https://github.com/knolleary/pubsubclient.git
|
||||||
|
https://github.com/anklimov/Artnet.git
|
||||||
|
[env:megaatmega2560]
|
||||||
|
platform = atmelavr
|
||||||
|
board = megaatmega2560
|
||||||
|
framework = arduino
|
||||||
|
lib_deps =
|
||||||
|
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
||||||
|
https://github.com/anklimov/DS2482_OneWire
|
||||||
|
https://github.com/anklimov/DmxSimple
|
||||||
|
https://github.com/anklimov/HTTPClient
|
||||||
|
https://github.com/anklimov/aJson
|
||||||
|
https://github.com/anklimov/CmdArduino
|
||||||
|
https://github.com/anklimov/ModbusMaster
|
||||||
|
https://github.com/anklimov/DMXSerial
|
||||||
|
https://github.com/anklimov/Ethernet
|
||||||
|
https://github.com/PaulStoffregen/SPI.git
|
||||||
|
https://github.com/knolleary/pubsubclient.git
|
||||||
|
https://github.com/anklimov/Artnet.git
|
||||||
|
|
||||||
|
|
||||||
|
[env:due]
|
||||||
|
platform = atmelsam
|
||||||
|
framework = arduino
|
||||||
|
board = due
|
||||||
|
ib_deps =
|
||||||
|
https://github.com/sebnil/DueFlashStorage
|
||||||
|
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
||||||
|
https://github.com/anklimov/DS2482_OneWire
|
||||||
|
https://github.com/anklimov/DmxDue
|
||||||
|
https://github.com/arduino-libraries/ArduinoHttpClient
|
||||||
|
https://github.com/anklimov/aJson
|
||||||
|
https://github.com/anklimov/CmdArduino
|
||||||
|
https://github.com/anklimov/ModbusMaster
|
||||||
|
https://github.com/anklimov/Ethernet
|
||||||
|
https://github.com/PaulStoffregen/SPI.git
|
||||||
|
https://github.com/knolleary/pubsubclient.git
|
||||||
|
https://github.com/anklimov/Artnet.git
|
||||||
|
|
||||||
|
[env:espressif8266]
|
||||||
|
platform= espressif8266
|
||||||
|
framework = arduino
|
||||||
|
board = nodemcuv2
|
||||||
|
ib_deps =
|
||||||
|
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
||||||
|
https://github.com/anklimov/DS2482_OneWire
|
||||||
|
https://github.com/anklimov/ESP-Dmx
|
||||||
|
https://github.com/arduino-libraries/ArduinoHttpClient
|
||||||
|
https://github.com/anklimov/aJson
|
||||||
|
https://github.com/anklimov/CmdArduino
|
||||||
|
https://github.com/anklimov/ModbusMaster
|
||||||
|
https://github.com/anklimov/DMXSerial
|
||||||
|
https://github.com/knolleary/pubsubclient.git
|
||||||
|
https://github.com/anklimov/Artnet.git
|
||||||
Reference in New Issue
Block a user