This is a small board that plugs into one of the headers on an Arduino Uno or other board to provide 4Mbytes of non-volatile storage:
It works with either 5V or 3.3V boards, and is based on the low-cost 4Mbyte Winbond W25Q32FVSIG DataFlash chip. It is ideal for applications such as data logging, playing audio samples, and storing text.
I also describe a simple DataFlash library to interface to the board.
A DataFlash chip is a simple and low cost way to add non-volatile storage to a microcontroller; chips offering 4Mbytes of storage are available for under 20 pence/cents each from AliExpress or eBay.
The downside of using DataFlash chips for non-volatile storage is that the smallest area you can erase is a 4Kbyte sector. If you want to provide the ability to change a single byte at an arbitrary address you have to copy the previous contents of the sector to RAM, or elsewhere on the DataFlash, erase the 4Kbyte sector containing the byte, update the sector copy, and then restore the sector to the DataFlash.
This Simple DataFlash Library avoids the need for temporary storage by having the following restrictions:
- When writing, you have to erase the entire DataFlash, and then write successive bytes from the start of the memory.
- When reading you can read successive bytes from any starting position.
This treats the DataFlash much like a sequential file, which is ideal for applications such as datalogging, creating a text database, or saving audio samples. For example, with a 4Mbyte DataFlash chip you could:
- Log the temperature every second for 46 days.
- Store and read back 2000 pages of text or four novels.
- Store and play back 12 minutes of digitised speech.
The Winbond DataFlash chips have a life of over 100,000 erase/program cycles.
Here’s the circuit of the Simple DataFlash board:
I based it on the low-cost 4Mbyte Winbond W25Q32FVSIG DataFlash chip , but it should also be compatible with any 25-Series DataFlash chip, such as the 8Mbyte W25Q64 or the 16Mbyte W25Q128.
The DataFlash board includes a regulator, to provide the 3.3V that the DataFlash chip needs, and logic level converters on the CS, MOSI, and SCK inputs, to make it suitable for use with both 3.3V and 5V microcontroller boards.
The circuit fits on a board 16.5 mm square which I designed in Eagle and sent to PCBWay for fabrication . I chose a green PCB to match the Arduino Uno. There’s a link to the Eagle files at the end of the article if you want to make yourself a board.
The edge connector is designed to plug straight into the standard header on a microcontroller board, such as the Arduino Uno, with the GND pin plugged into the GND pin on the top row of edge connectors: