About the Arduino

 


I will go through the entire board and walk through all of the features of the board. The brains of the board is a large chip on the lower right side of the board. A microcontroller has lots of digital input/output pins and does not run an operating system like your computer does. These are way simpler in comparison to microprocessors. The microcontroller interacts through the GPIO protocols.

Sketches are run directly run by the microcontroller, not by the operating system, and that is teh Atmega328P. 


Occasionally,  we might need to replace things with a new chip. 

There is also an ATmega16U2 version of the microcontroller, and it is an SMD surface mounter version and it controls the USB communications between the Atmeta and the computer. Typically you would not be interacting with this part of the board at all. 


The lines of the peripherals are called the headers labelled 0, 1, 2, gnd, etc. and this is how to connect the peripherals/devices to the Arduino Uno. You can use Jumper wires and plug them into the microcontroller. You can also use a shield, which has Uno compatible headers with the same pins.


Sometimes we can have ethernet connectivity to connect to ethernet network among others, and see if we can find different sets of headers. We can have a shield with LCD screens, so we can stack boards on top of each other to create more functionality for the Arduino boards. Use the fingers to push one against the other by pushing against the fingers horizontally.

We need to be aware each one of the pins does something different on a board, for example providing power, analog input that allows us to have analog signals, then digital pins that understand values of high or low in an external signal, or generate such a signal and send them to other devices. 0 is RX and 1 is TX and SDA and SCL are communication pins, allowing this microcontroller to communicate with sensors or even other Arduinos. TX and RX are used for a classic serial communications protocol. The USB socket is connected to the 16U2 microcontroller. This provides power to the board and connectivity as well. 

You can also power the arduino through a connector, using a 5.5 connector mm to provide power to the connector, the cylinder external power supply. You can also use a battery connector. This is a good easy way to gain independence of gadgets through power sources. A voltage regular makes it plausible to connect power sources between certain voltages. 

Try to use an external power brick of about 9V, no more than 12V, the more batteries you put in the more waste you will have at the voltage regulator.

What are the 2 ICSP headers? You can use a hardware program that can use you to directly program a microcontroller.



There is a bright red reset button, and start executing the program that is in the microcontroller in the beginning. 

The shiny button is a crystal clock, calibrated to tick around 16 million times a second. The 2 buttons are capacitors, they are used to clean up the voltage coming through the bottled connector through an external source. The microcontroller wants its voltage to stay at around 5 volts.

The capacitors clean the voltages before they are delivered to the apt mega. Now we want to discuss digital inputs, digital outputs, analog inputs, and analog outputs. On one side of the header, we got digital pins and on the other side we got analog pins. Some pins have line l1~ and 10~ which will be demonstrated later in this lecture. 

A computer is a digital device, with 2 words 1 and 0. The real world is an analog place, but everything can be represented using binary. A "1" has a microcontroller getting a voltage of 5 Volts, and a "0" is represented by a low voltage of 0 volts. However, nothing is black and white, and when the microcontroller recieves a "1" we get somewhere between 3.3V and 5V and 0V has a range of values from 0V to 3.0V.  For "1" we use the keyword HIGH, and for "0" we use the keyword LOW. 

How can the information be used to understand the functionality of the Arduino Uno's digital input and output pins? We got 0-13 or 14 digital input and output pins. The LED pin is an output.   One of the LED pins goes to output and the other one goes to ground. 


We use digital pin 7 to turn the LED on an off, and I need to get the pin to convey current. This makes a circuit with a voltage differential of 5 volts and as a result turns the LED on. Any one of these pins can turn an LED on or off but allowing us to put these into certain states. Analog pins also have additional functionality.

Now, we can look at digital pins as inputs. The simplest component that has a digital value is a button. The button's state is changed by the user pressing it as an input. Pressing a button connects two terminals inside a button in order to convey a particular state. 


Pressing the button helps to connect everything in a single circuit. If we want a number 5 to detect a high, you can connect the other terminal of the button to 5V in order to detect a high instead of a low. Otherwise, you can detect a ground terminal or 0 voltages. 

The number 5 input pin cannot really detect a defined value, so we call this pin a "hanging" value or a floating value, when the state of a digital input is indeterminable. This is not a good thing when we have a button. In order to have a button, we ground a button, or pull it up into a determinable value. A pull-up resistor is a large value, and when the button is not pressed, the dot flows through the resistor conveys a clear 5 volt level that the input can read clearly that does not have a floating solution. 

The button controls digital pin 5. If the button is not pressed, we can denote this by the state UP. The digital pin 5 is reading a HIGH or 5 Volts. Now imagine that the button is pressed, then the button is down, which means that pin 5 will read a LOW, because, because current will move towards the path of the least resistance, so it will go towards the ground as a result. We can use digital input to read a state, or alter a state of an LED. Instead of an LED, we can have a motor, or a solenoid along many options. Having pins as digital inputs helps to read the state of a switch. The next thing we do is to have a look of the Analog Input pins and what is an analog output.

The analog output is not really analog, since the analog signal can take any value between 2 extremes. The analog output is an approximation of the effect an analog signal has on an external device such as an LED. We are trying to enable an LED to light up at half intensity, or to have a motor that spins at half its maximum speed. We are not really trying to create a true analog output with lots of values, but we want to create an effect of getting things "in between". We do this through PWM (pulse-width modulation). 


Let's say we have an LED and we want to make it shining and connected to a voltage source. If the LED is constantly drawing 5V for that specific amount. What if instead of drawing 5V we make it half? Half the period we make it 5 volts, and the other we make it zero volts, and this would half the brightness of the LED. Using half or PWM is having the same effect as having a true analog output. 



Every pin with the tilde(~) sign next to them have the ability for pulse width modulation. The LED will be turned off if 10 is off. If pin number 10 is 255 then it is brightest. If there is a 50 to number 10, the LED will be faint and almost off. If I write 200, then the LED will be very bright, but not the brightest. 

Now the next step is to use Analog Input Pins. The Arduino Uno has analog input pins on the left hand corner, or are pins that sample the vortex. The potentiometer has a resistor inside or knob, and the pin conveys voltages depending on the position of the knob. By reading the voltage, you can actually determine what the position of the knob is. A potentiometer has 3 pins, and connect the pin in the middle to the analog input pins, whereas the other 2 go to power and ground. 


Then we can read onto a voltage and convert it to a number. The number ranges from 0 to 1023 which the analog pins can have. The voltage has to be compatible with what the Arduino can handle. Can only be between 0 and 5 volts, any greater and you can damage the Arduino. The position 0 will read a 0 volt value and read a 0 analog input value. If we turn the knob all the way clockwise to position #10, then the reading will be now 5 volt value to analog pin 0, which translates to the other extreme of the arithmetic values for the analog inputs, and this is 1,023. If we read these values inside the program, I can derive to the fact that the potentiometer is turned to position number 10, which generates a one-to-one correspondence. If the potentiometer is position number 5 is around 511 volts, and we can continue this way, through an analog input pin, which makes the Arduino able to read the voltage and give us a number. We can then use this number to do something useful, using the potentiometer to control light intensities of LEDs. The brightness of and LED can change as you change the values of the potentiometer. 


Comments

Popular Posts