Giter Site home page Giter Site logo

openmili's Introduction

openmili

Open implementation of the Mi-Light 2.4GHz LED light control protocol

This project should eventually contain

  • Library for a virtual PL1167 based on a Nordic back-end, or real PL1167 connected over SPI
  • Nordic back-ends for nRF51[48]22 running natively on nRF51-DONGLE (pca10031), and nRF24L01(+) connected over SPI to Arduino
  • Library for Mi-Light protocol messages (sending and receiving)
  • Dumb sender/receiver that simply exposes Mi-Light messages over serial (both nRF51/pca10031 and nRF24/Arduino)
  • Host software that is a drop-in replacement for a Mi-Light Wi-Fi gateway, using the dumb sender, but with configurable sender IDs
  • Maybe: Smarter firmware that can speak the protocol on its own, possibly with improved timing

openmili's People

Contributors

henryk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openmili's Issues

Control with arduino

Could someone please tell me how I could control the bulbs with an Arduino and a nRF24L01 module?
I can only see this on every start of the arduino:
"# OpenMiLight Receiver/Transmitter starting"

How could I for example pair the "arduino remote" with the bulb as group2 ?
I think I have to send some thing like this:
B0 F2 EA 7D B0 15 F0

But how do I enter it correctly in the SerialMonitor to send it?
Any help is highly appreciated!

I cant also receive anything as I am using the bulb with my original remote.
I can switch to
"# Escaped to extended commands: r - Toggle receiver; Press enter to return to normal mode."
"# Now receiving"

But after this nothing happens if I press buttons on my remote.
Hope you have any ideas.

Thanks a lot!

Sending does not work reliable

I'm trying to develop a module for node.js and than in future develop a plugin for pimatic.
Here is what I have: https://github.com/Xento/node-milight-rf24
I have 3 milight bulbs but sometimes none of them responses to a button press for example "All on".
I have to resend the command serveral times with a different framenumber, than mostly all bulbs respond to it.
Is there anything that maybe can be improved in you sketch?

PL1167_nRF24.h + ESP32 ( pipe[] issue )

Does anyone know how to get PL1167_nRF24 to work with ESP32?

Everything goes, except that pipe[] value in PL1167_nRF24.cpp was already declared in the hardware files of ESP32:
static const uint8_t pipe[] = {0xd1, 0x28, 0x5e, 0x55, 0x55};
'const uint8_t pipe []' redeclared as different kind of symbol

I simply renamed the pipe[] value and this will compile and execute, the code seems to receive milight packets but rather unstable and in long bursts ( not parsing the end properly? )

(Using arduino IDE + ESP32 + latest version of RF24 library)

Association mode

