Posts with «resolution» label

How to buy a monitor in 2021

With the COVID pandemic still upon us, a monitor is one of the most important computer buying decisions you can make. Luckily, there’s never been more choice, and we’ve seen vast improvements in color accuracy, size and resolution since our last update.

It’s great to have lots of choice, but it can also make your buying decision a challenge. For example, do you need HDR, and if so, how bright should your monitor be? How important is color accuracy, refresh rates and input lag? What size do you need? Should it be curved or straight?

Luckily, we’ve done the research and can help you figure all that out depending on your specific needs and, most importantly, budget. Read on to see exactly what to look for in a monitor and which makes and models to choose.

The basics

Screen size, resolution and display format

In this day and age, screen size rules. Where 24-inch displays used to be more or less standard (and can still be useful for basic computing), 27-, 32-, 34- and even 42-inch displays have become popular for entertainment, content creation and even gaming these days.

Nearly every monitor used to be 16:9, but it’s now possible to find 16:10 and other more exotic display shapes. On the gaming and entertainment side, we’re also seeing very wide and curved monitors with aspect ratios like 21:9. If you do decide to buy an ultrawide display, however, keep in mind that a 30-inch 21:9 model is the same height as a 24-inch monitor, so you might end up with a smaller display than you expected. As a rule of thumb, add 25 percent to the size of a 21:9 monitor to get the size you need.

4K is nearly a must for content creators, and some folks are even going for 5K or all the way up to 8K. Keep in mind, though, that you’ll need a pretty powerful computer to drive all those pixels. And 4K should be paired with a screen size of 27 inches and up, or you won’t notice much difference between 1440p. At the same time, I wouldn’t get a model larger than 27 inches unless it’s 4K, as you’ll start to see pixelation if you’re working up close to the display.

One new category to consider is portable monitors designed to be carried and used with laptops. Those typically come in 1080p resolutions and sizes from 13-15 inches. They usually have a lightweight kickstand-type support that folds up to keep things compact.  

HDR

HDR is the buzzy monitor feature to have these days, but be careful before jumping in. Some monitors that claim HDR on the marketing materials don’t even conform to a base standard. To be sure that a display at least meets minimum HDR specs, you’ll want to choose one with a DisplayHDR rating with each tier representing maximum brightness in nits.

However, the lowest DisplayHDR 400 and 500 tiers may disappoint you with a lack of brightness, washed out blacks and mediocre color reproduction.If you can afford it, choose a model with DisplayHDR 600, 1000 or True Black 400, True Black 500 and True Black 600. The True Black settings are designed primarily for OLED models, with maximum black levels at .0005 nits.

Where televisions typically offer HDR10 and Dolby Vision or HDR10+, most PC monitors only support the HDR10 standard, other than a few (very expensive) models. That doesn’t matter much for content creation or gaming, but HDR streaming on Netflix, Amazon Prime Video and other services won’t look quite as punchy. 

Refresh rate

Refresh rate is a key feature, particularly on gaming monitors. A bare minimum nowadays is 60Hz, and 80Hz refresh rates and up are much easier on the eyes. However, most 4K displays top out at 60Hz with some rare exceptions and the HDMI 2.0 spec only supports 4K at 60Hz, so you’d need at least DisplayPort 1.4 (4K at 120Hz) or HDMI 2.1. The latter is now available on a number of monitors, particularly gaming displays. However, it’s only supported on the latest NVIDIA RTX 3000- and AMD RX 6000-series GPUs and requires a very powerful PC.

Inputs

There are essentially three types of modern display inputs: Thunderbolt, DisplayPort and HDMI. Most monitors built for PCs come with the latter two, while a select few (typically built for Macs) will use Thunderbolt. To add to the confusion, USB-C ports may be Thunderbolt 3 and by extension, DisplayPort compatible, so you may need a USB-C to Thunderbolt or DisplayPort cable adapter depending on your display.

Panel type

The cheapest monitors are still TN (twisted nematic), which are strictly for gaming or office use. VA (vertical alignment) monitors are also relatively cheap, while offering good brightness and high contrast ratios. However, content creators will probably want an IPS (in-plane switching) LCD display that delivers better color accuracy, image quality and viewing angles.

If maximum brightness is important, a quantum dot LCD display is the way to go — those are typically found in larger displays. OLED monitors are now available and offer the best blacks and color reproduction, but they lack the brightness of LED or quantum dot displays. Plus, they cost a lot.

