Mapping Analog Values – Digital to Analog Converter

The project Mapping Analog Values – Digital to Analog Converter or DAC will teach you fundamentals if you want to know and interact with how the analog signals work; this project best fit for you. In Arduino thing, we have two different data signals namely: the Analog and Digital signals.

Digital is what we’ve known for 1s and 0s data signals which commonly used in digital space.

Is there anything that is not digital?

Well, YES, and that is the Analog signals. The sounds you’ve heard while listening to your favorite song. The sounds produce by the machinery, devices, insects, animals and human etc. They were all Analog signals that shapes our modern era to its HIGH TECHNOLOGY and continuously improving!

In Arduino to use Analog signals for our advantage we use sensors – a devices vividly design to read analog values and convert it to digital values so that our computer who knows only 1 and 0 will interpret it and do their expected task. Each analog signal data is interpreted and it has corresponding digital data value. It is just a matter of pre-compilation happened before it is executed for its task.

This project also demonstrate how you can use data or values of a certain single each push of a button to control LEDs as many as you want for our next topic. With the use of Potentiometer we can adjust the range of values and monitor it to our virtual terminal.The blink rate of the LED depends upon the Potentiometer to adjust or to decrease the blink rate.

Below we have our Virtual Terminal so that we can monitor the timing we are going to execute a certain task.



2 – 3WAT 220R

1 – LED

1 – Arduino Uno R3

Virtual Monitor / Serial Monitor



Mapping-Analog-Values-full Mapping Analog Values – Digital to Analog Converter

Mapping-Analog-Values-full-1 Mapping Analog Values – Digital to Analog Converter



    Mapping the range of analog values from a Potentiometer to scale from 0 to 100
    resulting in an LED blink rate ranging from 0 to 100 milliseconds.
    And Potentiometer rotation percent is written to the serial port.
    Support us:

const int potPin = A1; // Select the input pin for the potentiometer
int ledPin = 12; // Select the pin for the LED

void setup()
 pinMode(ledPin, OUTPUT); // Declare the ledPin as an OUTPUT

void loop() {
 int val; // The value coming from the sensor
 int percent; // The mapped value

 val = analogRead(potPin); // Read the voltage on the pot (val ranges
 // from 0 to 1023)
 percent = map(val,0,1023,0,100); // Percent will range from 0 to 100.
 //percent = map(val,0,1023,0,270); // angle of pot derived from analogRead val
 //percent = map(val,0,1023,-135,135); // show angle of 270 degree pot with center as 0
 digitalWrite(ledPin, HIGH); // Turn the ledPin on
 delay(percent); // On time given by percent value
 digitalWrite(ledPin, LOW); // Turn the ledPin off
 delay(100 - percent); // Off time is 100 minus On time

 Serial.print("Blink rate~ "); // Show the % of pot rotation on Serial Monitor
 Serial.println(" milliseconds");

The following video shows the demo of this post:

The Analog signals could be anything that is not 1s and 0s however they are mostly seen and perfectly understand through COMPUTER!

james-pic Mapping Analog Values – Digital to Analog Converter

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.