Learn about the main types of random access memory — DRAM and SRAM —and how you can use RAM in your projects.
When comparing consumer devices, everybody seems to be talking about RAM. But what is RAM, what types of are there, and how can you use this type of memory in your project? This article will compare the two main types of random access memory — DRAM and SRAM — and discuss how you can use RAM in your future electronic projects.
Random Access Memory
RAM stands for random access memory. Random access is the ability to access an element of a storage device roughly as fast and easily as any other of the elements in that memory device. It doesn’t matter how large the device is or how many memory elements and cells it has.
In contrast, data on a sequential memory device, like a CD, cannot be accessed that way. Usually, the drive’s laser has to travel and the CD has to spin to read a certain value stored on the disk. Therefore, depending on the current position and rotation, it’s not guaranteed that different parts on that storage device can be accessed in the same amount of time.
Today, SRAM and DRAM are the two most commonly used technologies, both having unique properties, advantages, and disadvantages.
Dynamic Random Access Memory (DRAM)
DRAM uses capacitors to store each bit of data within an integrated circuit. The capacitors can either be charged or discharged to represent the two states of a binary digit:
The capacitors will discharge over time and therefore lose the stored values if they are not refreshed periodically. This is done by a memory refresh circuit that’s responsible for rewriting the data in the capacitors. Furthermore, dynamic RAM is more complicated to use as it requires more precise timings than SRAM.
However, this simple design allows the RAM chips to be small and therefore this type of memory is mainly used in modern computers, smartphones, game consoles, and typically everywhere else, where large amounts of relatively cheap memory are needed in a small package.
Static Random Access Memory (SRAM)
SRAM, in contrast to DRAM, stores the information with transistors instead of capacitors:
This type of memory is more complicated, larger, and more expensive than DRAM. However, it’s also faster and doesn’t need to be periodically refreshed. Furthermore, it uses less power than DRAM. These positive properties make SRAM perfect for when you need smaller amounts of fast memory, for example as local caches in a CPU.
Non-Volatile RAM (NVRAM)
Both DRAM and SRAM are volatile, meaning they won’t store data permanently and quickly lose the stored information when they are not powered on. Today, the most commonly used type of NVRAM is flash memory which is often used to replace hard disk drives in computers or as the main storage medium on embedded and mobile devices.
The advantages of these are fast random access, better physical durability, and small power consumption. However, they can only be erased and rewritten a certain number of times.
DRAM vs. SRAM for Makers
A DRAM is smaller, cheaper, and easier to build than SRAM. However, it’s typically slower and more complicated to use; it requires more precise timings and an additional refresh circuit. Therefore, SRAM is usually the better choice for hobbyists. Both types are typically used with parallel inputs and outputs.