The new panel on the block is MiniLED. It’s similar to quantum dot tech, but as the name suggests, it uses smaller LED diodes that are just 0.2mm in diameter. As such, manufacturers can pack in up to three times more LEDs with more local dimming zones, delivering deeper blacks and better contrast. 

Color bit depth

Serious content content creators should consider a more costly 10-bit monitor that can display billions of colors. If budget is an issue, you can go for an 8-bit panel that can fake billions of colors via dithering (often spec’d as “8-bit + FRC”). For entertainment or business purposes, a regular 8-bit monitor that can display millions of colors will be fine.

Color gamut

The other aspect of color is the gamut. That expresses the range of colors that can be reproduced and not just the number of colors. Most good monitors these days can cover the sRGB and Rec.709 gamuts (designed for photos and video respectively). For more demanding work, though, you’ll want one that can reproduce more demanding modern gamuts like AdobeRGB, DCI-P3 and Rec.2020 gamuts, which encompass a wider range of colors. The latter two are often used for film projection and HDR, respectively. 

Engadget picks

Best monitor around $200

Acer KG241Q

Acer

Whether you need a monitor for gaming, entertainment or work, Acer’s 24-inch KG241Q offers a lot of value. Resolution is limited to 1080p, but it delivers a 144Hz refresh rate and comes with AMD FreeSync support. Other features include a 1-millisecond lag time, 300 nits of brightness, HDMI and DisplayPort inputs and a tilting stand. The downsides are tricky access to the ports and a TN display that looks dim at an angle, but it’s a heck of a steal right now at $155.

Buy 24-inch Acer KG241Q at B&H Photo - $180


Best monitors around $300

ASUS ProArt PA278QV

ASUS

Moving your budget up by just $100 opens up a whole lot more options. A case in point is our pick for content creation chores, the ASUS ProArt PA278QV. You get a larger 27-inch size, increased 2,560 x 1,440 resolution and a superior IPS panel. As with other ProArt models, the PA278QV is designed specifically for photo and video editing, with a 100 percent Rec.709 gamut, Calman verified color accuracy and ProArt presets and palettes for different kinds of work. It also offers DisplayPort and HDMI ports and tilt, swivel, pivot and height adjustments. That’s a lot of monitor for a current street price of $315.

Buy 27-inch ASUS ProArt PA278QV at B&H - $319

Dell S2522HG

Dell

There are numerous decent gaming monitors around $300, but we’ve managed to narrow it down to one: Dell’s S2522HG. For a monitor in this price range, you get a lot: a 24.5-inch IPS 1080p display with a 240Hz refresh rate, 400 nits of brightness, 1-millisecond response time and AMD Free-Sync and NVIDIA G-Sync compatibility. It comes with HDMI, DisplayPort and SuperSpeed USB 3.2 Gen1 inputs, along with a stand that allows for height adjustment, tilt, swivel and pivot. You can pick one up now at Amazon for $320.

Buy 24-inch Dell S2522HG at Amazon - $320


Best monitor around $400

LG 27UK500

LG

LG’s 27UK500 is a nice all around monitor that can cover gaming, entertainment and some content creation. The 27-inch 4K IPS display covers 98 percent of the sRGB gamut and supports HDR10 with 10-bit color, though it only outputs 300 nits of brightness so it isn’t DisplayHDR certified. If you like 4K gaming, it can handle that decently thanks to AMD FreeSync support, a 60 Hz refresh rate and a 5-millisecond response time. The downsides are a tilt only stand, but it’s very well priced at just $347. 

Buy 27-inch LG 27UK500 at B&H - $347


Best monitors around $500

BenQ PD2700U

BenQ

For creatives, the BenQ PD2700U pushes all the right buttons. The 27-inch 4K IPS panel delivers 10-bit HDR color and covers 100 percent of the sRGB gamut with Calman verified Delta E color accuracy less than 3. It’s also a fine choice for entertainment and gaming with 350 nits of brightness, a 1300:1 contrast ratio, viewing angle of 178 degrees and a 5-millisecond response time. It has tilt, swivel, pivot and height adjustment and most of the ports you need, including HDMI 2.0 and DisplayPort 1.4. You can pick one up now at B&H for $500.

Buy 27-inch BenQ PD2700U at B&H Photo - $500

