Hi guys, Im working on home automation project with my Rpi 2 and Arduino UNO. Im running openHAB app on my RPi and it can communicate with arduino(with ethernet) by MQTT. Works nicely, BUT , I want to use this Arduino with ethernet shield , just as Ethernet gateway, and pass all data to next arduino thru I2C. And here is the problem , OpenHAB is sending instructions thru MQTT (so “topic” and “payload”), I can receive it nicely on Ethernet gateway, But, I need some help with sending this data as they are over I2C to another arduino, I need to send two messages , one with topic , and another one with payload.
Here is the Gateway code :
void callback(char* topic, byte* payload, unsigned int length) {
Serial.print("New message from broker on topic : ");
Serial.println(topic);
Wire.beginTransmission(9);
Wire.write(topic);
Wire.endTransmission();
delay(1);
Wire.beginTransmission(9);
Wire.write(payload,length);
Wire.endTransmission();
Have u any ideas how can I send these two messages and save it in two variables in other arduino ?
Size of these messages may vary !
Thanks much guys.
Second arduino will care about wireless data sending via NRF24l01, switching some switches and some lights, I tried some time ago to combine arduino Ethernet with these NRF24l01 chips and some more functions and it was too much for arduino´s memory…
Now the scheme is :
RPI(openHAB) <-MQTT-> Arduino ethernet <-I2C-> other Arduino <-NRF24l01-> last Arduino
Im planning to get more of these “Last Arduinos” they will be acting like nodes and they will gather data from various sensors and send them back to RPI and also they can control some … for example lights…
And Chargin... Yes I saw this library but I can´t make it work ... Yes , it work with simple int or so... but I need to send one *char , and one *byte array ...