Articles From John Nussey
Filter Results
Article / Updated 08-16-2022
Once you have the basics, you can now complete your first sketch. In front of you now should be an Arduino Uno R3, a USB cable, and a computer running your choice of operating system (Windows, Mac OS, or Linux). Find the Blink Sketch To make sure that the Arduino software is talking to the hardware, you upload a sketch. What is a sketch, you ask? Arduino was created as a device that allows people to quickly prototype and test ideas using little bits of code that demonstrate the idea — kind of like how you might sketch out an idea on paper. For this reason, programs written for Arduino are referred to as sketches. Although a device for quick prototyping was its starting point, Arduino devices are being used for increasingly complex operations. So don't infer from the name sketch that an Arduino program is trivial in any way. The specific sketch you want to use here is called Blink. It's about the most basic sketch you can write, a sort of “Hello, world!” for Arduino. Click in the Arduino window. From the menu bar, choose File→Examples→01.Basics→Blink. A new window opens in front of your blank sketch. Identify your board Before you can upload the sketch, you need to check a few things. First you should confirm which board you have. You can choose from a variety of Arduino devices and several variations on the USB board. The latest generation of USB boards is the Uno R3. If you bought your device new, you can be fairly certain that this is the type of board you have. To make doubly sure, check the back of the board. You should see details about the board's model. Also worth checking is the ATMEL chip on the Arduino. The ATMEL chip is the brains of the Arduino and is similar to the processor in your computer. Because the Uno and earlier boards allow you to replace the chip, there is always a chance, especially with a used board, that the chip has been replaced with a different one. Although the ATMEL chip looks quite distinctive on an individual board, if you compare it to an older Arduino, telling them apart at first glance would be difficult. The important distinguishing feature is written on the surface of the chip. In this case, you are looking for ATmega328P-PU. Configure the software After you confirm the type of board you are using, you have to provide that information to the software. From the Arduino main menu bar (at the top of the Arduino window on Windows and at the top of the screen on Mac OS X), choose Tools→Board. You should see a list of the different kinds of boards supported by the Arduino software. Select your board from the list. Next, you need to select the serial port. The serial port is the connection that enables your computer and the Arduino device to communicate. Serial describes the way that data is sent, one bit of data (0 or 1) at a time. The port the physical interface, in this case a USB socket. To determine the serial port, choose Tools→Serial Port. A list displays of devices connected to your computer. This list contains any device that can talk in serial, but for the moment, you're only interested in finding the Arduino. If you've just installed Arduino and plugged it in, it should be at the top of the list. For OS X users, this is shown as /dev/tty.usbmodemXXXXXX (where XXXXXX is a randomly signed number). On Windows, the same is true, but the serial ports are named COM1, COM2, COM3, and so on. The highest number is usually the most recent device. After you find your serial port, select it. It should appear in the bottom right of the Arduino GUI, along with the board you selected. Upload the sketch Now that you have told the Arduino software what kind of board you are communicating with and which serial port connection it is using, you can upload the Blink sketch. First click the Verify button. Verify checks the code to make sure it makes sense. This doesn't necessarily mean your code will do what you are anticipating, but it verifies that the syntax is written in a way Arduino can understand. You should see a progress bar and the text Compiling Sketch for a few seconds, followed by the text Done compiling after the process has finished. If the sketch compiled successfully, you can click the Upload button next to the verify button. A progress bar appears, and you see lots of activity on your board from the two LEDs marked RX and TX. These show that the Arduino is sending and receiving data. After a few seconds, the RX and TX LEDs stop blinking, and a Done Uploading message appears at the bottom of the window. You should see the LED marked L blinking away reassuringly: on for a second, off for a second. If that is the case, give yourself a pat on the back. You've just uploaded your first piece of Arduino code and entered the world of physical computing! If you don't see the blinking L, review the preceding steps. Make sure you have installed Arduino properly and then give it one more go. If you still don't see the blinking L, check out the excellent troubleshooting page on the official Arduino site. Without breaking a sweat you've just uploaded your first sketch to an Arduino.
View ArticleArticle / Updated 07-20-2022
Basic Arduino sketches can get you quite a long way, but when you become more advanced you need to know about libraries. Libraries provide extra functionality to your Arduino sketch, either to use specific hardware or to incorporate more complex functions in software. In the same way that you’d go to a physical library to learn something new, you include libraries in your code to teach your Arduino something new. By including a library in a sketch, you can quickly and easily access functions to help you achieve your goals. Getting started with complex hardware or software can be difficult. Luckily, a lot of people have taken the time to document their progress and have released libraries, often with examples, that you can easily integrate into your own Arduino sketches. From this, it’s possible to get something working and gain a better understanding of it. This learn-by-doing approach of Arduino allows you to make a lot of progress quickly and easily with hardware or software that would otherwise be a huge challenge. Standard Arduino libraries Standard Arduino libraries refers to a selection of the libraries included in the current release of Arduino at the time of writing (1.8.5). The standard libraries cover a wide range of subject areas and are usually popular topics that have been heavily documented. You can find these libraries by choosing Sketch → Include Library → Manage Libraries. Choosing a library includes one line at the top of your current sketch, such as #include <EEPROM.h>. Before you attempt to understand a library, you should try an example of it. You'll find examples at the bottom of the menu that appears at when you choose File → Examples. Here is a brief description of what each Arduino library does: EEPROM: Your Arduino has electronically erasable programmable read-only memory (EEPROM), which is permanent storage similar to the hard drive in a computer. Data stored in this location stays there even if your Arduino is powered down. Using the EEPROM library, you can read from and write to this memory. Ethernet: After you have your Ethernet shield, the Ethernet library allows you to quickly and easily start talking to the Internet. When you use this library, your Arduino can act either as a server that is accessible to other devices or as a client that requests data. Firmata: Firmata is one way to control your Arduino from software on a computer. It is a standard communication protocol, so you can use the library to allow easy communication between hardware and software rather than write your own communication software. LiquidCrystal: The LiquidCrystal library helps your Arduino talk to most liquid crystal displays (LCDs). The library is based on the Hitachi HD44780 driver, and you can usually identify these displays by their 16-pin interface. SD: The SD library allows you to read from and write to SD and microSD cards connected to your Arduino. SD cards need to use SPI to transfer data quickly, which happens on pins 11, 12, and 13. You also need to have another pin to select the SD card when it’s needed. Servo: The Servo library allows you to control up to 12 servo motors on the Uno R3 (and up to 48 on the Mega). Most hobby servos turn 180 degrees, and using this library, you can specify the degree that you want your servo(s) to turn to. SPI: The Serial Peripheral Interface (SPI) is a method of communication that allows your Arduino to communicate very quickly with one or more devices over a short distance. Example of this communication include receiving data from sensors, talking to peripherals such as an SD card reader, and communicating with another microcontroller. SoftwareSerial: The SoftwareSerial library allows you to use any digital pins to send and receive serial messages instead of, or in addition to, the usual hardware pins (0 and 1). This capability is great if you want to keep the hardware pins free for communication to a computer, allowing you to have a permanent debug connection to your project while still being able to upload new sketches or to send duplicate data to multiple serial devices. Stepper: The Stepper library allows you to control stepper motors from your Arduino. This code also requires the appropriate hardware to work, so make sure to read Tom Igoe’s notes on the subject. Wi-Fi: The WiFi library is based on the Ethernet library listed previously, but with alterations specific to the Wi-Fi shield to allow you to wirelessly connect to the Internet. The WiFi library also works well with the SD library, allowing you to store data on the shield. Wire: The Wire library allows your Arduino to communicate with I2C devices (also known as TWI, or two-wire interface). Such devices could be addressable LEDs or a Wii Nunchuk, for example. Additional Arduino libraries Many libraries aren’t included in the Arduino software by default. Some libraries are for unique applications such as specific hardware or functions; others are refinements or adaptations of existing libraries. Luckily, Arduino makes including these easy, so you can quickly try them all to see which are right for your needs. Most libraries are easily installed by choosing Sketch → Include Library → Manage Libraries from the Arduino IDE menu. The Library Manager dialog box displays an easily searchable list of libraries submitted to the Arduino servers and approved for release. Libraries may also be distributed as ZIP files that have the same name as the library; for example, the capacitive sensing library CapSense should be distributed as CapSense.zip and should contain a folder of the same name when unzipped. Inside the folder there are files ending in .h and .cpp, such as CapPin.h and CapPin.cpp, and maybe even an Examples folder. If your .zip file contains only loose .h and .cpp files, you should place them in a folder with a library name. Sometimes you may find many .h and .cpp files that all perform different functions in the library, so make sure they're all inside the folder. In the latest release of Arduino (1.8.5 at the time of this writing), it’s easy to include libraries distributed as ZIP files. Simply choose Sketch → Include Library → Add .ZIP Library and select the ZIP file containing the library. After the library is installed, restart Arduino and choose Sketch → Include Library to check that your library is in the list. If the library has an Examples folder, you should also be able to see the examples by choosing File → Examples and then choosing the name of the library. That’s all there is to installing a library. Removing a library is as simple: just take the library folder out of the Arduino Sketch folder. Contributed Arduino libraries A long list of community-contributed libraries appears on the Arduino libraries page and an exhaustive list appears on the Arduino Playground. To become familiar with contributed libraries, start with CapSense and TimerOne, two commonly used and helpful libraries: CapSense: The CapSense library allows you to make one or many pins on your Arduino into capacitive sensors. This feature allows you to make simple touch, pressure, or presence detection sensors quickly and easily with little hardware. The Arduino Playground page has a lot of useful information, but a more recent version of the code can be found on GitHub. TimerOne: TimerOne (also called Timer1) uses a hardware timer on your Arduino to perform timed events at regular intervals. It’s a great library for reading sensor data regularly without interrupting what’s going on in the main loop. You can find a TimerOne page on the Arduino Playground and an up-to-date version of the library on Google Code. If you’re keen to understand libraries more and maybe even write your own, check out the introduction to writing your own libraries on the Arduino GitHub page.
View ArticleArticle / Updated 07-19-2022
You can us the standard USB Arduino board, but you should be aware that many others exist, all designed with different needs in mind. Some Arduino boards offer more functionality, and others are designed to be more minimal, but generally they follow a design similar to that of the Arduino Uno. The Arduino Uno is a great board, but here are some other options if you feel like venturing out. Official Arduino boards Although Arduino is open source, it is also a trademarked brand, so to guarantee the quality and consistency of its products, the Arduino team must properly approve new boards before they are officially recognized and can bear the name Arduino. You can recognize official boards first by the name — Arduino Pro, Arduino Fio, or Arduino LilyPad, for example. Other nonofficial boards often include Arduino compatible or for Arduino in the name. The other way to recognize an official Arduino, made by the Arduino team, is by the branding (in the most recent versions): They are turquoise and display the infinity symbol somewhere on the board, along with a link to Arduino’s site. Some other companies also have their boards accepted as official boards, so you may find other company names printed on them, such as Adafruit Industries and SparkFun. Because the schematics for the Arduino board are open source, unofficial Arduino boards have a lot of variation, which people have made for their own needs. These boards are usually based on the same microcontroller chips to remain compatible with the Arduino software, but they require extra consideration and reading to be sure that they will work as expected. The Seeeduino v4.2 (by Seeed Studio), for example, is based on the Arduino Uno and is 100 percent compatible but adds various extra connections, switches, and sockets, which may be of more use to you than an official Arduino board in certain situations. Official boards are the safe option for beginners to choose because the majority of Arduino examples online are based on these boards. Because of this, official boards are more widely used, and because of that, any errors or bugs in the board design are likely to be remedied with the next revision or at least well documented. Arduino Leonardo The Leonardo has the same footprint (shape of circuit board), but the microcontroller used is different and can be recognized as a keyboard or mouse by a computer. In the “Hacking Other Hardware” bonus chapter of Arduino For Dummies, 2nd Edition, you can find more detail about the differences between this board and the Uno and how to use it. Arduino Mega 2560 R3 As the name suggests, the Arduino Mega 2560 R3 is a bigger board than the Arduino Uno R3. It is for people who want more: more inputs, more outputs, and more processing power! The Mega has 54 digital pins and 16 analog pins whereas the Uno has a measly 15 digital and 6 analog pins. Arduino Mega ADK The Arduino Mega ADK is essentially the same board as the Mega 2560 Arduino but is designed to interface with Android phones. This means you can share data between your Android mobile or tablet and an Arduino to broaden the range of either. Arduino Nano 3.0 The Arduino Nano 3.0 is a condensed Arduino that measures just 0.70″ x 1.70″. This size is perfect for making your project smaller. The Nano has all the power of an Arduino Uno (both use the same ATmega328 microcontroller), but it's a fraction of the size. The Nano also handily fits into a breadboard, making it ideal for prototyping as well. Arduino Mini R5 Despite what the names suggest, the Arduino Mini R5 is smaller than the Nano. This board also uses the same ATmega328 microcontroller chip but is condensed further, removing all header pins and the Mini-USB connector of the Nano. The Mini board is great if space is at a premium, but it does require great care when connecting because an incorrect connection can easily destroy the board. Arduino 101 The Arduino 101 uses the Intel Curie module to provide a board that’s as easy to use as Arduino but with the latest Bluetooth low energy technology. It also features a six-axis accelerometer to detect movement, making it a great companion for any wearable technology projects or for talking to other Bluetooth devices. Arduino MKR1000 The Arduino MKR1000 is a simple but powerful board, combining a 32-bit processor with a Wi-Fi module. It’s perfect for linking sensors and actuators to the Internet or prototyping your next Internet of Things (IoT) project. Along with its small form factor, it has a handy battery connector to allow you to take your project on the move. Contributed (approved) Arduinos Many Arduino boards are now standardized and designed by the Arduino team. However, some have been contributed by other companies, such as Adafruit Industries and SparkFun, and are recognized as official boards. LilyPad Arduino USB The LilyPad Arduino USB was made for projects in which technology is combined with textiles to aid in the development of e-textiles or wearable electronics projects. The LilyPad and its accompanying breakout boards (printed circuit board that make it easy to integrate various components without the need to build your own boards) can be sewn together using conductive thread instead of conventional wire. This board was designed and developed by Leah Buechley of MIT and SparkFun Electronics. If you’re interested in e-textiles or wearable electronics, check out the excellent tutorial on SparkFun’s site that introduces the latest version of the board and the ProtoSnap kit. Arduino Pro The Arduino Pro is a minimal and super skinny Arduino, by SparkFun Electronics, based on the same microcontroller as those used in the Uno. It comes without any of the normal headers or sockets but has all the same capabilities of an Uno. It’s ideal when height is at a short supply. In addition, it has a battery socket, which allows you to easily make your project portable. Arduino Pro Mini The Pro Mini is another SparkFun product; this one pushes the minimalism of the Arduino Pro to new limits. In the scale of Arduinos, the Pro Mini sits neatly between the Nano and the Mini. It has none of the header pins or the Mini-USB port of the Nano, and is slightly more spread out than the Arduino Mini. The Pro Mini has none of the safety features of the Uno, so take great care when wiring because a wrong connection can easily destroy the board.
View ArticleArticle / Updated 07-19-2022
Shields are pieces of hardware that sit on top of your Arduino, often to give it a specific purpose. For example, you can use a shield to make it easier to connect and control motors or even to turn your Arduino into something as complex as a mobile phone. A shield may start out as an interesting bit of hardware that an enthusiast has been experimenting with and wants to share with the community. Or an enterprising individual (or company) may design a shield to make an application easier based on demand from the Arduino community. Shields can be simple or complex. They are sold preassembled or as kits. Kits allow you more freedom to assemble the Arduino shield as you need it to be. Some kits require you to assemble the circuitry of the boards, although more complex shields may already be largely assembled, needing only header pins. Shields enable you to use your Arduino for more than one purpose and to change that purpose easily. They neatly package the electronics for that circuit in the same footprint as an Arduino, and are stackable to combine different functionalities. But they all have to use the same pins on the Arduino, so if you stack shields, watch out for those that need to use the same pins. They always connect the GND pins, too, because any communication by your Arduino and another device needs a common GND. Arduino shield combinations In theory, shields could be stacked on top of each other forever, but you should take some points into consideration before combining them: Physical size: Some shields just don’t fit on top of one another. Components that are higher than the header sockets may touch the underside of any board on top of it. This situation, which can cause short circuits if a connection is made that shouldn’t be, can seriously damage your boards. Obstruction of inputs and outputs: If an input or output is obstructed by another shield, it becomes redundant. For example, there’s no point having a joystick shield or an LCD shield under another shield because no more than one can be used. Power requirements: Some hardware requires a lot of power. Although it is all right for shields to use the same power and ground pins, there is a limit to the amount of current that can flow through the other input/output (I/O) pins: 40mA per pin and 200mA max between all I/O pins. Exceed this, and you run the risk of seriously damaging your board and any other attached shield. In most cases, you can easily remedy this problem by powering your Arduino and shields from an external power supply so that the current isn’t passed through the Arduino. Make sure to use a common GND if you’re communicating between a board using I2C, SPI, or serial. Pins: Some shields require the use of certain pins. It’s important to make sure that shields aren’t doubling up on the same pins. In the best case, the hardware will just be confused; in the worst case, you can send voltage to the wrong place and damage your board. Software: Some of these shields need specific libraries to work. There can be conflicts in libraries calling on the same functions, so make sure to read up on what’s required for your shield. Interference with radio/Wi-Fi/GPS/GSM: Wireless devices need space to work. Move antennas or aerials away from the board to get a clear signal. If an antenna is mounted on the board, it’s generally a bad idea to cover it. Always try to place wireless shields at the top of the stack. Arduino shield reviews To give you an idea of available shields, check out some of the most interesting and useful Arduino shields on the market and shows you where to look for more information. The prices listed are subject to change so always do you research before making a purchase decision. A lot of feedback on all of these products is available online, so always read the comments and forums to get a good understanding of what you’re buying. This range of shields covers a vast number of different uses and the huge potential of Arduino projects. For many projects, a shield is all you need, but a shield is also an excellent stepping-stone for proving a concept before refining or miniaturizing your project. Prices provided are from a range of distributors to show the approximate value of the items. If you are a savvy shopper or are looking to buy in bulk, you may be able to reduce the cost. Proto shield kit Rev3 Made by: Arduino Price: $9.90 from Arduino Store Pins used: None The Proto shield is a platform for building custom circuits on your Arduino. Many Arduino shields add a specific function to your Arduino, but with a Proto Shield, you can decide how to use it. Take your existing breadboard layouts and solder them to the surface of the Proto shield to make your project more durable. Proto shields also come in a larger size to match the Arduino Mega’s footprint. Another handy feature of these shields is the space to attach SMD parts, which can be difficult to do otherwise. The Proto shield is sold either fully assembled or as a kit that requires soldering. You can find details about the shield on the Arduino product page. ProtoScrew shield Made by: WingShield Industries Price: $14.95 from Adafruit Pins used: None ProtoScrew shield is similar to the regular Proto shield but has large screw terminals connected to the pins as well. This feature is great for applications that have lots of inputs that may need changing or swapping, or just for easier assembly and disassembly. Changing a piece of wire is much easier with screw terminals than with soldering, so bear this in mind when planning your next project. ProtoScrew shield is sold as a kit and requires soldering. You can find more details on the Adafruit product page. Adafruit Wave shield v1.1 Made by: Adafruit Price: $22.00 from Adafruit Pins used: 13, 12, 11, 10, 5, 4, 3, 2 on the Uno R3 The Wave shield is a relatively cheap kit that allows you to play sounds or music with your Arduino. The Wave shield allows you to play WAV files directly from an SD card, making it easy to upload and change the sound files from your computer. To use the shield, you need the WaveHC library, which is available from the product page and Google Code. The Wave shield is sold as a kit and requires soldering. The SD card reader must use pins 13, 12, and 11 because they support a high-speed Serial Peripheral Interface (SPI), which is a protocol needed to transfer data quickly. Pin 10 is used to communicate with the SD card reader, and pins 5, 4, 3, and 2 are used to talk to the digital-to-analog converter (DAC), which converts a digital music signal into an analog voltage. For more details, visit the product page on Adafruit’s website. MP3 player shield Made by: SparkFun Price: $24.95 from SparkFun Pins used: 13, 12, 11, 9, 8, 7, 6, 5, 4, 3, 2 on the Uno R3 Turn your Arduino into an MP3 player with the easy-to-assemble MP3 player shield from SparkFun! Not only can it decode MP3 files, it’s also capable of decoding Ogg Vorbis, AAC, WMA, and MIDI. The MP3 shield also has a microSD card reader for ease of uploading files, and it has a 3.5mm mini jack that you can connect to most speaker systems. The MP3 player shield is assembled but requires minor soldering to attach the header pins or header sockets. The SD card reader uses pins 13, 12, and 11. You use pin 9 to talk with the SD card reader. Use pins 8, 7, 6, and 2 talk to MP3 audio decoder VS1053B, and use pins 4 and 3 for additional MIDI functionality. For more details, visit the SparkFun products page. Also see the tutorial page. The comments below the tutorial address many of the issues with this guide. One user has even written a library to make your life easier — a great example of the Arduino community supporting existing products. Always read the comments and forum entries on products and kits. These comments often contain a lot of detail on the ease of (or difficulty with) a product. This is also the place to voice your own problems. Just be sure that you’re not repeating something that’s solved further down the page; otherwise, you’ll be advised to read the manual! MIDI shield Made by: SparkFun Price: $19.95 from SparkFun Pins used: Uses pins 2, 3, 4, 6, 7, A1, A0 on the Uno R3 MIDI (Music Instrument Digital Interface) revolutionized the music industry in the 1980s and is still widely used now to connect instruments, computer, stage effects, and other hardware. With the MIDI shield, you can interface with anything that can send or receive MIDI data and incorporate it into your Arduino project. The MIDI shield is sold as a kit and requires soldering. For more details, visit the SparkFun product page. You can find some excellent general tutorials on MIDI on Arduino’s site and a lot of excellent reference material at tigoe.net and Hinton Instruments. RGB LCD shield with 16 x 2 character display Made by: Adafruit Price: $24.95 from Adafruit Pins used: Uses pins A4 and A5 on the Uno R3 This handy LCD (liquid crystal display) shield packages everything you need onto one board. LCDs are found in older mobile phones and Nintendo GameBoys (wow, that sounds old). They use a film that sits over a solid-colored, usually backlit surface. The pixels of this film can be turned on or off to make shapes, text, or graphics, and this is what you control with your Arduino. At the center of the shield is an RGB LCD display, so instead of being stuck with just one color, you can choose from any RGB color. The RGB backlight is controlled directly from your Arduino. The display is a 16 x 2 character display (no graphics), which means you can write two rows of 16 characters. You can choose from two displays: colored text on a dark background (negative) or dark text on a colored background (positive). A variety of LCD character displays with various backlighting and dimensions is available, so be sure to shop around. The RGB LCD shield is sold as a kit and requires soldering. Instead of using nine pins or more, the LCD, backlight, and buttons together use just two. By using the I2C to communicate with the shield, you can use only analog pin 4, which is the data (SDA) line, and analog pin 5, which is the clock (SCL) line. This protocol is used in many devices, so it is extremely useful to know about it. For more details on I2C, check John Boxall’s excellent tutorial. Shields are also available that use the same technology but don’t limit you to letters and numbers. If you’re looking to display your own graphics, you might want to use the SparkFun color LCD shield, which uses a Nokia 6100 screen, or the larger TFT touch shield. 2.8” TFT touch shield with capacitive touch Made by: Adafruit Price: $44.95 from Adafruit Pins used: 4, 8, 9, 10, 11, 12, 13, A4, A5 If an LCD display isn’t enough for you, try the TFT touch shield to add full color and touch input to your project. This display is a TFT LCD screen — a variation on a standard LCD screen that uses thin-film transistor (TFT) technology to improve the image quality — with a resolution of 240 x 320 pixels and 18-bit colors, giving you 262,144 shades. The screen is also fitted with a resistive touchscreen to register finger presses anywhere on the surface of the screen. The TFT touch shield is sold fully assembled and requires no soldering, so you can simply plug it on top of your Arduino. The touch shield needs a lot of pins to function and leaves you with only digital pins 2 and 3 and analog pins 4 and 5. Pin 12 is also available if you're not using the microSD reader. Check out Adafruit’s products page. Adafruit has also kindly written a complete library for the TFT to draw pixels, shapes, and text and a library for the touchscreen that detects x, y, and z horizontal movement, vertical movement, and pressure. Joystick shield Made by: SparkFun Price: $12.95 from SparkFun Pins used: 2, 3, 4, 5, 6, A0, A1 The joystick shield has all the functions of a modern game controller on a single Arduino-compatible board. It provides not only four pushbuttons to assign to various functions but also a hidden button in the control stick itself. With the ergonomic control stick, you can smoothly transition between x and y axes to perform movements with great accuracy. The joystick shield is sold as a kit and requires soldering. It uses only five digital pins and two analog pins, leaving many other Arduino pins free for other uses. It has five pushbuttons, using digital pins 2 to 6. The movement of the joystick is measured using two potentiometers: analog 0 maps the x, or horizontal, movement; analog 1 maps the y, or vertical, movement. You can find more details on the SparkFun product page. Adafruit motor/stepper/servo shield kit v2.3 Made by: Adafruit Price: $19.95 from Adafruit Pins used: 9, 10, A4, A5 Love motors? Want to try them all? Then the Adafruit motor/stepper/servo shield is the one for you. The shield is aptly named, enabling you to run all those motors you love. You can connect up to two 5V hobby servos, two stepper motors, or four bidirectional DC motors. The screw terminals make attaching and switching motors easy. When dealing with motors, it’s always important to make sure that you have enough current to drive them all, so a handy screw terminal on the shield allows you to power your motors independently of your Arduino. The Adafruit motor/stepper/servo shield is sold as a kit and requires soldering. Pins A4 and A5 control any connected DC or stepper motors, and pins 9 and 10 control any connected servos. This leaves you with a lot of pins free to be used for other inputs or outputs. You can find many details on the Adafruit product page and in the in-depth tutorial. Be aware of how much load is on the motor because the shield is designed to provide up to 600 mA per motor, with 1.2A peak current. If you’re approaching 1A, include a heat sink on the motor driver to dissipate the heat. Also, the nice people at Adafruit provide an easy-to-use library for your motor project. Happy motoring! LiPower shield Made by: SparkFun Price: $29.95 from SparkFun Pins used: 3 If you want to make your Arduino project more mobile, batteries are the answer. Rather than use bulky AA or AAA battery packs, the LiPower shield allows you to use rechargeable lithium batteries instead. Although lithium batteries are rated as only 3.7V, some clever hardware steps them up to 5V to make them sufficient to power your Arduino. The LiPower shield is assembled but requires minor soldering to attach the header pins or header sockets. Because the LiPower shield is there to provide power and not consume it, only one pin is in use. Pin 3 can be configured as an alert interrupt pin to signal whenever the battery drops to 32 percent or lower. For more details, check out the SparkFun product page. You find interesting notes on the hardware regarding the difficulties with charging lithium batteries, so make sure to read all the comments below the product description. Many other smaller lithium breakout boards are available that supply the standard 3.7V, such as the SparkFun USB LiPoly charger and the Adafruit micro Lipo. These breakout boards are perfect when paired with an appropriate low-voltage Arduino, such as the Arduino MKR1000. Boards such as the Arduino MRK1000 are useful when trying to reduce the size of your Arduino project. Adafruit Ultimate GPS logger shield Made by: Adafruit Price: $44.95 from Adafruit Pins used: 7, 8, 10, 11, 12, 13, A4, A5 The Adafruit Ultimate GPS logger shield lets you track and store location information using the Global Positioning System. You can find your location within a few meters. Use it to create GPS art or to map all your movements over the month. It’s also great for giving you an extremely accurate time. Data is stored on a microSD card as a TXT file, which can then be overlaid onto Google Maps or visualized in some other way. With the ever-increasing storage capacity of SD cards, you can store much more data on an SD card than your Arduino can on its own internal memory. This extra capacity is especially useful because it keeps your data-logging device mobile without the need for a computer, so you can leave that bulky laptop at home and send your GPS device out into the world! The Adafruit Ultimate GPS logger shield is sold without attached header pins and requires soldering. Pins 10, 11, 12, and 13 are used for communication with the SD card. The GPS module uses either the hardware serial connection (pins 0 and 1) or two pins for a software serial connection (pins 7 and 8). You can enable other optional functions, such as a signaling LED to indicate when data is logged, a pin to monitor the pulse from the GPS synchronization clock, and a pin to detect when an SD card is in the slot. Get the shield and more information on Adafruit. You can view an in-depth tutorial on Adafruit’s site, which details everything from construction of the kit to the Arduino code, along with uses for the GPS data. Adafruit FONA 800 shield Made by: Adafruit Price: $39.95 from Adafruit Pin requirements: 2, 3, 4 The Adafruit FONA 800 shield turns your modest Arduino into a functional mobile phone. With this shield, you can send and receive calls, text messages, and even data. All you need is a prepaid SIM card and an antenna, and you’re ready to communicate with the world. By using serial commands you can send codes to talk to the SIM800L module. The Adafruit FONA 800 shield is sold without attached header pins. You also need to purchase an antenna with an SMA connector; Adafruit offers a Slim Sticker-type GSM/Cellular quad-band antenna. The Arduino talks with the SIM800L via pins 2 and 3 using the SoftwareSerial library. The SIM card should have enough credit to perform the actions you’re trying to do. Those offering unlimited text messages are especially useful. Other optional extras are a mic and a speaker; without them, you won't be able to do anything more than call and hang up. You can view an in-depth tutorial on Adafruit’s site. Geiger counter – radiation sensor board shield Made by: Liberium Price: $170 from Cooking Hacks Pin requirements: 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 The radiation sensor board is probably one of the most impressive Arduino shields. It allows you to monitor radiation levels in the environment. This board was made to help the people of Japan monitor radiation levels following the radiation leakages in Fukushima in March 2011. The Geiger counter can use various Geiger tubes to detect different types and levels of radiation. There is also an LCD display, an LED, and a piezo speaker for feedback. This shield uses Geiger tubes that operate at dangerously high voltages (400V–1000V), so it requires extreme care. It is best to keep the radiation sensor board in an enclosure to keep it out of human contact. Radiation is dangerous, but so is electricity. If you don’t know what you’re doing, don’t mess around. The piezo speaker and LED are connected to pin 2, which triggers an interrupt with every pulse that the Geiger tube generates. Depending on the tube used and the number of pulses or counts per minute (cpm), you can determine the radiation level in Sieverts per hour. Pins 3 to 8 are used for the LCD display to generate the sensor readings in detail. Pins 9 to 13 are used for the LED bar to give clear visual feedback of the radiation level. The first three LEDs are green. The last two are red, showing that a high and potentially dangerous level of radiation is being approached. More details on this project can be found on the Cooking Hacks product page
View ArticleArticle / Updated 07-19-2022
If this is your first step into the world of Arduino, you will be relieved to know that you have an abundance of resources available on the Internet. You can find new Arduino-compatible hardware, projects, tutorials, and even inspiration. Check out these ten resources to learn more about Arduino Arduino blog The Arduino blog is a great source of all Arduino-related news. You can find news on the latest official hardware and software as well as on other interesting projects. Also found here are talks that the Arduino team wants to share with the community. Hack a Day Hack a Day is an excellent resource for all sorts of technological magic. In addition to presenting a lot of Arduino-related projects and posts, the site offers equal amounts of just about any other category of technology that you can think of. This site contains an excellent collection of posts and information to fuel the imagination. SparkFun SparkFun manufactures and sells all sorts of products to make your projects possible, and many of these involve Arduino. SparkFun has an excellent and well-maintained newsfeed that always has some sort of interesting new product or kit to show off. The company also provides excellent videos that explain its kits and document events that the SparkFun team hosts or attends. MAKE MAKE is hobbyist magazine that celebrates all kinds of technology. Its blog covers interesting do-it-yourself (DIY) technology and projects for inspiration. Arduino is so important to this community that it has its own subsection in the blog. Adafruit Adafruit is an online shop, repository, and forum for all kinds of kits to help you make your projects work. Its blog announces the ever-growing selection of available Adafruit products as well as other interesting tech news. Instructables Instructables is a web-based documentation platform that allows people to share their projects and step-by-step instructions. Instructables isn’t just about Arduino or even technology, so you can find a whole world of interesting material there. YouTube YouTube is a great place to kill time, but rather than watching cats do funny things, why not enter Arduino in the site’s search box to discover new projects that people are sharing. YouTube videos won’t always be the most reliable source for well-documented projects, but the videos provide a broad look at Arduino projects in action. Watching videos is especially useful for seeing the proper result of projects. Hackerspaces Hackerspaces are physical spaces where artists, designers, makers, hackers, coders, engineers, or anyone else can meet to learn, socialize, and collaborate on projects. Hackerspaces are found in a loose network all over the world. Forum The Arduino Forum is a great place to get answers to specific Arduino questions. You often find that other people are working through the same problems that you are, so you’re likely to find the answer to almost any problem with some thorough searching. Friends, colleagues, and workshops Starting out in the world of Arduino can be difficult on your own. You can find many sources on the Internet, but one of the best ways to learn is with friends and colleagues, because learning together teaches you much more than learning on your own can. Even better is to go to workshops and meet other people. You may find that they have the same interests, allowing you to pool what you know; or they may have different interests, providing an opportunity to show you something new. Arduino workshops are taking place all over the world, so with some careful searching in the Arduino Forum, Hackerspace forums, and Google, you should be able to find a workshop near you.
View ArticleCheat Sheet / Updated 02-17-2022
Arduino can help you build robots or electronic devices. But you have a lot to learn about Arduino because it encompasses the worlds of both hardware and software. The following sections contain nuggets of information about using resistors, gathering the tools you'll need, and system shortcuts to help you on your way to becoming an Arduino aficionado.
View Cheat SheetArticle / Updated 12-21-2018
You can make use of capacitive sensors in your Arduino project. Capacitive sensors detect changes in electromagnetic fields. Every living thing — even you — has an electromagnetic field. Capacitive sensors are extremely useful because they can detect human contact and ignore other environmental factors. You're probably familiar with high-end capacitive sensors because they are present in nearly all smartphones, but they have been around since the late 1920s. You can find Arduino kits with capacitive sensors that you can hook up easily, such as capacitive touch keypads. But it's just as easy to make your own capacitive sensors with an Arduino and an antenna. Consider the following when you are planning a sensor for your Arduino project: Complexity: Because all that is required is an antenna, you can be creative with what the antenna is and where it is placed. Short pieces of wire or copper tape are great for simple touch sensors. The piece of copper tape suddenly becomes a touch switch, meaning that you don’t even need a pushbutton to get the same functionality. You could even connect the antenna to a bigger metal object such as a lamp, turning it into a touch lamp. If the antenna is made from a reel of wire or a piece of foil, you can extend the range of the sensor beyond touch, which is known as a projected capacitive sensor. Using a capacitive sensor you can detect a person’s hand a few inches away from the antenna, which creates a lot of new possibilities for hiding sensors behind other materials. These discreet capacitive sensors are now commonly seen in many recent consumer electronics to remove physical buttons and maintain the sleek shape of the product. The electronics can also be placed under layers of other material, protected from the outside world. Capacitive touch sensors are easy to make. The difficulty with projected field sensors to determine the range of the field. The best way to determine this range is by experimentation, testing to see whether the field that you're generating is far-reaching enough. Cost: A capacitive touch kit designed for a specific purpose costs around $15 to $25. The kit should perform its job well, but it will be limited to the design of the interface. A capacitive sensor breakout board from SparkFun for around $10 lets you control up to 12 capacitive sensors. You have to wire your own touchpads, but you’re free to design an interface that suits your purpose. The cheapest option is to use the CapSense library for Arduino, which allows you to make a capacitive sensor with an antenna and no additional hardware! You can spend a few cents for an antenna or repurpose an old one. Location: Capacitive touch sensors can work with any conductive metal, so if you can design an attractive metal exterior, the only work will be to connect that exterior to your Arduino. If you’re looking for something more discreet, you may want to experiment with different layers of wood or plastic to hide your metal antenna. A thin layer of plywood allows the metal to be close to the surface, able to trigger the sensor. By covering the antenna with a non-conductive surface, you also give it a seemingly magical property, ensuring that people are left guessing at how it works. The easiest way to make a capacitive sensor is to use the CapSense library by Paul Badger. By using the CapSense library, you can replace the mechanical switches with highly robust capacitive touch sensors or capacitive presence detectors. Getting the CapSense Arduino library The CapSense library is available from GitHub, an online repository of software that manages different versions and allows you to see who has updated the software, and how. It’s an excellent system for sharing and collaborating on code projects. You can find the Arduino platform on GitHub; check it out if you’re curious about any changes. To get the library: Point your web browser to the GitHub CapSense page. On the CapSense page, click the Clone button or download and then click Download ZIP. The latest version of the library is downloaded to your downloads folder or a folder you specify. Rename the folder CapSense. Inside the folder, you should see a number of files ending in .h and .cpp as well as an Examples folder. Move the entire folder to your Arduino libraries directory. This directory should be the same as the one that your sketches are saved to, for example: Username/Documents/Arduino/libraries. If you don't have a libraries directory, create one. Your can find your Arduino Save directory by choosing Arduino → Preferences from the Arduino menu bar. After the CapSense library is inside this folder, it will be available the next time you run Arduino. Start or restart Arduino and go to Sketch → Include Library in the Arduino menu. Look for CapSense under the Contributed libraries section. If you don’t find it, check your directories and spelling and then restart Arduino. Implementing the CapPinSketch sketch For this project, you need the following: An Arduino Uno A wire antenna Crocodile clips (optional) As you can see below, little work is needed. You can simply have a wire antenna connected to pin 5, and you can enlarge your antenna by connecting it to any other conductive surface. Crocodile clips are useful to latch onto different antennas quickly and easily. Build the CapSense circuit, and choose File → Examples → CapSense → Examples → CapPinSketch from the Arduino menu to load the sketch. #include /* CapPin * Capacitive Library CapPin Demo Sketch * Paul Badger 2011 * This class uses the built-in pullup resistors read the capacitance * on a pin. * The pin is set to input and then the pullup is set, * A loop times how long the pin takes to go HIGH. * The readPin method is fast and can be read 1000 times in under 10 mS. * By reading the pin repeated you can sense "hand pressure" * at close range with a small sensor. A larger sensor (piece of foil/metal) * will yield * larger return values and be able to sense at more distance. For * a more sensitive method of sensing pins see CapTouch * Hook up a wire with or without a piece of foil attached to the pin. * I suggest covering the sensor with mylar, packing tape, paper or other * insulator to avoid having users directly touch the pin. */ CapPin cPin_5 = CapPin(5); // read pin 5 float smoothed; void setup() { Serial.begin(115200); Serial.println("start"); // slider_2_7.calibrateSlider(); } void loop() { delay(1); long total1 = 0; long start = millis(); long total = cPin_5.readPin(2000); // simple lowpass filter to take out some of the jitter // change parameter (0 is min, .99 is max) or eliminate to suit smoothed = smooth(total, .8, smoothed); Serial.print( millis() - start); // time to execute in mS Serial.print("\t"); Serial.print(total); // raw total Serial.print("\t"); Serial.println((int) smoothed); // smoothed delay(5); } // simple lowpass filter // requires recycling the output in the "smoothedVal" param int smooth(int data, float filterVal, float smoothedVal){ if (filterVal > 1){ // check to make sure param's are within range filterVal = .999999; } else if (filterVal <= 0){ filterVal = 0; } smoothedVal = (data * (1 - filterVal)) + (smoothedVal * filterVal); return (int)smoothedVal; } Press the Compile button to check your code. Compiling highlights any grammatical errors, which light up in red. If the sketch compiles correctly, click Upload to send the sketch to your board. When it has finished uploading, open the serial monitor, set the baud rate to 115200, and touch or approach the antenna. You should see two values racing down the screen. On the left is the raw value being read; on the right is the same reading after smoothing. If nothing happens, double-check your wiring: Make sure that you’re using the correct pin number. Check the connections on the breadboard. If the jump wires or components are not connected using the correct rows in the breadboard, they will not work. Understanding the CapPinSketch Arduino sketch At the start of the CapPinSketch sketch in the declarations, a new CapPin object is named. Note that cPin_5 is the name and it is assigned to pin 5 using CapPin(5): CapPin cPin_5 = CapPin(5); // read pin 5 A float named smoothed is declared to store the processed value of the sensor: <strong>float</strong> smoothed; In setup, serial communication is started on a baud rate of 115200, and the message start is sent to indicate to you that the serial port is connected: <strong>void setup</strong>() { <strong>Serial.begin</strong>(115200); <strong>Serial.println</strong>(<strong>"start"</strong>); This commented line is not used in this sketch but is referenced in some of the other CapSense examples. It can be uncommented to include further calibration functions that are in the library but is not be covered in this example: // slider_2_7.calibrateSlider(); } In this sketch, many variables are declared locally. Because they're not needed outside the loop, they're removed after each loop and redeclared at the start of the next loop. First, a one-millisecond delay occurs to help improve the stability of the reading: <strong>void loop</strong>() { <strong>delay</strong>(1); Next, the long variable total1 is declared. This variable can look confusing because the lowercase L and the numeral 1 look the same in most fonts. Incidentally, this variable is not used in this sketch. It may well be left over from a previous version: <strong> long</strong> total1 = 0; The next long variable is set to the current millis () value. Because this variable is local, the value is reset on each loop: <strong> long</strong> start = <strong>millis</strong>(); The specific function .readPin() reads your capacitive pin: <strong> long</strong> total = cPin_5.readPin(2000); If you want to explore in more depth what's happening, look at CapPin.cpp in the CapSense library. At first, the CapPin.cpp file looks baffling, but by reading the line that follows, you can see that the value relates to the number of samples that the Arduino is taking of the capacitance reading: strong>long CapPin::readPin(<strong>unsigned</strong> <strong>int</strong> samples) Editing the inner workings of libraries is not advised for beginners, but it is good to have a look at them to know what’s happening in your code and try to gain a better understanding of them. A smoothing function is also included in the sketch. This function takes the raw reading from the sensor, the smoothing value, and then the output variable. At present, the smoothing value is set to 0.8, but go ahead and experiment with this value to find the appropriate amount of smoothing for your application. This amount is dependent on how fast the loop is completed and how many readings are made in that time, so bear that in mind if you expect to add a lot of other controls or outputs: // simple lowpass filter to take out some of the jitter // change parameter (0 is min, .99 is max) or eliminate to suit smoothed = smooth(total, .8, smoothed); Finally, the values are printed to the serial port to be monitored. millis() – start gives the time that is taken to carry out the reading. If more samples are taken or any delays are added to the code, these activities increase the time to complete the loop and, therefore, the reaction time of the sensor: <strong>Serial.print</strong>( <strong>millis</strong>() - start); // time to execute in mS Tabs are used to neatly space the values. The total and smoothed values are both printed for comparison. You may notice a slight delay in the response time of the smoothed value. This delay shows you that your Arduino is reading many more values to do the smoothing, which takes time. This delay is barely noticeable when the sensor is in use because the baud rate is so high: <strong>Serial.print</strong>(<strong>"\t"</strong>); <strong>Serial.print</strong>(total); // raw total <strong>Serial.print</strong>(<strong>"\t"</strong>); <strong>Serial.println</strong>((<strong>int</strong>) smoothed); // smoothed <strong>delay</strong>(5); } At the bottom of the sketch outside the main loop is an additional function, referred to as a lowpass filter, which gives you the smoothed result. You can see that rather than starting with void, as is the case in setup () and loop (), the function starts with int, which means that an integer value is returned. Starting with int indicates that this function returns an integer value rather than a floating-point value. // simple lowpass filter // requires recycling the output in the "smoothedVal" param int smooth(int data, float filterVal, float smoothedVal){ if (filterVal > 1){ // check to make sure param's are within range filterVal = .999999; } else if (filterVal <= 0){ filterVal = 0; } smoothedVal = (data * (1 - filterVal)) + (smoothedVal * filterVal); return (int)smoothedVal; }
View ArticleArticle / Updated 12-21-2018
If you plan to have any fun with your Arduino, you’ll need to do some soldering. Soldering requires learning a great amount of technique, and you develop good technique with practice. In this example, you find out how to assemble an Arduino shield. A shield is a specific printed circuit board (PCB) that sits on top of the Arduino to give it a function. There are different Arduino shields for different functions. The one used in the example is the proto shield kit, which is essentially a blank canvas to solder your project onto, after prototyping it on a breadboard. In this example, you see how to assemble the bare minimum of the kit to attach it to your Arduino and then how to build a simple circuit on it. As with many Arduino kits, you need to assemble this shield yourself. The basic principles of soldering remain the same but may vary in difficulty as you encounter smaller or more sensitive components. Using stripboard instead of a PCB for Arduino shields Specially designed shields are made to fit your Arduino perfectly but can often be relatively expensive. Stripboard, or perfboard as it’s sometimes known, provides a cheap and highly versatile alternative. Stripboard is a circuit board with strips of copper and a grid of perforated holes that you can use to lay out your circuit in a similar way as on a breadboard. The pitch of the holes and the layout of the copper strips can vary. The most useful pitch for Arduino-related applications is the same as the pitch on the Arduino pins, 0.1 inches (2.54mm), because that pitch allows you to build on the layout of your Arduino to make your own custom shields. You can buy stripboard in various arrangements of copper strip as well, commonly either long copper columns that run the length of the board or sets of columns three rows deep (usually called tri-board). Check out these 10 places to find Arduino parts and components. Arduino shields: Laying out all the pieces of the circuit When assembling a circuit, your first step should always be to lay out all the pieces to check that you have everything you need. Your work surface should be clear and have a solid-colored cover to make things easy to find. This image shows the Arduino proto kit laid out in an orderly fashion. It contains the following: Header pins (40x1) Header sockets (3x2) Pushbuttons LEDs (various) Resistors (various) Some kits may ship the PCB only and leave you to choose the headers that are connected. Remember that there is no right or wrong way as long as the assembly suits your purpose. To assemble this shield, you can work from a picture to see the layout of the components, but for more difficult ones, you usually have instructions. In this example, you walk through the construction of this shield step by step and point out various techniques for soldering along the way Assembly of an Arduino shield To assemble this kit, you need to solder the header pins and the pushbutton. Soldering these pieces allows the shield to sit in the header sockets on your Arduino, extending all the pin connections to the proto shield. Note that some versions of the proto board have header sockets (or stackable headers) rather than header pins. Header sockets have long legs so that they can sit on top of an Arduino in the same way as header pins but also allow sockets for another shield to be placed on top. The benefit of header pins is that your shield is shorter and needs less space for any enclosure. Header sockets are used in the assembled Arduino shield. They are the black sockets that run down either side on the top of the board, with pins extending underneath. In this example, you use header pins and do not connect the ICSP (in-circuit serial programming) connector, which is the 3x2 connector in the center right of the Arduino Uno. The ICSP is used as an alternative for uploading sketches with an external programmer as opposed to the Arduino and is for advanced users. Header pins in an Arduino shield First you will need to cut the header pins to length. This kit uses a length of 1 x 40, which is 1 row of 40 pins. The plastic strip has a notch between each pair of pins that you can cut to divide the pins neatly. To secure the shield, you need lengths of 6 pins (for the analog-in pins), 8 pins (for the power pins), 8 pins (for the shorter row of digital pins), and 10 pins (for the longer row of digital pins). Use your clippers to cut the header pins to the correct length; you should have 8 pins remaining. (Put these in a box for future use!) The pins should fit exactly because there is a 2.54mm (0.1 inch) pitch between them, which matches the board. You need to look for this same pitch if you're buying header pins of any other connectors separately. Now that you know where the header pins go, you can solder them in place.
View ArticleArticle / Updated 12-21-2018
Arduino is made up of both hardware and software. The Arduino board is a printed circuit board (PCB) designed to use a microcontroller chip as well as other input and outputs. The board has many other electronic components that are needed for the microcontroller to function or to extend its capabilities. A microcontroller is a small computer contained in a single, integrated circuit or computer chip. Microcontrollers are an excellent way to program and control electronics. Microcontroller boards have a microcontroller chip and other useful connectors and components that allow a user to attach inputs and outputs. Some examples of devices with microcontroller boards are the Wiring board, the PIC, and the Basic Stamp. You write code in the Arduino software to tell the microcontroller what to to-do. For example, by writing a line of code, you can tell an light-emitting diode (LED) to blink on and off. If you connect a pushbutton and add another line of code, you can tell the LED to turn on only when the button is pressed. Next, you may want to tell the LED to blink only when the pushbutton is held down. In this way, you can quickly build a behavior for a system that would be difficult to achieve without a microcontroller. Similar to a conventional computer, an Arduino can perform a multitude of functions, but it’s not much use on its own. It requires inputs or outputs to make it useful. These inputs and outputs allow a computer — and an Arduino — to sense objects in the world and to affect the world. Before you move forward, it might help you to understand a bit of the history of Arduino. Where did Arduino come from? Arduino started its life in Italy, at Interaction Design Institute Ivrea (IDII), a graduate school for interaction design that focuses on how people interact with digital products, systems, and environments and how they in turn influence us. The term interaction design was coined by Bill Verplank and Bill Moggridge in the mid-1980s. The sketch by Verplank that you see below illustrates the basic premise of interaction design: If you do something, you feel a change, and from that you can know something about the world. Although interaction design is a general principle, it more commonly refers specifically to how we interact with conventional computers by using peripherals (such as mice, keyboards, and touchscreens) to navigate a digital environment that is graphically displayed on a screen. Another avenue, referred to as physical computing, is about extending the range of these computer programs, software, or systems through electronics. By using electronics, computers can sense more about the world and have a physical effect on the world themselves. Both areas — interaction design and physical computing — require prototypes to fully understand and explore the interactions, which presented a hurdle for non-technical design students. In 2001, a project called Processing, started by Casey Reas and Benjamin Fry, aimed to get non-programmers into programming by making it quick and easy to produce onscreen visualizations and graphics. The project gave the user a digital sketchbook on which to try ideas and experiment with a small investment of time. This project in turn inspired a similar project for experimenting in the physical world. In 2003, building on the same principles as Processing, Hernando Barragán started developing a microcontroller board called Wiring. This board was the predecessor to Arduino. In common with the Processing project, the Wiring project also aimed to involve artists, designers, and other non-technical people. However, Wiring was designed to get people into electronics as well as programming. The Wiring board was less expensive than some other microcontrollers, such as the PIC and the Basic Stamp, but it was still a sizable investment for students. In 2005, the Arduino project began in response to the need for affordable and easy-to-use devices for interaction design students to use in their projects. It is said that Massimo Banzi and David Cuartielles named the project after Arduin of Ivrea, an Italian king, but reliable sources say that it also happens to be the name of the local pub near the university, which may have been of more significance to the project. The Arduino project drew from many of the experiences of both Wiring and Processing. For example, an obvious influence from Processing is the graphic user interface (GUI) in the Arduino software. This GUI was initially “borrowed” from Processing, and even though it still looks similar, it has since been refined to be more specific to Arduino. Arduino also kept the naming convention from Processing, calling its programs sketches. In the same way that Processing gives people a digital sketchbook to create and test programs quickly, Arduino gives people a way to sketch their hardware ideas as well. Your Arduino can perform a huge variety of tasks. With a little practice, you'll be writing your own in no time. Each sketch is followed with a line-by-line explanation of how it works to ensure that no stone is left unturned. The Arduino board, shown below, was made to be more robust and forgiving than Wiring and other earlier microcontrollers. It was not uncommon for students, especially those from a design or arts background, to break their microcontroller within minutes of using it, simply by getting the wires the wrong way around. This fragility was a huge problem, not only financially but also for the success of the boards outside technical circles. You can also change the microcontroller chip on an Arduino; if the chip becomes damaged, you can replace just it rather than the entire board. Another important difference between Arduino and other microcontroller boards is the cost. Back in 2006, another popular microcontroller, the Basic Stamp, cost nearly four times as much ($119) as an Arduino ($32). Today, an Arduino Uno costs just $22. The price was originally intended to be affordable for students. The price of a nice meal and a glass of wine at that time was about $42, so if you had a project deadline, you could choose to skip a nice meal that week and make your project instead. The range of Arduino boards on the market is a lot bigger than it was back in 2006.
View ArticleArticle / Updated 12-21-2018
No one definitive Arduino board exists; many types of Arduino boards are available, each with its own design to suit various applications. Deciding what board to use can be a daunting prospect because the number of Arduino boards is increasing, each with new and exciting prospects. However, one board can be considered the archetype of the Arduino hardware, the one that almost all people start with and that is suitable for most applications. It’s the Arduino Uno. The most recent main board to date is the Arduino Uno R3 (released in 2011). Think of it as the plain vanilla of Arduino boards. It’s a good and reliable workhorse suitable for a variety of projects. If you're just starting out, the Uno R3 is the board for you. Check out the back of the Arduino Uno. Uno is Italian for the number one, named for the release of version 1.0 of the Arduino software. Predecessors to this release had a variety of names, such as Serial, NG, Diecimila (10,000 in Italian, to mark that 10,000 boards had been sold), and Duemilanove (2009 in Italian, the release date of the board); the Uno has ushered in some much needed order to the naming of the boards. R3 relates to the revision of the features on the board, which includes updates, refinements, and fixes. In this case, it is the third revision. The Brains of the Arduino Uno: ATmega328P microcontroller chip You can think of the microcontroller chip itself as the brains of the board. The chip used in the Arduino Uno is the ATmega328P, made by Atmel. It’s the large, black component in the center of the board. This chip is known as an integrated circuit, or IC. It sits in a socket; if you were to remove it. This same chip can come in different forms, referred to as packages. The one in an Arduino Uno is in a plated-through hole, or PTH, package, named because of the way it makes contact with the board. Another variation you may find is the Arduino Uno SMD, or surface mount device, package, which is mounted on the surface of the board rather than in holes that go through it. This chip is much smaller, but it is not replaceable, whereas the PTH chip is. Apart from that, it functions exactly the same as the PTH and differs only in looks. Header sockets in the Arduino Uno The microcontroller socket connects all the legs of the ATmega328 microcontroller chip to other sockets, referred to as header sockets, which are arranged around the edge of the board and are labeled for ease of use. These black sockets are divided into three main groups: digital pins, analog input pins, and power pins. All these pins transfer a voltage, which can be either sent as output or received as an input. Why are these pins important? They allow you to connect additional circuitry to the board quickly and easily when prototyping with a breadboard and to design additional boards, called shields, that fit neatly on top of your Arduino board. This same process of sending and receiving electrical signals is going on inside modern computers. But because they are so advanced and refined compared to a humble Arduino, it is difficult to directly link a computer accustomed to digital signals (0s and 1s) to an electronic circuit that deals with a range of voltages (0v to 5v in the ATmega328P’s case). The Arduino is special because it can interpret these electric signals and convert them to digital signals that your computer can understand — and vice versa. It also enables you to write a program using software on a conventional computer that the Arduino IDE (integrated development environment) converts or compiles to electrical signals that your circuit can understand. By bridging this gap, it is possible to use a conventional computer's benefits — ease of use, user-friendly interfaces, and code that is easy for humans to understand — to control a wide range of electronic circuits and even give them complex behaviors with relative ease. Arduino Uno: Digital pins You use digital pins to send and receive digital signals. Digital implies that the pins have two states: off or on. In electrical terms, these states translate to a value of 0 or 5 volts, but no values in between. Arduino Uno: Analog in pins You use analog in pins to receive an analog value. An analog value is taken from a range of values. In this case, the range is the same 0V to 5V as with the digital pins, but the value can be at any point — 0.1, 0.2, 0.3, and so on. What about analog out for the Arduino Uno? The shrewd ones among you may have noticed that there seem to be no analog out pins. In fact, the analog out pins are there, but they’re hidden among the digital pins marked as PWM using the ~ symbol. PWM stands for pulse-width modulation, which is a technique you can use to give the impression of an analog output using digital pins. The ~ symbol appears next to digital pins 3, 5, 6, 9, 10, and 11, showing that you have six pins that are capable of PWM. Power pins in the Arduino Uno You use the power pins to distribute power to inputs and outputs wherever power is needed. Vin, which stands for voltage in, can be used to supply a voltage (V) equal to the one supplied by the external supply jack (for example, 12V). You can also use this pin to supply power to the Arduino from another source. GND marks the ground pins, which are essential to complete circuits. There is also a third ground by pin 13. All these pins are linked and share the same (called common) ground. You can use 5V or 3.3V to supply a 5-volt or 3.3-volt power supply, respectively, to components or circuits. USB socket on the Arduino Uno To tell the microcontroller on the Arduino board what to do, you need to send a program to it. On the Uno, you send programs primarily by a USB connection. The large, metallic socket is a USB port for a USB A-B cable. This cable is similar to the one used on your home printer or scanner, so you may find a few around the house that can serve as handy spares. The Arduino uses the USB both for power and to transfer data. Using a USB cable is perfect for low-power applications and when data is being sent to or received from a computer. Power socket on the Arduino Uno Next to the USB socket is another socket; this one is for power. This socket allows you to power your Arduino from an external power supply. The supply could be from an AC-to-DC adaptor (similar to those used on other consumer electronics), a battery, or even a solar panel. The connector needed is a 2.1 mm center positive plug. Center positive simply means that the plug has an outside and an inside that fit the socket and that the inside of the plug must be positive. You should be able to find this plug among the standard connectors that come with most power supplies; otherwise, you can buy the connector and attach it to bare wires. If you connect a power supply that is the opposite (center negative), it is known as having a reverse polarity. Components on the Arduino Uno will resist your attempts to send voltage the wrong way around the board, but those components can melt in the process of saving your board, depending on how much power you're sending and how long it takes you to notice the burning smell! If you reverse the polarity when using the Vin, 5V, or 3.3V pins, you bypass this protection and almost instantly destroy several parts of your board and the ATmega328P chip. The recommended voltage for the Uno board is 7–12V. If you supply too little power, your board might not function correctly. Or if you provide too much power, your board might overheat and potentially be damaged. LEDs LEDs come in a variety of shapes and sizes and are found in almost every modern piece of consumer electronics, from bike lights to TVs to washing machines. The components are tiny. The Uno board has four LEDs (light-emitting diodes) labeled L, RX, TX, and ON. An LED is a component that produces light when electrical current flows through it. These four LEDs are used to indicate activity on the board, as follows: ON is green and signifies that your Arduino is powered. RX and TX tell you that data is being received or transmitted by the board. L is a special LED connected to digital pin 13. It is great for testing to see whether your board is functioning as you want. If your Arduino is plugged in but you don’t see any lights, double-check that: Your USB cable is plugged in Your USB port is working — try another device in the port Your cable is working — try another cable, if possible If the LED still doesn't illuminate, something is probably wrong with your Arduino. Your first destination should be the Arduino troubleshooting page. If you still have no luck, request a replacement Arduino from where you purchased the device. Reset button on the Arduino Uno The Uno board also has a button next to the USB socket called the reset button. It resets the program on the Arduino or stops it completely when held down for a time. Connecting a wire between GND and the reset pin, which is located next to the 3.3V, achieves the same results. The board has many other components, all of which perform important jobs, but the ones described here are the key ones for you to know as you get started.
View Article