Acer Nitro XV252Q

Acer

Acer’s Nitro XV252Q is the only gaming monitor under $500 that supports 360 Hz refresh rates, but there’s more to it than just that. The 24.5-inch HD display outputs 400 nits of brightness, so it’s DisplayHDR 400 certified for HDR games and movies. It also comes with AMD FreeSync compatibility, a 99 percent sRGB color gamut and DisplayPort 1.4 and HDMI 2.0 connections. You can tilt, swivel, pivot and adjust the height by up to 4.7 inches, and it looks pretty snazzy, with very slim side and top bezels.

Buy 25-inch Acer Nitro XV252Q at Amazon - $500


Best monitors under $700

Dell UltraSharp 27 U2720Q

Dell

Dell’s 27-inch, 4K U2720Q IPS monitor offers 4K HDR performance for a decent price. It conforms to the DisplayHDR 400 spec while offering 10-bits of color and 99 percent sRGB coverage, with a Delta E color accuracy of less than two out of the box. So this is a good monitor for HDR movies and doing some graphics chores, particularly HDR video work — all for under $700.

Buy 27-inch UltraSharp U2720Q at Dell - $580

Acer Predator XB273K

Acer

Though it’s marketed as a gaming monitor thanks to the 120Hz refresh rate, 1-millisecond response time and G-Sync support, Acer’s 4K quantum dot Predator XB273K is really a jack of all trades. It’s also DisplayHDR 400 compatible, covers 90 percent of the challenging DCI-P3 color gamut and offers a Delta<1 color accuracy. You also get tilt and height adjustments, HDMI 2.0 and DisplayPort 1.4 ports and pivot and height adjustment.

Buy 27-inch Acer Predator XB273K at Amazon - $621


Best monitor for Mac users

LG Ultrafine 4K and 5K

LG

Apple’s $5,000 Pro Display XDR is much too rich for most of us, so the next most logical option is LG’s $1,300 Ultrafine 5K display, also sold on Apple’s Store. With a 27-inch 5K panel, you not only get very high resolution but also 500 nits of brightness (albeit, without HDR capability). It’s color-accurate out of the box, making it great for video- and photo-editing work on a Mac or MacBook. Finally, it supports Thunderbolt 3 with daisy chaining and power delivery, all of which is very useful for Mac users.

If that model is too much, you can also consider LG’s 24-inch Ultrafine 4K. For nearly half the price ($700), it offers many of the same features (including the powered and daisy-chained Thunderbolt ports, color accuracy and more) in a smaller size and with just a bit less resolution.

Buy LG Ultrafine 5K at Apple - $1,300Buy LG Ultrafine 4K at Apple - $700

Best ultrawide monitor

MSI Optix MPG341CQR

MSI

Ultrawide 21:9 monitors are a great option for some types of content creation, flight sims and financial work. The best model this year (with perhaps the worst name) is MSI’s Optix MPG341CQR. With an 1800R curve and 3,440 x 1,440 resolution it’s ideal for gaming, with the 120Hz refresh rate, 1-millisecond response time and HDR 400 also helping in that regard. It also offers a frameless design, tilt, swivel and height adjustment and HDMI 2.0/DisplayPort 1.4 ports. It also has an LED strip that provides helpful cues for in-game status like remaining health or ammo, too.

Buy 43-inch MSI Optix MPG341CQR at Amazon - $645

Best portable monitor

ViewSonic VG1655

ViewSonic

To best complement your laptop, a portable monitor should be small, lightweight and not too expensive. The model that best meets all those requirements is ViewSonic’s VG1655. At 15.6 inches and weighing under 2 pounds, the 1080p 60 Hz IPS display can be toted around fairly easily but still provide crisp, clear visuals. It’s also reasonably bright at 250 nits, comes in standard and touch version, packs dual speakers and has a built-in stand with a cover.

Buy 15-inch ViewSonic VG1655 at Amazon - $250

Best HDMI 2.1 monitor

Acer Nitro XV282K

Acer

If you’re gaming on the bleeding edge at 4K and 120Hz, you’ll first need either a fast PC or PS5/Xbox Series X console. If you’ve got that and would prefer to use a monitor rather than a TV, your best bet will soon be Acer's Nitro XV282K display. Along with 4K resolution at up to 144Hz, it offers a 1-millisecond refresh rate, 10-bit color and 400 nits (DisplayHDR 400 compatible) of brightness. It comes, of course, with an HDMI 2.1 input, along with DisplayPort 1.4. It’s not yet available, but should arrive soon for $900.

