I am embarking on a home automation project.
The first phase is controlling my central heating system, by-passing the thermostat with an Arduino Uno. I have a one-wire DS18B20 as the temp sensor and a 16X2 LCD in the kitchen displaying central heating setpoint and actual temperature. The LCD is driven using I2C.
I then have a second Arduino that is acting as a supervisor / data aggregator and drawing data from the central heating Arduino over I2C. This supervisor Arduino then communicates through an Ethernet shield to my Iphone using Arduino Manager.
I have the bare bone of my home automation project intact. It works for a few minutes, then the LCD gradually displays random characters.
I have reviewed several of the I2C ‘multi-master’ solutions and code and read and used most of Nick Gammon’s I2C info (thanks Nick!)
I realize that I have 2 masters, which I2C supports. I want to keep the central heating Arduino as the permanent master for the central heating and keep it writing to the LCD as this is a local self-contained ’level 1’ control system. This must run regardless and have it’s own display (as will the garden irrigation system, and other internet-of-things devices over time). The supervisor / aggregator is just that, I just want it to poll for data from the central heating Arduino and handle the broadcast of information over Ethernet to smart phones, tablets etc.
I realise this is causing turmoil on the I2C bus. The central heating Arduino is acting as permanent master to its dedicated LCD in the kitchen, but then along comes the supervisory Arduino interrupting the party and asking for data. The two Arduinos need to arbitrate between themselves but this is causing the central heating Arduino to simultaneously act as master and slave and upsetting the comms to the LCD. The garden irrigation system is going to do the same.
I cannot determine if the libraries have addressed this. I do not have the software skills to code the solution, but I’m sure I am not the first to want to do this in software. I believe I need to introduce a “bus busy, please try later” routine within an adapted arbitration sequence.
I can speak it and flowchart it, I cannot code it!
I accept that I could drive the LCD as a parallel device, I do have the pins available. However this home automation project is going to expand so I really would like an I2C solution is one is possible.
Thank you in anticipation, Peter.