Arduino Aquaponics: External EEPROM

This tutorial focuses on storing data in external EEPROM.  Typically, we use EEPROM to store information obtained through an interface, like buttons, or when we want to save states.  For instance, the aquaponics Pump Controller project uses a relay which turns a pump on for a time and off for a time.  Lets imagine that during setup, the pump is turn on and the next toggle time is set five minutes into the future (the pump runs for five minutes and shuts off).  Two and a half minutes through the run time, power to the Arduino goes out and then returns.  As the Arduino reboots, it sets the start time and the next toggle time all over again and by the time the new run routine is done, the pump has run two and half minutes longer than it was supposed to, potentially causing a flood in your aquaponics system (unless, of course, you used the overflow sensor).
The easy solution for this is to store the the current state (on or off) and the next toggle time into permanent memory that isn't altered when the Arduino loses power.  Enter EEPROM - programmable memory that is easy to integrate into the Arduino.  The EEPROM used in this tutorial is Microchip 24LC256 and uses the I2C bus.  If you use a different type of chip, check its datasheet to match the wiring diagram used here.

No comments:

Post a Comment