Connect Vcc to the power supply, 3V or 5V is fine. Use the same
voltage that the microcontroller logic is based off of. For most
Arduinos, that is 5V
- Connect GND to common power/data ground
- Connect the SCL pin to the I2C clock SCL pin on your Arduino. On an UNO & '328 based Arduino, this is also known as A5, on a Mega it is also known as digital 21 and on a Leonardo/Micro, digital 3
- Connect the SDA pin to the I2C data SDA pin on your Arduino. On an UNO & '328 based Arduino, this is also known as A4, on a Mega it is also known as digital 20 and on a Leonardo/Micro, digital 2
To begin reading and writing data to the chip, you will need to download Adafruit_FRAM_I2C from our github repository. You can do that by visiting the github repo and manually downloading or, easier, just click this button to download the zip
Place the Adafruit_FRAM_I2C library folder your arduinosketchfolder/libraries/ folder.
You may need to create the libraries subfolder if its your first library. Restart the IDE.
We also have a great tutorial on Arduino library installation at:
Open up File->Examples->Adafruit_FRAM_I2C->MB85RC256V and upload to your Arduino wired up to the sensor
The test is fairly simple - It first verifies that the chip has been found. Then it reads the value written to location #0 in the memory, prints that out and write that value + 1 back to location #0. This acts like a restart-meter: every time the board is reset the value goes up one so you can keep track of how many times its been restarted.
Afterwards, the Arduino prints out the value in every location (all 256KB!)
The library we have is simple and easy to use
You can create the FRAM object with
Adafruit_FRAM_I2C fram = Adafruit_FRAM_I2C();Then when you begin(), pass in the i2c address. The default is 0x50 so if you don't put any value in the default is used.
If you have different addresses, call something like
Then to write a value, call
fram.write8(address, byte-value);to write an 8-bit value to the address location
Later on of course you can also read with
fram.read8(address);which returns a byte reading.