Pre-order 28-inch Acer Nitro XV282K at B&H - $899

Best luxury monitor

ASUS ProArt PA32UCG-K

ASUS

ASUS still holds the prize for best luxury monitor, but it discontinued the previous mini-LED $4,000 ProArt PA32UCX monitor and replaced it with the $5,000 PA32UCG-K display. It uses the same mini-LED tech, but ups the ante with 1,600 nits of brightness, an HDMI 2.1 port, 4K 120Hz resolution, 10-bit, 98 percent DCI-P3 coverage and an impressive 85 percent Rec.2020 coverage. Oh, and it’s one of the few monitors out there that supports Dolby Vision, along with HDR10 and HLG.

You’re probably doing it wrong if you’re using a $5K monitor for gaming. However, it does support AMD FreeSync (good for gaming creation) and has a 5-millisecond response time, very respectable for a display essentially designed for professional colorists. And to that end, color accuracy is calibrated to Delta E < 1 and it’s a true 10-bit panel delivering billions of colors.

Buy 32-inch ASUS ProArt PA32UCG-K at B&H - $4,999

Best 8K display

Dell UltraSharp 32 UP3218K

Dell

Faster than we think, 8K video will be upon us, so you might be pondering an 8K monitor to stay ahead of the curve. Dell’s UP3218K is part of its UltraSharp lineup for creators, so it not only delivers 8K (7,680 x 4,320) 60p resolution but other nice pro features, too.

The 10-bit native IPS panel delivers 400 nits of brightness, though the UP3218K isn’t an HDR monitor. It also delivers 1.07 billion colors and covers 98 percent of the DCI-P3 color gamut, with a Delta E of less than two out of the box. It’s also one of the few monitors that flips around 90 degrees, making it good for portrait photo work.

This monitor isn’t cheap either at $3,500 (8K monitors are still very rare), but Dell’s UP3216Q 4K monitor has most of the features for less than half the price. It’s not quite as bright at 350 nits and covers just 87 percent of the DCI-P3 gamut, but it offers 1.07 billion colors and is just as precise for color correction out of the box.

Buy 32-inch UltraSharp UP3218K at Dell - $3,755

New Project: Build an Automatic Photo Rig for Perfect Panoramas

Make an automatic camera rig for shooting high-resolution panoramas with a point-and-shoot camera.

Read more on MAKE

The post Build an Automatic Photo Rig for Perfect Panoramas appeared first on Make: DIY Projects, How-Tos, Electronics, Crafts and Ideas for Makers.

Arduino Tutorials – Chapter 22 – the AREF pin

Learn how to measure smaller voltages with greater accuracy using your Arduino.

This is chapter twenty-two of our huge Arduino tutorial seriesUpdated 12/12/2013

In this chapter we’ll look at how you can measure smaller voltages with greater accuracy using the analogue input pins on your Arduino or compatible board in conjunction with the AREF pin. However first we’ll do some revision to get you up to speed. Please read this post entirely before working with AREF the first time.

Revision

You may recall from the first few chapters in our tutorial series that we used the analogRead() function to measure the voltage of an electrical current from sensors and so on using one of the analogue input pins. The value returned from analogRead() would be between zero an 1023, with zero representing zero volts and 1023 representing the operating voltage of the Arduino board in use.

And when we say the operating voltage – this is the voltage available to the Arduino after the power supply circuitry. For example, if you have a typical Arduino Uno board and run it from the USB socket – sure, there is 5V available to the board from the USB socket on your computer or hub – but the voltage is reduced slightly as the current winds around the circuit to the microcontroller – or the USB source just isn’t up to scratch.

This can easily be demonstrated by connecting an Arduino Uno to USB and putting a multimeter set to measure voltage across the 5V and GND pins. Some boards will return as low as 4.8 V, some higher but still below 5V. So if you’re gunning for accuracy, power your board from an external power supply via the DC socket or Vin pin – such as 9V DC. Then after that goes through the power regulator circuit you’ll have a nice 5V, for example:

