The initial plan was something like this:
The aim was to use a Raspberry Pi as a Webserving i2c master. This would provide a user interface accessible over the network on any device, and also the ability to relay commands to multiple i2c devices.
These slave devices contain Arduino Nanos operating as i2c slaves, with multiple relays (for controlling a tank's lights, heaters, pumps etc) and also pH and Temperature sensors for monitoring the tank's current state.
All data collected by the Slaves would be returned to the master when requested for display on the web GUI when the page is requested. For example if the user were to access page /23 on the web interface the device would make a request to the slave configured for Tank 23.
In theory I would like the master to be able to provide a set of parameters to the slave; things such as temperature and pH thresholds, to be saved to the Arduino's EEPROM. This would allow the arduino to constantly monitor the Tank's state and respond to some any anomolies:
- Trigger the heater if the temperature drops below the provided threshold
- Send warning messages back to the Pi if anything is amiss.
This would allow the user to preset configure each individual slave for the type of fish they are keeping in that tank. Ideal for a multi tank setup, or even a pet store.
While the plan has not changed, the way in which I hope to achieve the functions required has evolved following lots of trial and error and also following me picking up a great deal of practice using wifi communication.
As a result the following updates have been made to the project:
- The arduino in the slave device has been changed to a Wemos D1. It retains the Uno footprint required for use with the enclosure we are using, but enables WiFi to be used as a comms protocol
- i2c is no longer required for linking the Pi (the 'Hub') to the Slaves (the 'Control Units'); The Hub will use a USB Dongle in AP mode alongside it's onboard Wifi, and the ESP8266-powered Control Units will connect to this AP.
- The Control Units no longer require the Hub to operate; the Units will now server their own simple web GUI to allow for standalone use (great for home use).
- The Control Units will also host the data via a second web page in JSON. The Pi-powered hub will scrape this information using a Python script.
- The Hub will relay all scraped information in a single web interface for ease of viewing,
- The Hub will also pass data to an IoT site to allow for monitoring from anywhere.