Mostrando entradas con la etiqueta Atmel AVR. Mostrar todas las entradas
Mostrando entradas con la etiqueta Atmel AVR. Mostrar todas las entradas

jueves, 7 de febrero de 2013

Arduino by Davis: “Controlling Big, Mean, Devices"


Arduino by Davis: “Re: Controlling an animatronics bust” plus 19 more

Link to Arduino by Davis

  • Controlling Big, Mean, Devices


Controlling Big, Mean, Devices


Microcontrollers are a ton of fun. Once I got hooked, there was no
turning back. Initially playing with sensors and LCDs, I quickly discovered the limits to what a microcontroller could control. A microcontroller’s GPIO (general purpose input/output) pins cannot handle higher power requirements. An LED was easy enough, but large power items such as light bulbs, toaster ovens, and blenders required more sneaky circuitry. Something sneaky called a relay:
http://www.sparkfun.com/tutorial/Outlet/Outlet-1.jpg
In this tutorial we will discuss a small relay board to control the power to a normal AC outlet using 5VDC control.

All the usual warnings apply: Main voltage (120VAC or 220VAC) can kill you. This project, done incorrectly, could certainly burn down your house. Have your pet spayed or neutered. Shampoo is better. Do not work on or solder to any part of a project while it is plugged into the wall – just unplug it!

You can get the Eagle files for the control board here. The control board is composed of a relay along with a NPN transistor and LED.



What’s a relay?
I admit, I really just wanted to build my own Blender Defender (I don’t even have a cat!). However, building a 5V controllable outlet can be handy for many applications. For these power hogs, a relay is the perfect fit.

A relay is a large mechanical switch. That switch is toggled on or off by energizing a coil.

Image:Relay.jpg
From wikipedia

In this example we are going to talk about the simplest version of a relay. Inside the relay are two paddles made of metal. One paddle is made of a ferrous material like steel and is free to move. The other paddle is made of copper and stationary. When these paddles touch (the closed switch state), they are capable of allowing a large amount of power to flow – like 30A@120VAC (huge!).

The other half the relay is called the coil. This is basically a small electro-magnet. If you send current through the coil, a magnetic force is created, which pulls on the steel paddle causing it to move (flip) and touch the copper paddle – as if you flipped a light switch. The coil requires a small amount of power (5VDC @ 80mA). So you see, controlling the low-power coil allows us to actually control quite a lot of power!

It is important to note the coil is physically isolated from the paddles. If you have 120VAC running through the paddles, you don’t have to worry about that 120VAC sneaking back into and vaporizing your microcontroller (connected to the coil).

The paddles are capable of carrying very large currents. Both AC or DC – the paddles don’t care. A relay can be used to control a DC motor, or an AC lamp.

The relay that we will be working with, in this tutorial, is a beefcake in my opinion. It can handle a lot of power – 30A at 220VAC. What happens if you violate this limit? I have thankfully never been in that situation. I have heard reports that the relay will begin to heat up. When the voltage/current becomes large enough, there will be sparks inside the relay as you switch the paddles. If these sparks get large enough, you can actually spot weld the movable paddle to stationary paddle causing the relay to fail, potentially in the ‘on’ position. Obviously this would be very bad on many levels.

Like we do with capacitors, we under-rate the relay so that we mitigate the risk of relay failure. If you need 10A@120VAC, don’t use a relay rated for 10A@120VAC, instead use a bigger one (such as 30A@120VAC). Remember, power = current * voltage so a 30A@220V relay can handle up to a 6,000W device (two hair dryers).



The Outlet

http://www.sparkfun.com/tutorial/Outlet/Outlet-0.jpg

The goal is the get a GFCI outlet into some sort of a housing, with a power cord, the relay, and control circuitry.

Materials:
  • GFCI Outlet ($10)
  • Nail mount housing ($1)
  • Thick 3-wire type extension cord, 8 feet (2-wire cords will not work) ($7)
  • Relay ($4)
  • Control board and parts ($5)
