Arduino Electronics 101
Arduino Electronics 101
Living
Outside
Play
Technology
Workshop
http://www.instructables.com/id/Arduino-Electronics-101/
Author:msuzuki777
Lazy Old Geek
What does this mean? The K stands for kilo, a multiplier which in this case, means multiply the number by 1024. Bytes are just a place to store information (data). This is basically the only difference between the two microcontrollers. Flash: is a type of memory that holds program information, even after the Arduino is disconnected from power. The same program will run anytime power is reapplied to the Arduino. This is the same way USB flash drives and digital camera cards retain their information. EEPROM: is memory that also retains information after power is shutoff. It is different from Flash as it can be written by the program instead of the program itself. The Arduino instructions to use EEPROM memory are EEPROM.read() and EEPROM.write().
Tip: Be sure to have:
#include
//in your
sketch(program).
The limitation is, even in the ATmega328, there is only 1024 bytes so only so much data can be stored. Tip: By the way, I never got this to work. RAM: is also memory but it is volatile meaning it will go away float Vt=(float) sensorValue3Avg*5.0/1023.0;
when you turn off power. Sketches use it to store temporary information such as variables. Wh
float R=(5.0-Vt)*10.0/Vt; float TinC=281.583*pow(1.0230,(1.0/R))*pow(R,-0.1227)-150.6614; float TinF=TinC*(9.0/5.0)+32; All of these float variables are stored in RAM and will be overwritten the next time a measurement is taken and are lost when power is turned off. Basically, variables are just labels for locations in RAM. Float variables are a specific type of variable. With this label, the sketch knows where to go to store the value it wants or retrieve the value stored at that location. The specific type determines how much room is needed and how to interpret the information. Besides the CPU, flash and RAM, the ATmegas have interface circuitry built in: Serial interface: this allows the CPU to talk to the PC through a serial port or through USB and I believe its used to communicate over I2C. This is also how it talks to serial LCDs. Analog to digital converter (ADC): This allows the ATmega to convert analog voltages to digital data (will be discussed in another Instructable). PWM (pulse width modulation): circuitry to output analog voltages
http://www.instructables.com/id/Arduino-Electronics-101/
Timers: for timing events, most often used to set delays between program steps, e.g., blinking LEDs. If you have ever looked at the datasheets on these ATmegas and understand them, then maybe you should be writing this instead of me. Prefixes: There are a lot of letters attached to electronic terminology that may be confusing. E.g. 16mV, 10Kohms, 20uF. These letters are called prefixes (and suffixes) that are just multipliers to the value. E.g., 10Kohms is (10 times 1,000) ohms or 10,000 ohms. See the table below. Non-essential Info: Unfortunately, if youre talking computer memory 1Kbyte is 1024 bytes. This is because computer people like to make everything complicated. So to them K is 210. Megabyte can mean 1,000,000, 1,048,576 or 1,024,000. Dont ask, check it out on Wikipedia.
http://www.instructables.com/id/Arduino-Electronics-101/
Others will ask: how can you power an Atmega chip with 6V. Technically, this Atmega can be powered from 1.8Vdc to 6Vdc so this would work. Others may ask: how can this be a complete circuit? It doesnt do anything. It is true it doesnt do anything but it is also a complete circuit. Who cares you may ask. The answer is without this complete circuit, the Arduino will not work. Schematic: A schematic is a pictorial representation of an electronic circuit. Remember that Atmega328 microcontroller, I showed you in the last step? Will I put the picture in this step also. See the little metal legs sticking out? Well, there are 14 of these pins on this side and 14 on the other. The pins are numbered from 1 to 28. On the left side of the chip, you can see a little half moon cutout. That means the pins under the white dot is 1 and they continue in sequence in a counter clockwise direction. The next picture shows a pictorial of the pins. Back to the schematic. On the right side, you will see a rectangle with a lot of lines sticking out. This symbolizes the AtMega328. There are 28 lines and they are labeled 1 through 28. So you may ask: why arent they labeled 1 thru 14 on the left and 28 thru 15 on the right, like in the pinout drawing? Well, some schematic symbols will do that. This one is setup more for functionality. The critical thing is what is connected to what pin number. Technobabble: So what is that little circle on pin 1? Well, that means negative logic. Negative logic means that it happens when the signal is zero volts. Inside the box, it says /RESET. That means that the Atmega goes into reset when pin 1 is low (0V). The little slash (/) before the RESET means the same thing. You may also see a RESET with a line over the top of it. That means the same thing. So whenever pin 1 is low, the AtMega is in RESET and cannot do anything. So the little green lines on this schematic represent wires like the white and black wires of the battery-lamp complete circuit. The symbol on the left is a battery cell. The side with the shorter line is negative and the longer is positive. In summary: the complete circuit is the positive side of the battery connected to the VCC pin of the AtMega. The ground pin of the AtMega connected to the negative side of the battery. .
http://www.instructables.com/id/Arduino-Electronics-101/
http://www.instructables.com/id/Arduino-Electronics-101/
http://www.instructables.com/id/Arduino-Electronics-101/
Image Notes 1. Resonator, the center pin is ground, the other two are interchangeable
http://www.instructables.com/id/Arduino-Electronics-101/
http://www.instructables.com/id/Arduino-Electronics-101/
The next device, the rectangle is a 5Vdc voltage regulator. A common one is a 7805. What this does is drops the 9Vdc input on the input side to 5Vdc on the output. The difference is actually lost as heat. C7 is a filter capacitor for the 5Vdc. In this schematic, instead of using VCC, it uses +5V. The next two components, R2 and LED1 are actually a separate complete circuit. The complete circuit is +5V to the resistor to the diode to GND and thru the power supply back to +5V. Note: The resistor symbol is the European version. The LED looks like a diode and acts like one. The difference is the little arrows which means that it will light up when current flows in the right direction. The next picture is an electrolytic capacitor. They can be installed backwards, bluish bad with the signs is the negative, the opposite of the + in the schematic. The next picture is a 7805 voltage regulator. The pins are not labeled and you often research the internet to get the correct pinouts. The next picture is a typical diode. These can also be installed backwards, the black band is the line side as opposed to the triangle side. The next picture is a typical LED. The flat side of the round plastic is the cathode side, the line as opposed to the triangle. Technobabble: So, the ideal digital circuit transitions from 5Vdc to 0Vdc, instantly. In the real world, this is impossible but the closer you can get the better. Now this ideal circuit is basically a square wave. From a physics point of view, a square wave is made up of all frequencies. In the physical real world, that is impossible, thus so is the instant transition. Electrolytic capacitors are typically in the uF, microFarad range, say 1 to 1000uF. These are better for filtering low frequencies, say 50-1000Hz. The ceramic capacitors, like C5 are in the pF (picoFarad) or nF (nanoFarad) range are better at filtering higher frequencies, maybe 10,000Hz +.
http://www.instructables.com/id/Arduino-Electronics-101/
http://www.instructables.com/id/Arduino-Electronics-101/
http://www.instructables.com/id/Arduino-Electronics-101/
Related Instructables
http://www.instructables.com/id/Arduino-Electronics-101/