Random Access Memory: RAM Explained

chips-20072_1920

Random access memory is an important thing to know about when building computers, or even when just buying a new computer. You will often hear RAM be simply referred to as ‘memory’. On the other hand, there is also ROM, which stands for Read-Only Memory. RAM and ROM should not be confused as they are two separate types of memory.  Here I will discuss only Random Access Memory, and save ROM for another day.

So, what is RAM? Physically, they are simply the thin rectangular sticks that are (in parallel) plugged in to your motherboard. What they do is hold information that you access, such as files and folders. This information will stay in the RAMs memory banks for as long as they are supplied power, but once power is lost – so is the information held inside RAM. Why does it constantly need power?  That is because RAM is volatile. And WTH is that?!

In order to really understand this, we need to learn about the two most types of RAM:

DRAM: Dynamic Random Access Memory

SRAM: Static Random Access Memory

Dynamic RAM is again, volatile, meaning that it needs to be refreshed many times in order to retain the information inside its memory banks. This ‘refreshing’ is more or less reminding itself what it is storing. Even while supplied power the memory cells will still weaken, until it is refreshed again. This happens over, and over, at very fast rates in order to retain this information. Once power is turned off, the information inside DRAM will be almost immediately lost. DRAM is used as the main memory for computers and is relatively cheap.

Like DRAM, Static RAM is also volatile, but the difference with this kind of RAM is that it is able to hold information for a longer period of time and does not need to be refreshed. This is because the cells inside SRAM require four to six transistors, where DRAM only has one. Simply, there is more help to retain the information for longer periods. Once power is turned off, the information inside SRAM will over time be lost. SRAM is much faster (and much more expensive) than DRAM, and for that reason is used as cache memory inside CPUs.

Now that we know what DRAM and SRAM are, we can talk about the different kinds of DRAM. As you will see, as RAM technology is improving and able to process data faster, it is also requiring less voltage to do so.

First – imprint this equation in to your mind:

Transfer rate (or MT/s) x 8 bytes = Bytes per second (data throughput)

(8 bytes being the width of all DDR SDRAM)

Note: MT/s is mega transfers per second. Or simply, a million transfers per clock cycle.

Later on these equations might get longer. And I know people might comment and say there are with simpler equations, and that mine are a little drawn out. But these are the original equations for determining data throughput, and in the end multiplying MT/s by 8 bytes will always give you your throughput. But I take the extra steps to hopefully make you understand how we came to the figures. Believe me, I am not a wizard at math and I have dreaded doing this blog on RAM because it can at times be a little complex to understand, but I believe it is rather important. That said, moving on.

SDRAM:  Synchronous Dynamic RAM. This type of RAM ‘syncs’ itself to the system clock speed. The CPU is also tied to the system clock speed. Meaning, SDRAM syncs itself with the same timing of the CPU. The CPU communicates to the Memory Chip Controller (also tried to system clock) telling the SDRAM when they are able to transmit data, and then transmits this data through independent banks on the memory chips simultaneously one time per clock cycle. If you relate it to taking breaths, SDRAM transmits one piece of data every time you take a deep breath. SDRAM also uses pipelining, which means the memory chips are able to accept new information before processing the old information, achieving higher data transfer rates.

Say you have a system clock speed of 100MHz. Your transfer rate would be 100 MT/s. And one stick of RAM which has 8 bytes. Multiplying the MT/s by 8 bytes will give you the rate (megabytes/second) in which your system processes data.

100 MT/s x 8 bytes = 800MB/second = PC800 = PC rating of SDRAM operating with a clock rate of 100 MHz

RAM Clock Rate I/O Bus Clock MT/s
SDRAM 100MHz 100 MHz 100 MT/s

SDR can also stand for Single Data Rate. The power consumption for SDRAM is 3.3V.

DDR-SDRAM: Double Data rate SDRAM. Where SDRAM transmits data one time per clock cycle, double-data rate will transfer two. This is referred to as “double pumping.” While maintaining the same clock frequency, DDR doubles the input/output speed. If we think of the breathing concept again, DDR-SDRAM will send data when you take a deep breath in, and then send data again when you fully exhale. That being said, DDR-SDRAM is sending data on the rise and fall of a full clock cycle.