This is important as the accuracy of any analogRead() values will be affected by not having a true 5 V. If you don’t have any option, you can use some maths in your sketch to compensate for the drop in voltage. For example, if your voltage is 4.8V – the analogRead() range of 0~1023 will relate to 0~4.8V and not 0~5V. This may sound trivial, however if you’re using a sensor that returns a value as a voltage (e.g. the TMP36 temperature sensor) – the calculated value will be wrong. So in the interests of accuracy, use an external power supply.

Why does analogRead() return a value between 0 and 1023?

This is due to the resolution of the ADC. The resolution (for this article) is the degree to which something can be represented numerically. The higher the resolution, the greater accuracy with which something can be represented. We measure resolution in the terms of the number of bits of resolution.

For example, a 1-bit resolution would only allow two (two to the power of one) values – zero and one. A 2-bit resolution would allow four (two to the power of two) values – zero, one, two and three. If we tried to measure  a five volt range with a two-bit resolution, and the measured voltage was four volts, our ADC would return a numerical value of 3 – as four volts falls between 3.75 and 5V. It is easier to imagine this with the following image:

 So with our example ADC with 2-bit resolution, it can only represent the voltage with four possible resulting values. If the input voltage falls between 0 and 1.25, the ADC returns numerical 0; if the voltage falls between 1.25 and 2.5, the ADC returns a numerical value of 1. And so on. With our Arduino’s ADC range of 0~1023 – we have 1024 possible values – or 2 to the power of 10. So our Arduinos have an ADC with a 10-bit resolution.

So what is AREF? 

To cut a long story short, when your Arduino takes an analogue reading, it compares the voltage measured at the analogue pin being used against what is known as the reference voltage. In normal analogRead use, the reference voltage is the operating voltage of the board. For the more popular Arduino boards such as the Uno, Mega, Duemilanove and Leonardo/Yún boards, the operating voltage of 5V. If you have an Arduino Due board, the operating voltage is 3.3V. If you have something else – check the Arduino product page or ask your board supplier.

So if you have a reference voltage of 5V, each unit returned by analogRead() is valued at 0.00488 V. (This is calculated by dividing 1024 into 5V). What if we want to measure voltages between 0 and 2, or 0 and 4.6? How would the ADC know what is 100% of our voltage range?

And therein lies the reason for the AREF pin. AREF means Analogue REFerence. It allows us to feed the Arduino a reference voltage from an external power supply. For example, if we want to measure voltages with a maximum range of 3.3V, we would feed a nice smooth 3.3V into the AREF pin – perhaps from a voltage regulator IC. Then the each step of the ADC would represent around 3.22 millivolts (divide 1024 into 3.3).

Note that the lowest reference voltage you can have is 1.1V. There are two forms of AREF – internal and external, so let’s check them out.

External AREF

An external AREF is where you supply an external reference voltage to the Arduino board. This can come from a regulated power supply, or if you need 3.3V you can get it from the Arduino’s 3.3V pin. If you are using an external power supply, be sure to connect the GND to the Arduino’s GND pin. Or if you’re using the Arduno’s 3.3V source – just run a jumper from the 3.3V pin to the AREF pin.

To activate the external AREF, use the following in void setup():

analogReference(EXTERNAL); // use AREF for reference voltage

This sets the reference voltage to whatever you have connected to the AREF pin – which of course will have a voltage between 1.1V and the board’s operation voltage.

Very important note – when using an external voltage reference, you must set the analogue reference to EXTERNAL before using analogRead(). This will prevent you from shorting the active internal reference voltage and the AREF pin, which can damage the microcontroller on the board.

If necessary for your application, you can revert back to the board’s operating voltage for AREF (that is – back to normal) with the following:

analogReference(DEFAULT);

Now to demonstrate external AREF at work. Using a 3.3V AREF, the following sketch measures the voltage from A0 and displays the percentage of total AREF and the calculated voltage:

#include <LiquidCrystal.h>
LiquidCrystal lcd(8,9,4,5,6,7);

int analoginput = 0; // our analog pin
int analogamount = 0; // stores incoming value
float percentage = 0; // used to store our percentage value
float voltage =0; // used to store voltage value

void setup()
{
  lcd.begin(16, 2);
  analogReference(EXTERNAL); // use AREF for reference voltage
}