Please notice that we are using a Ground Fault Circuit Interrupter (GFCI) Outlet and not a normal outlet. A normal outlet costs $0.59 – but I went for the $10 GFCI. Why? The GFCI may save your life. It’s the type of outlet you’ll find near anything that outputs water (kitchen sinks, batchroom tubs, etc). When the outlet detects an abnormal amount of current, it assumes that a large amount of potentially fatal current is flowing through your body, and therefore switches off – saving you and your project.

Truthfully, the GFCI may only shut off when there is a current leak across a connection to ground – and not an over-current condition. What this means is if your ‘project’ suddenly pulls 50A because the microwave turned on, the GFCI will not trip off. But it you accidentally touch the wrong exposed wire, the GFCI will trip because it will detect a fault to ground (saving your heart from cardiac arrest). We repeat – when working on any part of an AC project, unplug the thing from the wall.



The Inline Power Control Board
The first thing you need to do is build up the Power Control board.

http://www.sparkfun.com/tutorial/Outlet/Outlet-1.jpg

This board contains the relay, transistor, and activation LED. The board requires 5V and GND to operate. A control pin controls whether the relay is ‘closed’ (allows high power to flow) or ‘open’ (paddle’s default state of disconnected).


The control board is fairly straight forward. The coil within the relay requires up to 80mA. This is more than a GPIO pin can handle (20mA by default) so we use NPN transistor as a controllable connection to ground. The NPN transistor can handle up to a 200mA which is more than the coil (80mA) and the LED (20mA) combined.

When the ‘RELAY’ pin (aka CTRL) goes high, the NPN transistor connects to ground sending current through the coil (activating the relay) and through the LED (turning the activation LED on). R1 pulls the ‘RELAY’ pin to ground so if anything goes haywire the relay will remain in the safe, off position.

Note: The 1N4148 diode is connected in a odd fashion for a reason. This is placed between power and ground in a reverse fashion. When the coil of the relay is de-activated, it acts like an inductor, trying to suppress current change. This can cause some havoc on the 5V power rail. When this happens, the 1N4148 will forward bias causing the current stored in the coil to flow happily back to the 5V rail protecting the power supply and the near-by parts.



The Build

Take that beautiful extension cord and cut off the female connector about 6" from the female end.

http://www.sparkfun.com/tutorial/Outlet/Outlet-2.jpg
A male US power plug next to the cut off end of the extension cord

This should leave leave a few feet of extension cord between the part that plugs into the wall (male end) and the bare, exposed, recently cut-off end of the extension cord. Don’t plug it in!

Note: A two-wire extension cord will not work correctly. Notice we are using thick, three-wire circular extension cord. This extra wire is the ground return and allows the GFCI to operate correctly.

Using a meter set to continuity, check that the ground pin (the round one) is indeed connected to the green ground wire.  I’ve seen a few extension cords with non-standard colors.


http://www.sparkfun.com/tutorial/Outlet/Outlet-3.jpg

Use a wire stripper or an exacto-knife to remove about 6" of the sheath from the extension cord. You should find three wires - black, white and green.

http://www.sparkfun.com/tutorial/Outlet/Outlet-4.jpg

Use wire strippers to strip the three wires individually about 1". I twist the ends of the wires to combine the strands of the wires together in preparation for soldering.

http://www.sparkfun.com/tutorial/Outlet/Outlet-5.jpg

Sometimes the roll of solder can be used as a third hand.

http://www.sparkfun.com/tutorial/Outlet/Outlet-6.jpg

The goal here is to 'tin' the three wires. Adding solder to each of the stranded wires will hold all the wires together and allow for easier manipulation later.

http://www.sparkfun.com/tutorial/Outlet/Outlet-9.jpg

Be sure to thread the extension cord through the housing (shown above) before soldering to the control board. It's a huge pain to have to cut and remove the wires from the control board.
http://www.sparkfun.com/tutorial/Outlet/Outlet-8.jpg

Be sure the extension is threaded through the housing before you do this step.

With a good 6" of wire exposed, cut the black wire about 5" down from the end. The is where the relay will live.

http://www.sparkfun.com/tutorial/Outlet/Outlet-10.jpg
Notice the hooks on the three wires. I wrapped the tinned ends of wire around a small jewelers screw driver to create a half circle within the wire. This will aid connection to the screws on the GFCI.

