anklimov.github.io

LightHub

is Flexible, Arduino-Mega/Arduino DUE/ESP8266 open-software and open-hardware SmartHome controller. RU HOME-site RU It may operate both:

Lighthub allows connecting together:

alt text

Where is possible both, to configure local control/mapping between inputs and outputs (light, floor heating thermostats) and remote control from MQTT enabled software. At the moment, LightHub tested and perfectly working with following set of complementary free software:

Scalability of Lighthub is virtually unlimited: Setup so many controllers you needed in most convenient places of your house - MQTT broker will allow controllers communicate each other and with Openhab/NodeRed/HomeRemote and propagate commands across network.

Please refer to our Wiki for insructions.

Finished portation of project to Arduino DUE and ESP8266 (ESP32 not tested).

Compiled image has been added to compiled/ folder. Flash your Mega 2560

avrdude  -v -V -patmega2560 -cwiring -b115200 -D -Uflash:w:firmware.hex:i

or flash your DUE (need to correct path and port, of course)

/Users/<user>/Library/Arduino15/packages/arduino/tools/bossac/1.6.1-arduino/bossac -i -d --port=cu.usbmodem1451 -U false -e -w -v -b firmware.bin -R

Note: binary images usually not up-to-date with recent code. The preferred way, to compile and upload firmware to your controller.

Dependencies

(quite big number of libs required. Use git clone to have your local copy in your Arduino libs folder) Please check updates for all dependences.

For patched libraries, appropriate GitHub repo URL provided:

Portation from AVR Mega 2560 to SAM3X8E (Arduino DUE) done since v 0.96 and tested against Wiznet 5100 Ethernet shield and Wiznet 5500 Ethernet module

Platforms specific details:

AVR version is basic, long time in production and have all functions *DMX-out is software (DMXSimple) on pin3

SAM3X8E: (Tested. In production. Recomended hardware at current moment)

ESP8266: (Developed but not tested in production)

since v. 0.97: Mega and DUE: Need to use compiler directive -D Wiz5500 and https://github.com/anklimov/Ethernet2 library to compile with Wiznet 5500 instead 5100

Prefered way to compile project is using platformio toolchain, suitable for Arduino Due, and Arduino Mega2560

Due compilation issue “USART0_Handler redefinition”

Please, open /variants/arduino_due_x/variant.cpp file, then add USART0_Handler method definition like this

void USART0_Handler(void) __attribute__((weak));

The normal path to find this file in platformio is: .platformio/packages/framework-arduinosam/variants/arduino_due_x

Platformio command line build instructions

First of all install platformio framework. Good tutorial for fast start in RUSSIAN.

In linux\OSX you can open terminal, navigate to your programming directory, then

 git clone https://github.com/anklimov/lighthub.git
 cd lighthub

now prepare project files for your IDE

pio init --ide [atom|clion|codeblocks|eclipse|emacs|netbeans|qtcreator|sublimetext|vim|visualstudio|vscode]

Set custom build flags. first make your own copy of template

cp build_flags_template.sh my_build_flags.sh

then edit, change or comment unnecessary sections and source it

source my_build_flags.sh

build and upload firmware for due|megaatmega2560|esp8266 board

pio run -e due|megaatmega2560|esp8266 -t upload

Clean pio libraries folder. Try it if you have compilation problem:

rm -Rf .piolibdeps

open COM-port monitor with specified baud rate

platformio device monitor -b 115200

Custom build flags

Default compilation behavior:

If you’ve using Arduino IDE to compile & flash firmware, it will use Default options above and you will not able to configure additional compilers options except edit “options.h” file