void loop()
{
  lcd.clear();
  analogamount=analogRead(analoginput);
  percentage=(analogamount/1024.00)*100;
  voltage=analogamount*3.222; // in millivolts
  lcd.setCursor(0,0);
  lcd.print("% of AREF: ");
  lcd.print(percentage,2);
  lcd.setCursor(0,1);  
  lcd.print("A0 (mV): ");
  lcd.println(voltage,2);
  delay(250);
}

The results of the sketch above are shown in the following video:

Internal AREF

The microcontrollers on our Arduino boards can also generate an internal reference voltage of 1.1V and we can use this for AREF work. Simply use the line:

analogReference(INTERNAL);

For Arduino Mega boards, use:

analogReference(INTERNAL1V1);

in void setup() and you’re off. If you have an Arduino Mega there is also a 2.56V reference voltage available which is activated with:

analogReference(INTERNAL2V56);

Finally – before settling on the results from your AREF pin, always calibrate the readings against a known good multimeter.

Conclusion

The AREF function gives you more flexibility with measuring analogue signals. If you are interested in using specific ADC components, we have tutorials on the ADS1110 16-bit ADC and the NXP PCF 8591 8-bit A/D and D/A IC.

Stay tuned for upcoming Arduino tutorials by subscribing to the blog, RSS feed (top-right), twitter or joining our Google Group. And if you enjoyed the tutorial, or want to introduce someone else to the interesting world of Arduino – check out my book (now in a third printing!) “Arduino Workshop” from No Starch Press.

 

Arduino Tutorials – Chapter 22 – the AREF pin

Learn how to measure smaller voltages with greater accuracy using your Arduino.

This is chapter twenty-two of our huge Arduino tutorial seriesUpdated 12/12/2013

In this chapter we’ll look at how you can measure smaller voltages with greater accuracy using the analogue input pins on your Arduino or compatible board in conjunction with the AREF pin. However first we’ll do some revision to get you up to speed. Please read this post entirely before working with AREF the first time.

Revision

You may recall from the first few chapters in our tutorial series that we used the analogRead() function to measure the voltage of an electrical current from sensors and so on using one of the analogue input pins. The value returned from analogRead() would be between zero an 1023, with zero representing zero volts and 1023 representing the operating voltage of the Arduino board in use.

And when we say the operating voltage – this is the voltage available to the Arduino after the power supply circuitry. For example, if you have a typical Arduino Uno board and run it from the USB socket – sure, there is 5V available to the board from the USB socket on your computer or hub – but the voltage is reduced slightly as the current winds around the circuit to the microcontroller – or the USB source just isn’t up to scratch.

This can easily be demonstrated by connecting an Arduino Uno to USB and putting a multimeter set to measure voltage across the 5V and GND pins. Some boards will return as low as 4.8 V, some higher but still below 5V. So if you’re gunning for accuracy, power your board from an external power supply via the DC socket or Vin pin – such as 9V DC. Then after that goes through the power regulator circuit you’ll have a nice 5V, for example:

This is important as the accuracy of any analogRead() values will be affected by not having a true 5 V. If you don’t have any option, you can use some maths in your sketch to compensate for the drop in voltage. For example, if your voltage is 4.8V – the analogRead() range of 0~1023 will relate to 0~4.8V and not 0~5V. This may sound trivial, however if you’re using a sensor that returns a value as a voltage (e.g. the TMP36 temperature sensor) – the calculated value will be wrong. So in the interests of accuracy, use an external power supply.

Why does analogRead() return a value between 0 and 1023?

This is due to the resolution of the ADC. The resolution (for this article) is the degree to which something can be represented numerically. The higher the resolution, the greater accuracy with which something can be represented. We measure resolution in the terms of the number of bits of resolution.

For example, a 1-bit resolution would only allow two (two to the power of one) values – zero and one. A 2-bit resolution would allow four (two to the power of two) values – zero, one, two and three. If we tried to measure  a five volt range with a two-bit resolution, and the measured voltage was four volts, our ADC would return a numerical value of 3 – as four volts falls between 3.75 and 5V. It is easier to imagine this with the following image:

 So with our example ADC with 2-bit resolution, it can only represent the voltage with four possible resulting values. If the input voltage falls between 0 and 1.25, the ADC returns numerical 0; if the voltage falls between 1.25 and 2.5, the ADC returns a numerical value of 1. And so on. With our Arduino’s ADC range of 0~1023 – we have 1024 possible values – or 2 to the power of 10. So our Arduinos have an ADC with a 10-bit resolution.

So what is AREF? 

