Type Here to Get Search Results !

How to Add Additional Components In Circuit Designing of Arduino, In Fritzing Software

Back to the Fritzing tool, and we are keep updating that according to the step we are right now. just to remind you, that you can download this template from the chapter we are seeing right now from the "download/resources" section.. In this step we added two additional components, that the two potentiometers over here, looking on one potentiometer, you see that we have three  pins below. one side is connected to the ground, the other side is connected to 5v power, and the middle pin as input to the analog input pin in the Arduino, and the same goes to the other potentiometer, each potentiometer is just being used to do some other functionality. one is being used to control the brightness of the LED, and the other one is being used to control the speed of the LEDs when they are running in the animation wave. that's all :-) very simple step, just adding a two physical variable resistors  (potentiometers).





How To Read Analog Inputs In Arduino

Reading analog inputs will help us to better interact our arduino project with the external environment around us. As many sensors are providing analog output when measuring some property. Like distance, temperature, speed, light brightness and much more. In our case we are going to use the potentiometer we just saw as simple analog sensor to start learning how to read analog input. Ok, so for reading an analog input, assuming all hardware is already connected.

We should perform the following steps:

  1. Setup analog pin as input.
  2. Well this is not needed as the 6 analog pins are.
  3. Only used as input !!! So we don't need to that.
  4. Digital means something is either on or off.
  5. But analog means it can have a continuous range of values.
  6. The arduino has some built-in module called adc – analog to digital convertor.
  7. That convert the voltage seen on the pin to a number that we can be used in our program.
  8. This module will return a value between 0 and 1023, this is like 10 bits.
  9. So, 0v would read as 0 number and 5v would read as  the maximum:1023.
  10. So we will use the analogread function to read the analog sensor value in voltage.
  11. Translate that to digital value and store it in a integer variable to be used later in our code.
  12. The digital value range that we will get from an analog sensor should be tested before being used.
  13. The easy way to do that is by using the serial monitoring.
  14. Only than mapping the input value range to the needed output range.
  15. Now, let’s start to do it in step by step.

Watch this tutorial and practical demonstration of this article for better understanding.



Post a Comment

0 Comments