Referring back to our equation of MT/s x 8 bytes = data throughput (MB/s), since DDR doubles the data rate of SDRAM (still using same clock rate of 100MHz), we would get the following equation:

200 MT/s x 8 bytes = 1600MB/second = PC1600 = PC rating of DDR SDRAM operating with a clock rate of 100 MHz

RAM Clock Rate I/O Bus Clock MT/s
DDR SDRAM 100MHz 100 MHz 200 MT/s

The power consumption is roughly 2.6V. Unfortunately, DDR is not backward compatible with SDRAM.

DDR is comprised of the following:

RAM Clock Rate I/O Bus Clock MB/s
DDR-200 100 MHz 100 MHz 1600
DDR-266 133.33 MHz 133.33 MHz 2133
DDR-333 166.67 MHz 166.67 MHz 2666
DDR-400 200 MHz 200 MHz 3200

DDR2-SDRAM: Double Data Rate 2nd Gen. SDRAM. The benefit of DDR2 is that it halves the speed of the internal clock to that of the data bus. Simply, it doubles the bus speed. With a higher bus speed it is able to transfer double that of DDR: four transfers per clock cycle. So our original 100 MHz doubles our internal bus speed to 200 MHz. And DDR2 quadrupled our original clock cycle speed (100 MHz) to give us our transfer rate of 400 MT/s.

Referring again back to the equation, we would get the following:

400 MT/s x 8 bytes = 3200MB/second = PC3200 = PC rating of DDR2 SDRAM operating with a clock rate of 100 MHz

RAM Clock Rate I/O Bus Clock MT/s
DDR2 SDRAM 100MHz 200 MHz 400 MT/s

Due to the internal clock at half speed, power consumption is reduced to roughly 1.8V. Like DDR, it is not backwards compatible.

DDR2 is comprised of the following:

RAM Clock Rate I/O Bus Clock MB/s
DDR2-400 100 MHz 200 MHz 3200
DDR2-533 133.33 MHz 266.66 MHz 4266.67
DDR2-667 166.67 MHz 333.33 MHz 5333.33
DDR2-800 200 MHz 400 MHz 6400
DDR2-1066 266.67 MHz 533.33 MHz 8533.33

DDR3-SDRAM: Double Data Rate 3rd Gen. SDRAM. With DDR3, we are tripling the clock rate to get our bus speed. And to get our mega transfers we are “doubling” yet again, from four data transfers to eight data transfers, per clock cycle, giving us 800 MT/s.

Again, back to the drawing board with our equation:

800 MT/s x 8 bytes = 6400MB/second = PC6400 = PC rating of DDR3 SDRAM operating with a clock rate of 100 MHz

RAM Clock Rate I/O Bus Clock MT/s
DDR3 SDRAM 100MHz 400 MHz 800 MT/s

Power consumption is reduced from 1.8V to 1.5V. And like the generations before it, DD3 is not backward compatible with DDR2 or DDR.

DDR3 is comprised of the following:

RAM Clock Rate I/O Bus Clock MB/s
DDR3-800 100 MHz 400 MHz 6400
DDR3-1066 133.33 MHz 533.33 MHz 8533.33
DDR3-1333 166.67 MHz 666.67 MHz 10666.67
DDR3-1600 200 MHz 800 MHz 12800
DDR3-1866 233.33 MHz 933.33 MHz 14933.33
DDR3-2133 266.67 MHz 1066.67 MHz 17066.67

DDR4-SDRAM: Double Data Rate 4th Gen. SDRAM. First off, systems that are using DDR4 SDRAM cannot operate at a clock rate of 100 MHz. DDR4 requires a minimum clock rate of 200 MHz, so that is where I will explain.  With DDR4, we are tripling the clock rate (now 200MHz) to get our bus speed of 800 MHz. And of course, our mega transfers are “doubled” that of DD3, from 8 to 16.

1600 MT/s x 8 bytes = 12,800/second = PC12800 = PC rating of DDR4 SDRAM operating with a clock rate of 200 MHz