Here we have the black wire cut and soldered to the control board. The relay is a NO (Normally Open) type relay. When power is off, there is no connection between the two thick black strands that you just cut and soldered. This is a safety feature - if all things go wrong and the power goes out of the coil, the relay will kick off and the outlet will shut down.

Conversely, when you send 5V to the coil, the paddle flips from the 'off' state to the 'on' state, connecting the two pieces of black wire (on the left side of the picture above), power is delivered to the outlet and your project is powered.

http://www.sparkfun.com/tutorial/Outlet/Outlet-11.jpg

Now we connect the wires from the extension cord to the outlet. The Black and white wires connect to the two side terminals of the GFCI - the green wire (ground) connects to the end of the outlet.

Advanced trick: Notice how the hooks of the tinned wires are arranged so that they are clock-wise. If you align the hooks of the wires under the screws correctly, as you tighten the screws, the hook of the wire will be 'sucked' into the tightening screw. This creates a very compact connection.

http://www.sparkfun.com/tutorial/Outlet/Outlet-7.jpg

Now lower the relay into the enclosure and feed the control wires (red, yellow, and black) out one corner of the housing. (You're right, the extension cord wires are not soldered to the relay board in this picture - please make believe). 

http://www.sparkfun.com/tutorial/Outlet/Outlet-12.jpg

You can double-stick tape the control board to the bottom of the housing or just let it float - the wires from the extension cord will tend to hold it in place. Once you have everything lowered into place, screw the outlet onto the enclosure, and the face plate onto the enclosure.

http://www.sparkfun.com/tutorial/Outlet/Outlet-13.jpg
Here we test the controllable outlet against the Boxing Timer

DO NOT plug the extension cord into the wall yet.

Now for the moment of truth. Attach the three control wires (5V, GND, and CTRL) to some sort of system. In the above picture, I have a fairly dirty breadboard. All that I am actually using on the bread board is 5V and GND - ignore all the other parts as they are not doing anything. I then manually toggled the control wire from GND (off) to 5V (on). You can do the same thing by plugging into the 5V and GND pins on an Arduino board.

Tying the CTRL line to 5V I heard a very friendly click as the relay kicked over. This indicated (along with the LED on the control board) that the relay was actuated to the 'on' position. Removing CTRL from the 5V rail (called floating because the CTRL line is neither connected to 5V or GND), the relay released. This is good! If CTRL is left floating or tied to ground, the outlet is turned off.

You can also use a meter in continuity mode to check that the relay is working properly before youconnect to 120VAC.  When the relay’s open, one of the fins of the plug and one of the rectangular holes of the outlet will not have continuity, and when it’s closed, they will.  The other fin and rectangular hole will always have continuity, as will the ground pin and the funny hole.  I always do this check before plugging into the 120VAC, because I am, you know, paranoid.

The next step is to plug the extension cord into the wall and test again. If anything goes wrong the GFCI should activate and cut off. Be sure to unplug the outlet anytime you are working on it. Please don’t get zapped!



You should now have an outlet that is fully controllable over 5V logic. When you plug a device into the outlet, it will by default be off. When you expose 5V to the CTRL line, the relay will activate turning on power to the device plugged into the outlet.

martes, 20 de noviembre de 2012

Arduino - Arduino Board ADK

Arduino ADK

Arduino ADK R3 FrontArduino ADK R3 Back
Arduino ADK FrontArduino ADK Back

Overview

The Arduino ADK is a microcontroller board based on the ATmega2560 (datasheet). It has a USB host interface to connect with Android based phones, based on the MAX3421e IC. It has 54 digital input/output pins (of which 14 can be used as PWM outputs), 16 analog inputs, 4 UARTs (hardware serial ports), a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset button.
The ADK is based on the Mega 2560.
Similar to the Mega 2560 and Uno, it features an ATmega8U2 programmed as a USB-to-serial converter.
Revision 2 of the MegaADK board has a resistor pulling the 8U2 HWB line to ground, making it easier to put into DFU mode.
Revision 3 of the board has the following new features:
  • 1.0 pinout: added SDA and SCL pins that are near to the AREF pin and two other new pins placed near to the RESET pin, the IOREF that allow the shields to adapt to the voltage provided from the board. In future, shields will be compatible both with the board that use the AVR, which operate with 5V and with the Arduino Due that operate with 3.3V. The second one is a not connected pin, that is reserved for future purposes.
  • Stronger RESET circuit.
For information on using the board with the Android OS, see Google's ADK documentation.

Schematic, Reference Design & Pin Mapping

Pin Mapping: PinMap2560 page

Summary

MicrocontrollerATmega2560
Operating Voltage5V
Input Voltage (recommended)7-12V
Input Voltage (limits)6-20V
Digital I/O Pins54 (of which 15 provide PWM output)
Analog Input Pins16
DC Current per I/O Pin40 mA
DC Current for 3.3V Pin50 mA
Flash Memory256 KB of which 8 KB used by bootloader
SRAM8 KB
EEPROM4 KB
Clock Speed16 MHz

Power

The Arduino ADK can be powered via the USB connection or with an external power supply. The power source is selected automatically.
External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or battery. The adapter can be connected by plugging a 2.1mm center-positive plug into the board's power jack. Leads from a battery can be inserted in the Gnd and Vin pin headers of the POWER connector.
NB: Because the ADK is a USB Host, the phone will attempt to draw power from it when it needs to charge. When the ADK is powered over USB, 500mA total is available for the phone and board.The external power regulator can supply up to 1500mA. 750mA is available for the phone and ADK board. An additional 750mA is allocated for any actuators and sensors attached to the board. A power supply must be capable of providing 1.5A to use this much current.
The board can operate on an external supply of 5.5 to 16 volts. If supplied with less than 7V, however, the 5V pin may supply less than five volts and the board may be unstable. If using more than 12V, the voltage regulator may overheat and damage the board. The recommended range is 7 to 12 volts.
The power pins are as follows:
  • VIN. The input voltage to the Arduino board when it's using an external power source (as opposed to 5 volts from the USB connection or other regulated power source). You can supply voltage through this pin, or, if supplying voltage via the power jack, access it through this pin.
  • 5V. This pin outputs a regulated 5V from the regulator on the board. The board can be supplied with power either from the DC power jack (7 - 12V), the USB connector (5V), or the VIN pin of the board (7-12V). Supplying voltage via the 5V or 3.3V pins bypasses the regulator, and can damage your board. We don't advise it.
  • 3V3. A 3.3 volt supply generated by the on-board regulator. Maximum current draw is 50 mA.
  • GND. Ground pins.

Memory

The ADK has 256 KB of flash memory for storing code (of which 8 KB is used for the bootloader), 8 KB of SRAM and 4 KB of EEPROM (which can be read and written with the EEPROM library).

Input and Output

Each of the 50 digital pins on the ADK can be used as an input or output, using pinMode(), digitalWrite(), and digitalRead()functions. They operate at 5 volts. Each pin can provide or receive a maximum of 40 mA and has an internal pull-up resistor (disconnected by default) of 20-50 kOhms. In addition, some pins have specialized functions:
  • Serial: 0 (RX) and 1 (TX); Serial 1: 19 (RX) and 18 (TX); Serial 2: 17 (RX) and 16 (TX); Serial 3: 15 (RX) and 14 (TX). Used to receive (RX) and transmit (TX) TTL serial data. Pins 0 and 1 are also connected to the corresponding pins of the ATmega8U2 USB-to-TTL Serial chip.
  • External Interrupts: 2 (interrupt 0), 3 (interrupt 1), 18 (interrupt 5), 19 (interrupt 4), 20 (interrupt 3), and 21 (interrupt 2). These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value. See the attachInterrupt() function for details.
  • PWM: 2 to 13 and 44 to 46. Provide 8-bit PWM output with the analogWrite() function.
  • SPI: 50 (MISO), 51 (MOSI), 52 (SCK), 53 (SS). These pins support SPI communication using the SPI library. The SPI pins are also broken out on the ICSP header, which is physically compatible with the Uno, Duemilanove and Diecimila.
  • USB Host: MAX3421E. The MAX3421E comunicate with Arduino with the SPI bus. So it uses the following pins:
    • Digital: 7 (RST), 50 (MISO), 51 (MOSI), 52 (SCK).
      NB:Please do not use Digital pin 7 as input or output because is used in the comunication with MAX3421E
    • Non broken out on headers: PJ3 (GP_MAX), PJ6 (INT_MAX), PH7 (SS).
  • LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH value, the LED is on, when the pin is LOW, it's off.
  • TWI: 20 (SDA) and 21 (SCL). Support TWI communication using the Wire library. Note that these pins are not in the same location as the TWI pins on the Duemilanove or Diecimila.
The ADK has 16 analog inputs, each of which provide 10 bits of resolution (i.e. 1024 different values). By default they measure from ground to 5 volts, though is it possible to change the upper end of their range using the AREF pin and analogReference() function.
There are a couple of other pins on the board:
  • AREF. Reference voltage for the analog inputs. Used with analogReference().
  • Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset button to shields which block the one on the board.

Communication

The Arduino ADK has a number of facilities for communicating with a computer, another Arduino, or other microcontrollers. The ATmega2560 provides four hardware UARTs for TTL (5V) serial communication. An ATmega8U2on the board channels one of these over USB and provides a virtual com port to software on the computer (Windows machines will need a .inf file, but OSX and Linux machines will recognize the board as a COM port automatically. The Arduino software includes a serial monitor which allows simple textual data to be sent to and from the board. The RX and TX LEDs on the board will flash when data is being transmitted via the ATmega8U2/16U2 chip and USB connection to the computer (but not for serial communication on pins 0 and 1).
A SoftwareSerial library allows for serial communication on any of the ADK's digital pins.
The ATmega2560 also supports TWI and SPI communication. The Arduino software includes a Wire library to simplify use of the TWI bus; see the Wire library for details. For SPI communication, use the SPI library.
The USB host interface given by MAX3421E IC allows the ADK Arduino to connect and interact to any type of device that have a USB port. For example, allows you to interact with many types of phones, controlling Canon cameras, interfacing with keyboard, mouse and games controllers as Wiimote and PS3.

Programming

The Arduino ADK can be programmed with the Arduino software (download). For details, see the reference and tutorials.
The ATmega2560 on the Arduino ADK comes preburned with a bootloader (the same on Mega 2560) that allows you to upload new code to it without the use of an external hardware programmer. It communicates using the original STK500v2protocol (reference, C header files).
You can also bypass the bootloader and program the microcontroller through the ICSP (In-Circuit Serial Programming) header; see these instructions for details.
The ATmega8U2 firmware source code is available in the Arduino repository. The ATmega8U2 is loaded with a DFU bootloader, which can be activated by:
  • On Rev1 boards: connecting the solder jumper on the back of the board (near the map of Italy) and then resetting the 8U2.
  • On Rev2 or later boards: there is a resistor that pulling the 8U2/16U2 HWB line to ground, making it easier to put into DFU mode. You can then use Atmel's FLIP software (Windows) or the DFU programmer (Mac OS X and Linux) to load a new firmware. Or you can use the ISP header with an external programmer (overwriting the DFU bootloader). See this user-contributed tutorial for more information.

Automatic (Software) Reset

Rather then requiring a physical press of the reset button before an upload, the Arduino ADK is designed in a way that allows it to be reset by software running on a connected computer. One of the hardware flow control lines (DTR) of theATmega8U2 is connected to the reset line of the ATmega2560 via a 100 nanofarad capacitor. When this line is asserted (taken low), the reset line drops long enough to reset the chip. The Arduino software uses this capability to allow you to upload code by simply pressing the upload button in the Arduino environment. This means that the bootloader can have a shorter timeout, as the lowering of DTR can be well-coordinated with the start of the upload.
This setup has other implications. When the ADK is connected to either a computer running Mac OS X or Linux, it resets each time a connection is made to it from software (via USB). For the following half-second or so, the bootloader is running on the ADK. While it is programmed to ignore malformed data (i.e. anything besides an upload of new code), it will intercept the first few bytes of data sent to the board after a connection is opened. If a sketch running on the board receives one-time configuration or other data when it first starts, make sure that the software with which it communicates waits a second after opening the connection and before sending this data.
The ADK contains a trace that can be cut to disable the auto-reset. The pads on either side of the trace can be soldered together to re-enable it. It's labeled "RESET-EN". You may also be able to disable the auto-reset by connecting a 110 ohm resistor from 5V to the reset line; see this forum thread for details.

USB Overcurrent Protection

The Arduino ADK has a resettable polyfuse that protects your computer's USB ports from shorts and overcurrent. Although most computers provide their own internal protection, the fuse provides an extra layer of protection. If more than 500 mA is applied to the USB port, the fuse will automatically break the connection until the short or overload is removed.

Physical Characteristics and Shield Compatibility

The maximum length and width of the ADK PCB are 4 and 2.1 inches respectively, with the USB connector and power jack extending beyond the former dimension. Three screw holes allow the board to be attached to a surface or case. Note that the distance between digital pins 7 and 8 is 160 mil (0.16"), not an even multiple of the 100 mil spacing of the other pins.
The ADK is designed to be compatible with most shields designed for the Uno, Diecimila or Duemilanove. Digital pins 0 to 13 (and the adjacent AREF and GND pins), analog inputs 0 to 5, the power header, and ICSP header are all in equivalent locations. Further the main UART (serial port) is located on the same pins (0 and 1), as are external interrupts 0 and 1 (pins 2 and 3 respectively). SPI is available through the ICSP header on both the ADK and Duemilanove / Diecimila.Please note that I2C is not located on the same pins on the ADK (20 and 21) as the Duemilanove / Diecimila (analog inputs 4 and 5).

Drivers & Setup

With this board you need to change the boards.txt file in your Arduino directory (find it in: "Arduino-00xx > hardware > arduino"):
Arduino 0022 or olderboards.txt
Arduino 1.0 Betaboards1.0.txt
[To be downladed, this files are compressed into a zip archive, so you need to unzip them into the directory described above.]
Windows users in order to get working the board need a .inf file for this specific product: Arduino_ADK.zip
For installation follow the same procedure on how install an UNO board on your computer.

Arduino - Arduino Board Diecimila


Arduino Diecimila

Información general.

La Arduino Diecimila es una placa microcontroladora basada en el chip ATmega168 (datasheet). Tiene 14 E/S digitales (6 de las cuales se puedes utilizar como salidas PWM), 6 entradas analógicas, un cristal de 16MHz, conexión USB y botón de reseteo. Contiene todo lo necesario para el soporte del microcontrolador; simplemente conectala a un ordenador con un cable USB o alimentala con un adaptador AC/DC o una batería y comenzará a funcionar.
"Diecimila" significa "diez mil" en italiano y fue un nombrada de este modo para celebrar el hecho de que mas de 10.000 placas Arduino han sido ya fabricadas. La Diecimila es la última de la serie de placas USB; para compararla con versiones anteriores puedes consultar el índice de placas Arduino.

Características.

MicrocontroladorATmega168
Voltaje de funcionamiento5V
Voltaje de entrada (recomendado)7-12 V
Voltaje de entrada (limites)6-20 V
Pines E/S Digitales14 (de ellos 6 son salidas PWM)
Pines de entrada Analógica6
Intensidad por pin de E/S40 mA
Intensidad por pin de 3.3V50 mA
Memoria Flash16 KB (2 KB reservados para el gestor de arranque)
SRAM1 KB
EEPROM512 bytes
Velocidad del reloj16 MHz

Componentes.

Esquemas y referencias de diseño.

Nótese que R2 no se monta y que R3 a sido reemplazada por un condensador de 100 nano-faradios.

Alimentación.

La Arduino Diecimila puede ser alimentada directamente por el cable USB de conexión o por una fuente de alimentación externa. El cambio entre una u otra forma se hace por medio de un jumper: para alimentar la placa desde el cable USB se situa el jumper entre los dos pines mas próximos a dicho conector, para seleccionar al fuente de alimentación externa situar el jumper entre los dos pines mas cercanos al conector de alimentación externa.
La alimentación externa puede proceder indistintamente de un cargador de pared o de una batería. La alimentación también puede ser introducida directamente a los pines GND y Vin en el conector de alimentación. Un regulador de voltaje se encarga de que la placa sea alimentada de forma eficiente.
La placa puede funcionar con una fuente de alimentación externa que le proporcione un voltaje de entre 6v y 20v. Si el voltaje cae por debajo de 7v, el pin de 5v puede dar un voltaje inferior a 5v, por lo que la placa se vuelve inestable. Si usas más de 12v el regulador de voltaje puede sufrir de calentamiento y producir daños en la placa. El rango de voltaje de entrada recomendado es de 7v a 12v.
Los pines de alimentación son los siguientes:
  • VIN. La entrada de voltaje de la placa Arduino cuando se utiliza una fuente de alimentación exterior (en lugar de los 5v del cable USB u otra fuente de alimentación regulada). Puedes suministrar voltaje a través de este pin o, si el suministro de corriente se hace a través del conector de alimentación, sacarlo de él.
  • 5v. La alimentación regulada que se utiliza para alimentar el microcontrolador y los demás componentes de la placa. Esta puede llegar de la entrada Vin, a través del regulador de voltaje integrado, o ser suministrado por un cable USB o cualquier otra fuente de alimentación regulada.
  • 3V3. Un suministro de 3.3v generados por el chip FTDI integrado en la placa. La máxima corriente que soporta es de 50mA.
  • GND. Masa, tierra o negativo.

Memoria.

El ATmega168 tiene 16KB de memoria para el almacenamiento de sketches (de los cuales 2KB están reservados para el gestor de arranque). También tiene 1KB de SRAM y 512 bytes de EEPROM en los cuales se puede leer y escribir mediante la librería EEPROM).

Entradas y Salidas.

Cada uno de los 14 pines de digitales de la Diecimila puede ser configurado tanto como entrada o como salida usando las funciones pinMode(), digitalWrite() y digitalRead(). Estos pines operan a 5v. Cada pin puede suministrar o recibir una corriente máxima de 40mA y tienen resistencias pull-up internas (desconectadas por defecto) de 20 a 50 KOhms. Además algunos de los pines tienen funciones especiales:
  • Serie: 0 (RX) y 1 (TX). Usados para recibir (RX) y transmitir (TX) datos serie TTL. Estos pines están conectados con correspondientes pines del chip FTDI de conversión USB a Serie-TTL.
  • Interrupciones Externas: 2 y 3. Estos pines pueden ser configurados para actuar como disparadores de interrupciones en caso de que cambien a estado bajo, un pico de subida o bajada o simplemente en un cambio de estado. Ver la función attachInterrupt() para más detalles.
  • PWM: 3, 5, 6, 9, 10 y 11. Generan una señal PWM de salida de 8 bits con la función analogWrite().
  • SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). Estos pines soportan comunicación SPI, la cual no está, de momento, incluida en el lenguaje de programación de Arduino.
  • LED: 13. Hay un LED integrado en la placa conectado al pin 13. Cuando este pin se pone en estado HIGH el LED se enciende, cuando el pin cambia a estado LOW el LED se apaga.
La Diecimila tiene 6 entradas analógicas, cada una tiene una resolución de 10 bits (esto son 1024 valores). La medida de los valores analógicos se hace entre VCC y GND, aunque es posible cambiar el límite superior del rango de medición utilizando el pin AREF y algo de código de bajo nivel. Adicionalmente algunos de los pines de entrada analógicos tienen una función especializada:
  • I2C: 4 (SDA) y 5 (SCL). Forman un bus I2C (TWI) para comunicación con otros dispositivos utilizando la libreríaWire (más ducumentación en la página web de Wiring).
Hay unos cuantos pines más en la placa:
  • AREF. Voltaje de referencia para las entrada analógicas. Se utiliza con analogReference().
  • Reset. Cuando este pin se pone en estado LOW resetea el microcontrolador. Normalmente se utiliza cuando el botón de reseteo se hace inaccesible por que el uso de un shield lo oculta.

Comunicación.

La Arduino Diecimila puede comunicarse con tu ordenador, con otra Arduino o con otros microcontroladores. ElATmega168 tiene implementada comunicación serie UART TTL en sus pines 0 (RX) y 1 (TX). Un chip FTDI FT232RLintegrado en la placa convierte esta comunicación Serie en USB mediante los drivers FTDI (incluidos en el software de Arduino) para proporcionarnos un puerto COM virtual para comunicarnos con el ordenador. El shoftware de Arduino incluye un monitor serie que permite que datos sencillos puedan ser enviados y recibidos desde la placa por medio de la conexión USB. Los LEDs TX y RX de la placa parpaderán mientras los datos están siendo transmitidos a por el chip FTDI y la conexión USB al ordenador (pero no por los pines de comunicación Serie 0 y 1).
La librería SoftwareSerial permite la comunicación Serie en cualquiera de los pines digitales de la Diecimila.
El ATmega168 también soporta comunicación I2C (TWI) y SPI. El programa Arduino incluye la librería Wire para simplificar el uso del bus I2C, vea la referencia para más detalles. Si se desea utilizar la comunicación SPI hay que echar un vistazo a la hoja de características (datasheet) del ATmega168.

Cargando sketches.

La Arduino Diecimila puede ser programada con el software Arduino (descarga). Para más detalles ver la página dereferencia y los tutoriales.
El ATmega168 en la Arduino Diecimila viene precargado con un gestor de arranque que nos permite la carga de nuevo código sin el uso de un programador externo. Este se comunica usando el protocolo STK500 original (referencia, archivos de cabecera en C).
También se puede prescindir del gestor de arranque y cargar los sketches en el ATmega168 con un ICSP (programador externo), para ello ver estas instrucciones más detalladas.

Reseteo automático por Software.

En lugar de utilizar el pulsador de reseteo antes de cargar un nuevo sketch la Arduino Diecimila ha sido diseñada de modo que permite el reseteo automático por el software instalado en nuestro ordenador. Una de las lineas de control (DTR) delFT232RL está conectado con la linea de reseteo del ATmega168 mediante un condensador de 100 nanofaradios. Cuando esta línea se pone en estado LOW el chip se reinicia. El software de Arduino (a partir de la versión 0009) tiene la capacidad de cargar código en la placa simplemente presionando el botón de "upload" en el Arduino IDE. Esto significa que el gestor de arranque tarda menos tiempo en ejecutarse, pues la linea de reseteo está perfectamente coordinada con el inicio de la descarga.
Esta configuración tiene otras implicaciones. Cuando una Diecimila se conecta a un ordenador por el que corre un MAC OS X o un Linux, esta se resetea cada vez que se establece la conexión por USB. Durante el siguiente medio segundo el gestor de arranque se ejecuta en la Diecimila, mientras que ha sido programado para ignorar datos nulos (por ejemplo cualquier cosa durante la carga de un nuevo sketch). Este interceptará los primeros bytes de datos enviados a la placa después de que la conexión sea establecida. Si un sketch que se está ejecutando en la placa recibe una configuración de arranque u otros datos cuando se ejecuta por primera vez, asegúrate de que el software con el que se comunica espera un segundo después de abrir la conexión y antes de enviar estos datos.

Protección del USB en caso de sobrecarga.

La Arduino Diecimila tiene un fusible reseteable que protege el puerto USB de tu ordenador en caso de sobre-tensiones y cortocircuitos. Aunque la mayoría de los ordenadores tienen su propia protección interna este fusible nos da una protección extra. Si mas de 500mA llegan al puerto USB dicho fusible, automáticamente, corta la conexión hasta que el cortocircuito o la sobre-tensión terminen.

Características físicas.

La longitud y anchura máxima del PCB de la Diecimila son 6.8cm y 5.3cm respectivamente, con el conector USB y el conector de alimentación sobresaliendo ligeramente de los bordes. 3 perforaciones para tornillos permiten la fijación de la placa sobre una superficie o una caja. La distancia entre los pines 7 y 8 es de 4mm, no como los demás pines, que están separados por 2.5mm (separación normalizada entre pines).