Arduino Wiring

You can easily wire this breakout to any microcontroller, we'll be using an Arduino
  • 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
The I2C FRAM has a default I2C address of 0x50 but you can set the address to any of 8 values between 0x50 and 0x57 so you can have up to 8 of these chips all sharing the same SCL/SDA pins. We suggest just connecting up the power and SDA/SCL pins for now. Once you have things working, change up the address as desired.

Download Adafruit_FRAM_I2C

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
Rename the uncompressed folder Adafruit_FRAM_I2C and check that the Adafruit_FRAM_I2C folder contains Adafruit_FRAM_I2C.cpp and Adafruit_FRAM_I2C.h

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:

Load Demo

Open up File->Examples->Adafruit_FRAM_I2C->MB85RC256V and upload to your Arduino wired up to the sensor
Thats it! Now open up the serial terminal window at 9600 speed to begin the test.

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!)

Library Reference

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
for example.

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
which returns a byte reading.

This guide was first published on May 20, 2014. It was last updated on May 24, 2024.

This page (Arduino Test) was last updated on May 19, 2014.

Text editor powered by tinymce.