Skip to main content

Featured Post

Kerala's First 3D Printed Building

Created as a showcase project, AMAZE-28, the single-room summer house, was successfully constructed within 28 days on the grounds of the Kerala State Nirmithi Kendra. The 3D-printed building at the Kerala State Nirmithi Kendra in Thiruvananthapuram. (Photo: Shekunj)  The inauguration of Kerala's inaugural 3D-printed structure, a 380-square-foot single-room summer house, is scheduled to take place on October 10 at the Kerala State Nirmithi Kendra (Kesnik) campus located in PTP Nagar, Thiruvananthapuram.  Conceived as a showcase initiative, the summer house named AMAZE-28 was successfully finished within a mere 28 days. This impressive project was executed by Tvasta, a construction technology startup based in Chennai, founded by alumni of IIT-Madras, who have entered into a memorandum of understanding (MoU) with Kesnik.  AMAZE-28 is perched upon a concrete foundation atop a gentle elevation within the Kesnik campus. Febi Varghese, the Director and Chief Executive Officer of...

How to Read Analog Input in Arduino from a Sensor

 This Article shows you how to read analog input from the physical world using a potentiometer. A potentiometer (also called pot for short) is a straightforward mechanical device whose shaft may be twisted to vary the resistance it offers. You may measure the amount of resistance a potentiometer produces as an analogue value by applying voltage to the potentiometer and into an analogue input on your board. In this post, you will establish serial communication between your Arduino and a computer running the Arduino Software (IDE) and then check the status of your potentiometer. 

Components Required

  1. Arduino Board
  2. Bread Board
  3. Jumper Wires
  4. Potentiometer - 10k Ohm
  5. Computer/Laptop with Arduino IDE

Circuit

The potentiometer's three wires must be connected to your board. The first connects to ground from one of the potentiometer's outer pins. The second connects to 5 volts from the potentiometer's other outside pin. The third connects the analogue pin A0 to the potentiometer's center pin. 

Circuit Diagram of Analog Signal Reading.

The amount of resistance on either side of the wiper, which is attached to the centre pin of the potentiometer, can be adjusted by rotating the potentiometer's shaft.The voltage at the centre pin is altered as a result. The voltage at the centre pin approaches 5 volts when the resistance between the centre and the side connected to 5 volts is close to zero (and the resistance on the other side is close to 10k ohm).  When the resistances are reversed, the centre pin's voltage approaches zero volts, or ground. This voltage serves as the analogue input that you are reading.  

Code

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin 0:
  int sensorValue = analogRead(A0);
  // print out the value you read:
  Serial.println(sensorValue);
  delay(1);        // delay in between reads for stability
}


Comments