RAM Clock Rate I/O Bus Clock MT/s
DDR4 SDRAM 200MHz 800 MHz 1600 MT/s

Power consumption is reduced from 1.5V to roughly 1.2V. And of course – not backward compatible.

DDR4 is comprised of the following:

RAM Clock Rate I/O Bus Clock MB/s
DDR4-1600 200 MHz 800 MHz 12800
DDR4-1866 233.33 MHz 933.33 MHz 14933.33
DDR4-2133 266.67 MHz 1066.67 MHz 17066.67
DDR4-2400 300 MHz 1200 MHz 19200

For a long time now people thought that DDR4 would be the finale when it came to DRAM, but DDR5 will soon be reaching our doorstep, with a release in the year 2020. And when I say soon, I mean like a year and a half after it is actually released. DDR5 is slated to be installed in to servers first before is it released to the major population. Since we are already at transfer rates of up to almost 20 GB/s (standard, without overclocking), I’m curious as to what DDR5 will have in store for us.

All I know is that it will not be backward compatible. Spoiler alert!

Advertisements

Solar-Powered Weather Station: Part II

This is the second (and final) part to the weather station I am building. If you haven’t read the first part of this blog then you can read it here:

Solar-Powered Weather Station: Part I

In the first part we discussed the parts needed to build the weather station and how to assemble them. Lastly I discussed how it communicated. In this part I will cover how to provide solar power to the weather board and the final preparations before putting the weather station outside.

How to Provide Solar Power

I plan on having my weather station attached to the top of the house, so it needs to have its own power such as a solar panel. This requires a couple parts. The first piece is the actual solar panel. I chose a Voltaic Solar Panel. To power the solar panel, it needs to be connected to a solar charger. For my set up I am using the Sparkfun Sunny Buddy. This is a maximum power point tracking (MPPT) solar charger intended for single-cell Lithium Polymer Batteries. We need a battery to store the power, so for this I purchased a LiPo battery with an output of 3.7V at 1000mAh which is suitable for the Sunny Buddy. The battery plugs directly into the Sunny Buddy. There is also a spot on the weather board for a two wire power connector. The connector end plugs in to the weather board, and the other end can either be soldered to the Sunny Buddy, or mounted with a 2-pin screw terminal. I would recommend the screw terminal because you will be disconnecting it quite often.

img_3878

LiPo battery (left) plugs in to Sunny Buddy (right). Two-wire cable from Sunny Buddy connects to Weatherboard (center).

Bringing It All Together

At this point we have everything we need to power our weather station, as well as communication that we covered in Part I. There is only one thing left to do, and that is assembling it all together so we can test it.

You should have already soldered on the RJ11 terminals to the bottom of the weatherboard. After that you can also solder on two 10-pin headers so you can attach an Xbee. At this point the weatherboard is ready to communicate.

Next we want to take care of the Sunny Buddy. Like I said in the Power section above, you can attach a 2-pin terminal to the Sunny Buddy so you can connect the weatherboard, or you can just solder the power wires directly to the board. I would recommend the terminals so you’re able to disconnect the weatherboard whenever you wish (i.e. troubleshooting). The LiPo battery is attached to the weatherboard, as shown in the above picture, and the solar panel connects to the Sunny Buddy via a barrel plug.

img_3877

Solar Panel plugs in to Sunny Buddy via a 3.5×1.1mm barrel plug. LiPo battery plugs in to Sunny Buddy via connecter labeled ‘BATT’.

Now we need to set up the Xbee on the computer side so the weatherboard is able to relay weather information to us. This requires an Xbee Explorer, an Xbee module, and a mini USB cable. Attach the Xbee to the Explorer (also note the proper orientation!). Finally, plug the Explorer in to your computer using a mini USB cable. The Explorer should find the previous driver you downloaded earlier and install successfully. If not, you may need to install manually. Just follow the same steps mentioned in part one.

