Analog Input Pins

June 2, 2017

Introduction

evive has 10 analog input pins behind Magic Lid. The Atmega controllers used for evive contain a total of 16 channel analog-to-digital (A/D) converters. Out of these, only 10 analog inputs are available to the user. The converter has 10-bit resolution, returning integers from 0 to 1023. While the main function of the analog pins for most Arduino users is to read analog sensors, the analog pins also have all the functionality of General Purpose Input/Output (GPIO) pins (the same as digital pins 0 – 13).evive Analog Pins

The analog pins can be used identically to the digital pins, using the aliases A0 (for analog input 0), A1, etc. For example, the code would look like this to set analog pin 0 to an output, and to set it HIGH.

Available  pins in evive:

  • 10 analog pins available for the user, A0 to A5 & A12 to A15
  • Two potentiometers: Potentiometer_1 (A9), Potentiometer_2 (A10)
  • VSS_Voltage_Sense (for sensing input voltage – A7)
  • VVR_Voltage_Sense (for sensing variable voltage output – A8)

How to use Analog Pin in Arduino IDE

To read analog input from an analog pin in Arduino IDE, you have to use analogRead(pin) function.

analogRead(pin) function reads the value from the specific analog pin. The output is an integer value between 0 and 1023 (Due to a 10 bit analog to digital converter), which is mapped between 0 and 5 volts input voltage. This yields a resolution between readings of 5 volts / 1024 units or, .0049 volts (4.9 mV) per unit.

It takes about 112 microseconds (0.000112 s) to read an analog input, so the maximum reading rate is about 9,000 times a second.

evive Notes Icon
Note: If the analog input pin is not connected to anything, the value returned by analogRead() will fluctuate based on a number of factors (e.g. the values of the other analog inputs, how close your hand is to the board, etc.).

Example

How to use Analog Pin in PictoBlox (Scratch)

To read analog input from an analog pin in Scratch, you have to use read analog pin () block, available in the evive extension

read analog pin

 

This block returns the value of analog pins available in evive. Analog reading is of 10-bit resolution, hence the range of value is 0 to 1023. This range is mapped to the voltage of the pin (normally 0 to 5V). If the value received is 512, the voltage value will be around 2.5V.

To know more visit the block documentation here.

Example

Displaying the analog value of potentiometer 1 in Stage Mode:

read analog pin example

Share this Documentation
Share on facebook
Facebook
Share on twitter
Twitter
Share on google
Google+
Share on pinterest
Pinterest
Share on reddit
Reddit
Share on print
Print
Related Tutorials & Projects

Interfacing Joystick module with evive

In this tutorial we will interface joystick module with evive and we will move rectangular box drawn on TFT display according to the movement on joystick module

How to interface Water Flow sensor with evive

In this tutorial, we will discuss how to interface water flow sensor with evive. How water flow rate, current water flowing and output water changes? The water flow rate in liters per hour, current water flowing and output water flowing data flowed since starting is displayed on the screen. All the answers are given in this tutorial.LET'S BEGIN...
read analog pin

read analog pin ()

The block returns the value of analog pins available in the connected hardware. Analog reading is of 10-bit resolution, hence the range of value is 0 to 1023. This range is mapped to the voltage of the pin (normally 0 to 5V). If the value received is 512, the voltage value will be around 2.5V.
All articles loaded
No more articles to load
Featured Projects
Space-Battle-Game on Scratch

Space Battle

This project will show you how to make a cool space battle game on your own in PictoBlox (Scratch-based programming) and play using your Smartphone!

All articles loaded
No more articles to load

Leave a Reply

Close Menu
×

Cart