To cut a long story short, when your Arduino takes an analogue reading, it compares the voltage measured at the analogue pin being used against what is known as the reference voltage. In normal analogRead use, the reference voltage is the operating voltage of the board. For the more popular Arduino boards such as the Uno, Mega, Duemilanove and Leonardo/Yún boards, the operating voltage of 5V. If you have an Arduino Due board, the operating voltage is 3.3V. If you have something else – check the Arduino product page or ask your board supplier.

So if you have a reference voltage of 5V, each unit returned by analogRead() is valued at 0.00488 V. (This is calculated by dividing 1024 into 5V). What if we want to measure voltages between 0 and 2, or 0 and 4.6? How would the ADC know what is 100% of our voltage range?

And therein lies the reason for the AREF pin. AREF means Analogue REFerence. It allows us to feed the Arduino a reference voltage from an external power supply. For example, if we want to measure voltages with a maximum range of 3.3V, we would feed a nice smooth 3.3V into the AREF pin – perhaps from a voltage regulator IC. Then the each step of the ADC would represent around 3.22 millivolts (divide 1024 into 3.3).

Note that the lowest reference voltage you can have is 1.1V. There are two forms of AREF – internal and external, so let’s check them out.

External AREF

An external AREF is where you supply an external reference voltage to the Arduino board. This can come from a regulated power supply, or if you need 3.3V you can get it from the Arduino’s 3.3V pin. If you are using an external power supply, be sure to connect the GND to the Arduino’s GND pin. Or if you’re using the Arduno’s 3.3V source – just run a jumper from the 3.3V pin to the AREF pin.

To activate the external AREF, use the following in void setup():

analogReference(EXTERNAL); // use AREF for reference voltage

This sets the reference voltage to whatever you have connected to the AREF pin – which of course will have a voltage between 1.1V and the board’s operation voltage.

Very important note – when using an external voltage reference, you must set the analogue reference to EXTERNAL before using analogRead(). This will prevent you from shorting the active internal reference voltage and the AREF pin, which can damage the microcontroller on the board.

If necessary for your application, you can revert back to the board’s operating voltage for AREF (that is – back to normal) with the following:

analogReference(DEFAULT);

Now to demonstrate external AREF at work. Using a 3.3V AREF, the following sketch measures the voltage from A0 and displays the percentage of total AREF and the calculated voltage:

#include <LiquidCrystal.h>
LiquidCrystal lcd(8,9,4,5,6,7);

int analoginput = 0; // our analog pin
int analogamount = 0; // stores incoming value
float percentage = 0; // used to store our percentage value
float voltage =0; // used to store voltage value

void setup()
{
  lcd.begin(16, 2);
  analogReference(EXTERNAL); // use AREF for reference voltage
}

void loop()
{
  lcd.clear();
  analogamount=analogRead(analoginput);
  percentage=(analogamount/1024.00)*100;
  voltage=analogamount*3.222; // in millivolts
  lcd.setCursor(0,0);
  lcd.print("% of AREF: ");
  lcd.print(percentage,2);
  lcd.setCursor(0,1);  
  lcd.print("A0 (mV): ");
  lcd.println(voltage,2);
  delay(250);
}

The results of the sketch above are shown in the following video:

Internal AREF

The microcontrollers on our Arduino boards can also generate an internal reference voltage of 1.1V and we can use this for AREF work. Simply use the line:

analogReference(INTERNAL);

For Arduino Mega boards, use:

analogReference(INTERNAL1V1);

in void setup() and you’re off. If you have an Arduino Mega there is also a 2.56V reference voltage available which is activated with:

analogReference(INTERNAL2V56);

Finally – before settling on the results from your AREF pin, always calibrate the readings against a known good multimeter.

Conclusion

The AREF function gives you more flexibility with measuring analogue signals. If you are interested in using specific ADC components, we have tutorials on the ADS1110 16-bit ADC and the NXP PCF 8591 8-bit A/D and D/A IC.

Stay tuned for upcoming Arduino tutorials by subscribing to the blog, RSS feed (top-right), twitter or joining our Google Group. And if you enjoyed the tutorial, or want to introduce someone else to the interesting world of Arduino – check out my book (now in a third printing!) “Arduino Workshop” from No Starch Press.

 

The post Arduino Tutorials – Chapter 22 – the AREF pin appeared first on tronixstuff.