If you take a look at your weatherboard, you will notice two switches. One switch allows you to switch between USB power and BAT (battery/solar) power. The other switch is for communication, and allows you to switch between USB and RF (radio frequency). For the two Xbee modules to communicate with each other, the weatherboard needs to be set to RF. Once set to RF, and both weatherboard and Explorer are supplied power, the weatherboard Xbee will automatically connect to the Explorer Xbee and transmit information.

img_3886

Switches (bottom center) for Communication and Power.

In order to see the output from the weatherboard, you will need a terminal emulation program that communicates with serial COM ports. There are many free, open-source terminal emulators out there such as Tera Term, PuTTY, and HyperACCESS. I use Tera Term but you can use any program you wish. Just make sure you select the correct COM port that your weatherboard is using from within the terminal emulator. Once you do so you should get an output like in the picture below. Outputs will show up as ‘FAIL’ if there is no data to display. This can be changed by editing the code.

capture

Weather Data Displayed through Tera Term

Yours may look a bit different than mine. I modified my output to metric since I live in Europe. It’s all too easy to do so – just press CTRL + Z from within the terminal and you will get the weatherboard menu.

Note: Changing the wind speed from miles per hour to a metric reading will instead give you meters per second (m/s) rather than the usual kilometers per hour (km/h). After much aggravation, a simple way of changing this was found. If you need help with this switch just let me know.

Final Preparations

Now that our communications are working and have external power, we are able to house it all in an outdoor case to place outside. In these outdoor cases it is easy to cut the foam in to square sections for the electronics. Cut out the foam and place in the weatherboard, battery, and Sunny Buddy solar charger to suit your needs.

After you are satisfied with your layout, you need to remove everything (including foam) so you can drill the side holes for the solar panel and two RJ11 wires, including a hole for the duck antenna. You want to size these holes so you are able to screw in at least two cable gland joints big enough to insert the wires, but small enough so they can tighten around the cable to prevent water seeping inside. I also sealed the glands with waterproof sealant. I made three holes altogether: one for solar panel wire, one for both RJ11 connectors, and lastly the duck antenna.

img_3881

Once the holes and gland joints are in place, replace the foam and electronics. Insert wires, connect, and tighten joint caps.

Note: For a tighter, more secure hold, you can wrap the wires in electrical tape at the point where they are secured by the gland joints.

For connections, you should:

  • Connect the two RJ11 connectors to corresponding terminals on weatherboard.
  • Connect the U.FL antenna wire to the Xbee module on the weatherboard.
  • Plug in solar panel cable to Solar Buddy
  • Make sure Solar Buddy is plugged in to weatherboard
  • Attach LiPo battery to weatherboard
  • Make sure switches are set to RF and BAT

Finally – put it outside and be able to know exactly what the weather is in your own back yard! I have still been unable to attach this friggin’ thing to the top of the house. I’ll edit the last picture (and title picture) once it is finally in place. In the meantime, here is a picture of it lifting weights while doing its thing on the balcony.

img_3888

Thank you for following along. I hope you enjoyed this article and that your weather station is suiting your needs!

== Errata / Corrections ==

  • The wire coming off solar panel is way too short so I added a Voltaic 4 FT extension cable for ease of use and mobility.
    • Voltaic 4 ft. Extension Cable for Solar Panel: 3.5×1.1mm
  • When drilling holes through outdoor box, be sure to drill them through the bottom and not the sides. Helps prevent against moisture! Obvious mistake I made and noticed right after.
  • Edited Firmware v1.4 code:
    • Changed metric wind speed values from m/s to km/h
    • Increased ranges on all readings to bypass “FAIL” message.
  • FAILED light reading due to weatherboard inside dark enclosure:
    • I will eventually add a light tube of some sort, or a see-through opening on the box so light can pass through to the light sensor.
  • I ended up removing the two-pin terminal I used for easy disconnection of Solar Buddy from weatherboard. I couldn’t get a solid connection with it so I just soldered the wires to the board. It has worked great since, but unfortunately I lose the ability to disconnect the solar charger.
  • Due to sensors being inside outdoor box, there is a rough difference of about 3 degrees compared to the actual outside temperature. Seeing this, I adjusted the code to take in this difference.