Where is the RAM on a Raspberry Pi [Answered]
Have you ever looked at a Raspberry Pi before and wondered, “Where is the RAM?”. You make be thinking, I have built a desktop before and I don’t see anywhere on this device to plug any RAM chips into. Well, in this article we are going to show you where it is and why it’s so different from you may be used to.
The RAM on a Raspberry Pi is typically located in a little black chip near the processor. On a 4GB Raspberry Pi Model 4B it is the black chip labeled DTD77 D9WHV. This black chip is an 4GB SDRAM module
The reason that you don’t see any places to insert sticks of RAM is because when someone builds an embedded system one of the priorities is to keep it small and inexpensive. One of the ways to really slim down a computer is to just solder the RAM directly to the main PCB. While this may seem unique to the Raspberry Pi it is not. In fact, tuns of items you use every day may have the RAM directly soldered to the board as well. Several laptops, including MacBooks, do this. Usually for the same reasons; portability and cost are important so, to keep things small and inexpensive, manufactures of embedded systems attach the RAM directly to the main board just like the Raspberry Pi.
How Much RAM do you have?
There are basically two ways to tell how much RAM your Raspberry Pi has.
Inspecting the chip
You can look at the RAM chip on your board and look up the numbers on the internet to tell how much RAM is in that chip. In our
example we have the
DTD77 D9WHV chip and there is 4GB stored in that little guy. If you have a different chip you
are trying to track down try to search for it on the web. If you look enough you will find what you are after.
While it is cool to search the internet to find datasheets for embedded components it is often not the best way to see how much RAM your Raspberry Pi has. Instead, here are a few useful Linux commands you can run on your Pi to see how much RAM you have access to.
pi@raspberrypi:~ $ free total used free shared buff/cache available Mem: 3931060 187380 3458884 40472 284796 3575604 Swap: 102396 0 102396
There we can see that we have 3931060 kilobytes of RAM on our Pi. While all this info is accurate it is not very human readable
to looking at the amount of RAM in kilobytes. Instead, if you use the
-h flag (h is for human 👍) than the free
command will show the same out put but with the more familiar Gi for Giga and Mi for Mega
We used a USB cable to SSH into our Raspberry Pi to run these commands. Its called Gadget Mode and if you want to learn how to quickly access your Pi with just a USB cable than checkout our article on Gadget Mode.
pi@raspberrypi:~ $ free -h total used free shared buff/cache available Mem: 3.7Gi 185Mi 3.2Gi 40Mi 352Mi 3.4Gi Swap: 99Mi 0B 99Mi
If you are paying close attention to the outputs of both the free commands you may be thinking, “Wait a second…3931060…
if I move the decimal over it is
3.9 GB. Why does the free command say
3.7 GiB”. If you did than hats off to you, the
answer is that
GiB are not the same thing. The normal SI unit GB is
1000^3 whereas GiB is
1024^3. So if you
do $3.7GiB * 1024^3 = 3972844749 Bytes => 3.9 GB$
To see the output of free in SI units you need one more flag, the
pi@raspberrypi:~ $ free -h --si total used free shared buff/cache available Mem: 3.8G 187M 3.3G 39M 355M 3.5G Swap: 99M 0B 99M
If you want to know more about the free command you can look at the manual by typing
Can I upgrade the RAM on my Raspberry Pi
Sadly no not really. One way to “expand” the amount of RAM the Raspberry Pi has access to is by creating a
page file or
swap file in the operating system. A page or swap file is a file that lives on your Raspberry Pis SD card and the Pis operating
system will offload pieces of memory into that file when the RAM starts to get full. This may seam like a sweet hack to
get more memory but it comes with one major downside. ITS VERY SLOW 😧. In fact, one of the main reasons we
have RAM instead of using the comparatively huge mass storage devices on our system is because RAM is much faster. Also,
you already have one 😄 that is what the
Swap is refering to in the second line of the
free commands output.
There are some reports of people upgrading the RAM by removing (desoldering) the RAM module on their Pis and replacing it with the larger chips. You would really need to know what you are doing to even attempt this and is probably not anywhere close to being worth the effort. Other than bragging rights course 😎