I try association but it doesn't work. First I start admin (https://github.com/riptidewave93/RFLED-Server/blob/master/source/admin.py) and I can use Milight 2.0 app on Android.
I try new association, Led bulb will flash 3 times (so seems to be ok) but after that I can't switch to white only RGB work (OFF and ON commands doesn't work too).
And after a while, my bulb doesn't work with remote and I can't remove association or associate with the wifi bridge ... :(

Esp8266 support, reason for group limitation?

I've read some of your project logs on hackaday.io and have been waiting for over a year for someone to shed some light on the protocol. I noticed that you've mentioned the nRF51 several times and seem to lean towards that SoC. I know this project is in extremely early stages but I'd like to ask that you not leave out us esp8266 folks.

I haven't had much time to study the reason behind the 4 group limitation but could you shed some light on that as well? How do multiple bridges work at the moment? Do multiple remotes paired to multiple bridges work? If so, couldn't you simulate multiple bridges using some sort of unique ID per group?

Thanks for any info. Looking to get started on this. I have a nuand bladeRF that I've been meaning to break out again and this project could just be my excuse to do so.

Edit; Forgot to mention, great work so far! Looks very promising.

Can control everything, except switch-off bulbs

Hi @henryk ,

Just wondering if you happen to have some insights regarding switching-off a group.
I can switch-on every group, bind/sync bulbs RGB+W, change color and brightness, but not turn-off bulbs.

I've tried various clients, LimitlessLed (IOS) and domiticz, and netcat
root@pc:/# echo -n -e "\x46\00" | nc -u 192.168.88.221 8899 -q1
all fail in turning-off the bulbs.
although the 0x41 and 0x42 do work as advertised, but switch all bulbs on/off

I have this issue with 2 bulbs, but not when using the Rf remote.
I did use Energia (so MSP430 instead of an Arduino), and have my UART running on 9600, although as it seems that I'm able to send al other options, that that should not matter.

Any pointers perhaps some checksum or race condition.. i'm really puzzled

Can't compile in arduino

Hi,

First things first: thank you for this project! I have been having some trouble getting the milight bridge to work consistently and I hope to overcome its limitations with openmili.

That said, I am having some trouble getting this code to compile in Arduino IDE. I am trying to flash it to an ESP8266 ESP-201 module, but keep hitting the same walls:

I get this error:
"printf.h:34:27: error: 'fdevopen' was not declared in this scope
fdevopen( &serial_putc, 0 );"

...and if I comment said line, I get this one:

several times "openmili.ino:23: undefined reference to `putchar'" and then "collect2.exe: error: ld returned 1 exit status. Error compiling."

What am I doing wrong?

PS: if I select an Arduino Pro Mini board, it compiles correctly.

Thanks!

André

Execution problems

So far I have:

Connected Arduino to an nRF24L01+ and validated the connectivity using the helpful information and code in the link below.

Re: Simple nRF24L01+ 2.4GHz transceiver demo
https://forum.arduino.cc/index.php?topic=421081.15

I then installed the Arduino code and added the libraries required by the sketch. note:downloading all the files into a folder named openmili is a requirement

I changed pins for CE and CSN definition to 9 and 10 respectively as that was the proven combination from the nRF24L01 tutorials referenced above

I ran the python script and found the error serial not defined and resolved that by installing pyserial. note:the script runs in python 2 and you have to install pyserial for your python 2 install as the defaults are now all to python3. if you need to run python 3 other issues will point you to some required changes to the python code

I started the arduino and checked the serial monitor showed the program starting
I started python and it said the serial port was busy so had to exit the serial monitor
I restarted the python script and it showed the start up message

I am stuck. I did not buy a remote or a bridge and I need to pair the light with the emulator and do not know process

Can't receive any valid signals from my CW/WW remote

Hi there,
I want to control my Arduino UNO with a connected nRF24L01 module via the CW/WW remote from my Milight bulbs - sooo in theory your project should make this possible, right?

I connected the nRF24L01 module (and tested it with another piece of code) to my UNO and changed two lines in MiLightRadio.cpp since I want to use the CW/WW:
Line 12: static const uint8_t CHANNELS[] = {4, 39, 74};
Line 42: retval = _pl1167.setSyncword(0x050A, 0x55AA);
These changes were recommended by this page, which is my starting point to your project: https://arduino-projects4u.com/milight-rf-control/

Sadly, this doesn't appear to work as intended.
The channel settings seem to be fine since I can receive something (_radio.available() in PL1167_nRF24::receive does trigger correctly) but then I can't see that the received information can be handled. I assume the syncWord is wrong?

In the end, the program starts and waits for incoming (readable) data and can't detect anything.

I know, this project does not look like to be your most recent one, but I feel like this problem actually isn't that big.
I would really appreciate any help on this!

Openmili library not working on esp32/8266 : CRC fail

Hello guys, after a few months i reuploaded my working packet sniffer for milight, it uses openmili. But the 8 bytes that i expected didnt show up, after some more debugging i found that the CRC check failed in the milightradio.cpp file, any solutions? ( could you also add a working pinout that i am sure i didnt do somemthing wrong with my pinning?)

Mapping to RGB value

I don't know how to create a pull request so I am posting it here
A mapping function that converts the color and intensity values to rgb

uint32_t toRgb(uint8_t r, uint8_t g, uint8_t b) {
  return ((uint32_t)r << 16) | ((uint32_t)g <<  8) | b;
}

uint32_t milightColor(uint32_t WheelPos, byte intensity) {
    double value;
    if (intensity >= 0 && intensity <= 0x90){
       value = (double)(0x90 - intensity) / 0xE8;
    }else if (intensity >= 0xA8 && intensity <= 0xFF){
       value = (double)(0x98 + 0xF8 - intensity) / 0xE8;
    }

    WheelPos = 255 - (((uint32_t)WheelPos + 0x0000FF - 0x00001B) % 256);

    if (WheelPos < 85) {
        return toRgb((255 - WheelPos * 3) * value, 0, (WheelPos * 3) * value);
    }
    if (WheelPos < 170) {
        WheelPos -= 85;
        return toRgb(0, (WheelPos * 3) * value, (255 - WheelPos * 3) * value);
    }
    WheelPos -= 170;
    return toRgb((WheelPos * 3) * value, (255 - WheelPos * 3) * value, 0);
}

This shit...

Arduino: 1.6.5 (Windows 7), Board: "Arduino Uno"

Build options changed, rebuilding all

openmili\MiLightRadio.cpp.o: In function MiLightRadio::MiLightRadio(AbstractPL1167&)': C:\Program Files (x86)\Arduino\libraries\openmili/MiLightRadio.cpp:16: multiple definition of MiLightRadio::MiLightRadio(AbstractPL1167&)'
MiLightRadio.cpp.o:C:\Users\Slashy\AppData\Local\Temp\build5520367769872665586.tmp/MiLightRadio.cpp:16: first defined here
openmili\MiLightRadio.cpp.o: In function MiLightRadio::MiLightRadio(AbstractPL1167&)': C:\Program Files (x86)\Arduino\libraries\openmili/MiLightRadio.cpp:16: multiple definition of MiLightRadio::MiLightRadio(AbstractPL1167&)'
MiLightRadio.cpp.o:C:\Users\Slashy\AppData\Local\Temp\build5520367769872665586.tmp/MiLightRadio.cpp:16: first defined here
openmili\MiLightRadio.cpp.o: In function MiLightRadio::MiLightRadio(AbstractPL1167&)': C:\Program Files (x86)\Arduino\libraries\openmili/MiLightRadio.cpp:16: multiple definition of MiLightRadio::available()'
MiLightRadio.cpp.o:C:\Users\Slashy\AppData\Local\Temp\build5520367769872665586.tmp/MiLightRadio.cpp:16: first defined here
openmili\MiLightRadio.cpp.o: In function MiLightRadio::MiLightRadio(AbstractPL1167&)': C:\Program Files (x86)\Arduino\libraries\openmili/MiLightRadio.cpp:16: multiple definition of MiLightRadio::begin()'
MiLightRadio.cpp.o:C:\Users\Slashy\AppData\Local\Temp\build5520367769872665586.tmp/MiLightRadio.cpp:16: first defined here
openmili\MiLightRadio.cpp.o: In function MiLightRadio::MiLightRadio(AbstractPL1167&)': C:\Program Files (x86)\Arduino\libraries\openmili/MiLightRadio.cpp:16: multiple definition of MiLightRadio::dupesReceived()'
MiLightRadio.cpp.o:C:\Users\Slashy\AppData\Local\Temp\build5520367769872665586.tmp/MiLightRadio.cpp:16: first defined here
openmili\MiLightRadio.cpp.o: In function MiLightRadio::MiLightRadio(AbstractPL1167&)': C:\Program Files (x86)\Arduino\libraries\openmili/MiLightRadio.cpp:16: multiple definition of MiLightRadio::read(unsigned char*, unsigned int&)'
MiLightRadio.cpp.o:C:\Users\Slashy\AppData\Local\Temp\build5520367769872665586.tmp/MiLightRadio.cpp:16: first defined here
openmili\MiLightRadio.cpp.o: In function MiLightRadio::MiLightRadio(AbstractPL1167&)': C:\Program Files (x86)\Arduino\libraries\openmili/MiLightRadio.cpp:16: multiple definition of MiLightRadio::resend()'
MiLightRadio.cpp.o:C:\Users\Slashy\AppData\Local\Temp\build5520367769872665586.tmp/MiLightRadio.cpp:16: first defined here
openmili\MiLightRadio.cpp.o: In function MiLightRadio::MiLightRadio(AbstractPL1167&)': C:\Program Files (x86)\Arduino\libraries\openmili/MiLightRadio.cpp:16: multiple definition of MiLightRadio::write(unsigned char*, unsigned int)'
MiLightRadio.cpp.o:C:\Users\Slashy\AppData\Local\Temp\build5520367769872665586.tmp/MiLightRadio.cpp:16: first defined here
openmili\PL1167_nRF24.cpp.o: In function PL1167_nRF24::writeFIFO(unsigned char const*, unsigned int)': C:\Program Files (x86)\Arduino\libraries\openmili/PL1167_nRF24.cpp:172: multiple definition of PL1167_nRF24::writeFIFO(unsigned char const*, unsigned int)'
PL1167_nRF24.cpp.o:C:\Users\Slashy\AppData\Local\Temp\build5520367769872665586.tmp/PL1167_nRF24.cpp:172: first defined here
openmili\PL1167_nRF24.cpp.o: In function calc_crc': C:\Program Files (x86)\Arduino\libraries\openmili/PL1167_nRF24.cpp:366: multiple definition of PL1167_nRF24::readFIFO(unsigned char*, unsigned int&)'
PL1167_nRF24.cpp.o:C:\Users\Slashy\AppData\Local\Temp\build5520367769872665586.tmp/PL1167_nRF24.cpp:366: first defined here
openmili\PL1167_nRF24.cpp.o: In function calc_crc': C:\Program Files (x86)\Arduino\libraries\openmili/PL1167_nRF24.cpp:366: multiple definition of PL1167_nRF24::PL1167_nRF24(RF24&)'
PL1167_nRF24.cpp.o:C:\Users\Slashy\AppData\Local\Temp\build5520367769872665586.tmp/PL1167_nRF24.cpp:366: first defined here
openmili\PL1167_nRF24.cpp.o: In function calc_crc': C:\Program Files (x86)\Arduino\libraries\openmili/PL1167_nRF24.cpp:366: multiple definition of PL1167_nRF24::PL1167_nRF24(RF24&)'
PL1167_nRF24.cpp.o:C:\Users\Slashy\AppData\Local\Temp\build5520367769872665586.tmp/PL1167_nRF24.cpp:366: first defined here
openmili\PL1167_nRF24.cpp.o: In function calc_crc': C:\Program Files (x86)\Arduino\libraries\openmili/PL1167_nRF24.cpp:366: multiple definition of PL1167_nRF24::recalc_parameters()'
PL1167_nRF24.cpp.o:C:\Users\Slashy\AppData\Local\Temp\build5520367769872665586.tmp/PL1167_nRF24.cpp:366: first defined here
openmili\PL1167_nRF24.cpp.o: In function calc_crc': C:\Program Files (x86)\Arduino\libraries\openmili/PL1167_nRF24.cpp:366: multiple definition of PL1167_nRF24::open()'
PL1167_nRF24.cpp.o:C:\Users\Slashy\AppData\Local\Temp\build5520367769872665586.tmp/PL1167_nRF24.cpp:366: first defined here
openmili\PL1167_nRF24.cpp.o: In function calc_crc': C:\Program Files (x86)\Arduino\libraries\openmili/PL1167_nRF24.cpp:366: multiple definition of PL1167_nRF24::setPreambleLength(unsigned char)'
PL1167_nRF24.cpp.o:C:\Users\Slashy\AppData\Local\Temp\build5520367769872665586.tmp/PL1167_nRF24.cpp:366: first defined here
openmili\PL1167_nRF24.cpp.o: In function calc_crc': C:\Program Files (x86)\Arduino\libraries\openmili/PL1167_nRF24.cpp:366: multiple definition of PL1167_nRF24::setSyncword(unsigned int, unsigned int)'
PL1167_nRF24.cpp.o:C:\Users\Slashy\AppData\Local\Temp\build5520367769872665586.tmp/PL1167_nRF24.cpp:366: first defined here
openmili\PL1167_nRF24.cpp.o: In function calc_crc': C:\Program Files (x86)\Arduino\libraries\openmili/PL1167_nRF24.cpp:366: multiple definition of PL1167_nRF24::setTrailerLength(unsigned char)'
PL1167_nRF24.cpp.o:C:\Users\Slashy\AppData\Local\Temp\build5520367769872665586.tmp/PL1167_nRF24.cpp:366: first defined here
openmili\PL1167_nRF24.cpp.o: In function calc_crc': C:\Program Files (x86)\Arduino\libraries\openmili/PL1167_nRF24.cpp:366: multiple definition of PL1167_nRF24::setCRC(bool)'
PL1167_nRF24.cpp.o:C:\Users\Slashy\AppData\Local\Temp\build5520367769872665586.tmp/PL1167_nRF24.cpp:366: first defined here
openmili\PL1167_nRF24.cpp.o: In function calc_crc': C:\Program Files (x86)\Arduino\libraries\openmili/PL1167_nRF24.cpp:366: multiple definition of PL1167_nRF24::setMaxPacketLength(unsigned char)'
PL1167_nRF24.cpp.o:C:\Users\Slashy\AppData\Local\Temp\build5520367769872665586.tmp/PL1167_nRF24.cpp:366: first defined here
openmili\PL1167_nRF24.cpp.o: In function calc_crc': C:\Program Files (x86)\Arduino\libraries\openmili/PL1167_nRF24.cpp:366: multiple definition of PL1167_nRF24::transmit(unsigned char)'
PL1167_nRF24.cpp.o:C:\Users\Slashy\AppData\Local\Temp\build5520367769872665586.tmp/PL1167_nRF24.cpp:366: first defined here
openmili\PL1167_nRF24.cpp.o: In function calc_crc': C:\Program Files (x86)\Arduino\libraries\openmili/PL1167_nRF24.cpp:366: multiple definition of PL1167_nRF24::internal_receive()'
PL1167_nRF24.cpp.o:C:\Users\Slashy\AppData\Local\Temp\build5520367769872665586.tmp/PL1167_nRF24.cpp:366: first defined here
openmili\PL1167_nRF24.cpp.o: In function calc_crc': C:\Program Files (x86)\Arduino\libraries\openmili/PL1167_nRF24.cpp:366: multiple definition of PL1167_nRF24::receive(unsigned char)'
PL1167_nRF24.cpp.o:C:\Users\Slashy\AppData\Local\Temp\build5520367769872665586.tmp/PL1167_nRF24.cpp:366: first defined here
collect2.exe: error: ld returned 1 exit status
Error compiling.

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

Is it possible to control LED strips (Mi-light)

Here is the device:
http://www.aliexpress.com/snapshot/7650559185.html?orderId=75123623302888

Nothing works..

root@raspberrypi:/var/www/html/RPi/openmilight/Raspberry/librf24-bcm/openmilight# ./openmilight
================ SPI Configuration ================
CSN Pin = CE0 (PI Hardware Driven)
CE Pin = Custom GPIO25
Clock Speed = 1 Mhz
================ NRF Configuration ================
STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0x55555e28d1 0x55555e28d1
RX_ADDR_P2-5 = 0x33 0xce 0x3e 0xe3
TX_ADDR = 0x55555e28d1
RX_PW_P0-6 = 0x0c 0x0c 0x20 0x20 0x20 0x20
EN_AA = 0x00
EN_RXADDR = 0x3e
RF_CH = 0x0b
RF_SETUP = 0x07
CONFIG = 0x17
DYNPD/FEATURE = 0x00 0x00
Data Rate = 1MBPS
Model = nRF24L01+
CRC Length = Disabled
PA Power = PA_MAX
in listening mode

No reponse anymore

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.