www.b2cqshop.com Ebay store: b2cqshop , E-qstore Arduino Mega 2560 Crazy kit Manual B2CQSHOP 2011 - 10 - 30 www.b2cshop.com Ebay store: b2cqshop , E-qstore www.b2cqshop.com Ebay store: b2cqshop , E-qstore Contents The Kit Contents...............................................................................................................................4 Introduction.......................................................................................................................................5 What exactly is an Arduino?.............................................................................................................7 Getting Started................................................................................................................................11 Solderless Breadboard.....................................................................................................................18 Project 1 - LED Flasher..................................................................................................................19 - Code verview..............................................................................................................................21 - Hardware Overview....................................................................................................................26 Project 2 - Pulsating Lamp..............................................................................................................30 - Code Overview...........................................................................................................................32 Project 3 - Serial Controlled Mood Lamp.......................................................................................34 - Code Overview............................................................................................................................37 Project 4 - Piezo Sounder Player.....................................................................................................46 - Code Overview...........................................................................................................................49 Project 5 – 7seg-4digit LED Display........................................................................................53 Lesson 6 -- Ambient Light sensor.............................................................................................62 Project 7 – EEPROM......................................................................................................................65 - Hardware Overview....................................................................................................................70 Project 8 - Infrared Remote Control................................................................................................72 - Hardware Overview....................................................................................................................77 Project 9 - 8x8 LED Display........................................................................................................80 - Hardware Overview....................................................................................................................85 Project 10 – SD card module Control.............................................................................................86 - Hardware Overview....................................................................................................................92 Project 11 – Show in 128*64 LCD..............................................................................................93 - Hardware Overview..................................................................................................................102 Project 12 - Vibration Motor.........................................................................................................104 - Hardware Overview..................................................................................................................105 www.b2cshop.com Ebay store: b2cqshop , E-qstore www.b2cqshop.com Ebay store: b2cqshop , E-qstore Project 13 – 4*4 Matrix Keypad...................................................................................................107 - Code Overview..........................................................................................................................111 Project 14 –Real Time Clock 1307...............................................................................................113 Project 15- RFID module..............................................................................................................117 - Hardware Overview..................................................................................................................139 NFC (Near Field Communication)................................................................................139 Passive Communication: ISO14443A Cards (Mifare, etc.)..........................................139 Active Communication (Peer-to-Peer)..........................................................................139 Project 16 – Big Project................................................................................................................147 www.b2cshop.com Ebay store: b2cqshop , E-qstore www.b2cqshop.com Ebay store: b2cqshop , E-qstore The Kit Contents • 1 X Arduino Mega 2560 board (High quality , 100% clone board) • 1 X 128 * 64 LCD • 1 X RFID module • 1 X Rectangle tag • 1 X Round tag • 1 X Mega IO Sensor Shield • 1 X bundles Breadboard jumper wires • 1 X High quality Breadboard • 1 X 4*4 Matrix Keypad • 1 X SD card Module • 1 X 8*8 Matrix LEDs • 1 X IR controller • 1 X IR receiver • 1 X IR sender • 1 X AT24C64 EEPROM Chip • 1 X 74HC595N • 1 X DS1307 RTC Chip • 1 X 32.768 KHz watch crystal • 1 X CR2032 battery socket • 1 X 5V Relay • 1 X 5V Buzzer • 1 X Photoresistor • 10 X Green 3mm LEDs • 10 X Yellow 3mm LEDs • 10 X Red 3mm LEDs • 10 X 220 ohm Resistors • 10 X 1K ohm Resistors • 10 X 10K ohm Resistors • 1 X 9V power adapter • 1 X 7seg-4digit LED display • 1 X 10K Rotary Potentiometer • 1 X 3V-6V motor • 5 X 2N2222 transistors • 5 X 1N4001 Diode • 2 X 100nF capacitor • 1 X 20 pin Straight male header www.b2cshop.com Ebay store: b2cqshop , E-qstore www.b2cqshop.com Ebay store: b2cqshop , E-qstore Introduction Thank you for purchasing this Arduino Mage 2560 Kit. You are now well on your way inyour journey into the wonderful world of the Arduino and microcontroller electronics. This book will guide you, step by step, through using the Starter Kit to learn about the Arduino hardware, software and general electronics theory. Through the use of electronic projects we will take you from the level of complete beginner through to having an intermediate set of skills in using the Arduino. The purpose of this book and the kit is to give you a gentle introduction to the Arduino, electronics and programming in C and to set you up with the necessary skills needed to progress beyond the book and the kit into the world of the Arduino and microcontroller electronics. The booklet has been written presuming that you have no prior knowledge of electronics, the Arduino hardware, software environment or of computer programming. At no time will we get too deep into electronics or programming in C. There are many other resources available for free that will enable you to learn a lot more about this subject if you wish to go further. The best possible way to learn the Arduino, after using this kit of course, is to join the Arduino Forum on the Arduino website and to check out the code and hardware examples in the ‘Playground’ section of the Arduino website too. We hope you enjoy using the kit and get satisfaction from creating the projects and seeing your creations come to life. How to use it The book starts off with an introduction to the Arduino, how to set up the hardware, install the software, etc. We then explain the Arduino IDE and how to use it before we dive right into some projects progressing from very basic stuff through to advanced topics. Each project will start off with a description of how to set up the hardware and what code is needed to get it working. We will then describe separately the code and the hardware and explain in some detail how it works. Everything will be explained in clear and easy to follow steps. The book contains a lot of diagrams and photographs to make it as easy as possible to check that you are following along with the project correctly. What you will need Firstly, you will need access to the internet to be able to download the Arduino IDE (Integrated Development Environment) and to also download the Code Samples within this book (if you don’t want to type them out yourself) and also any code libraries that may be necessary to get your project working. You will need a well lit table or other flat surface to lay out your components and this will need to be next to your desktop or laptop PC to enable you to upload the code to the www.b2cshop.com Ebay store: b2cqshop , E-qstore www.b2cqshop.com Ebay store: b2cqshop , E-qstore Arduino. Remember that you are working with electricity (although low voltage DC) and therefore a metal table or surface will first need to be covered in a non-conductive material (e.g. tablecloth, paper, etc.) before laying out your materials. Also of some benefit, although not essential, may be a pair of wire cutters, a pair of long nosed pliers and a wire stripper. A notepad and pen will also come in handy for drawing out rough schematics, working out concepts and designs, etc. Finally, the most important thing you will need is enthusiasm and a willingness to learn. The Arduino is designed as a simple and cheap way to get involved in microcontroller electronics and nothing is too hard to learn if you are willing to at least ‘give it a go’. This Arduino Kit will help you on that journey and introduce you to this exciting and creative hobby. ( Thank you very much for the book of “ Mike McRoberts “ , book title is “ Arduino_Starter_Kit_Manual-Mar2010 “ Thank you very much for the book of “Michael.Margolis “,book title is “Arduino Cookbook 2011”. And Thank you very much the team of B2CQSHOP , too ) B2CQSHOP Webstite : www.b2cqshop.com Email : [email protected] MSN : [email protected] Skype : evanjoo www.b2cshop.com Ebay store: b2cqshop , E-qstore www.b2cqshop.com Ebay store: b2cqshop , E-qstore What exactly is an Arduino? an Arduino is a tiny computer that you can program to process inputs and outputs going to and from the chip. The Arduino is what is known as a Physical or Embedded Computing platform, which means that it is an interactive system, that through the use of hardware and software can interact with it’s environment. For example, a simple use of the Arduino would be to turn a light on for a set period of time, let’s say 30 seconds, after a button has been pressed (we will build this very same project later in the book). In this example, the Arduino would have a lamp connected to it as well as a button. The Arduino would sit patiently waiting for the button to be pressed. When you press the button it would then turn the lamp on and start counting. Once it had counted 30 seconds it would then turn the lamp off and then carry on sitting there waiting for another button press. You could use this set-up to control a lamp in an under-stairs cupboard for example. You could extend this example to sense when the cupboard door was opened and automatically turn the light on, turning it off after a set period of time. The Arduino can be used to develop stand-alone interactive objects or it can be connected to a computer to retrieve or send data to the Arduino and then act on that data (e.g. Send sensor data out to the internet). The Arduino can be connected to LED displays, LED’s. Dot Matrix displays, buttons, switches, motors, temperature sensors, pressure sensors, distance sensors, SD card, webcams, printers, GPS receivers, ethernet modules, and so on . The Arduino board is made of an an Atmel AVR Microprocessor, a crystal or oscillator (basically a crude clock that sends time pulses to the microcontroller to enable it to operate at the correct speed) and a 5-volt linear regulator. Depending on what type of Arduino you have, you may also have a USB connector to enable it to be connected to a PC or Mac to upload or retrieve data. The board exposes the microcontroller’s I/O (Input/Output) pins to enable you to connect those pins to other circuits or to sensors, etc. To program the Arduino (make it do what you want it to) you also use the Arduino IDE (Integrated Development Environment), which is a piece of free software, that enables you to program in the language that the Arduino understands. In the case of the Arduino the language is C. The IDE enables you to write a computer program, which is a set of step-bystep instructions that you then upload to the Arduino. Then your Arduino will carry out those instructions and interact with the world outside. In the Arduino world, programs are known as ‘ Sketches ‘ . www.b2cshop.com Ebay store: b2cqshop , E-qstore www.b2cqshop.com Ebay store: b2cqshop , E-qstore The Arduino hardware and software are both Open Source, which means the code, the schematics, design, etc. are all open for anyone to take freely and do what they like with it. This means there is nothing stopping anyone from taking the schematics and PCB designs of the Arduino and making their own and selling them. This is perfectly legal, and indeed the whole purpose of Open Source, and indeed the Freeduino that comes with the Earthshine Design Arduino Starter Kit is a perfect example of where someone has taken the Arduino PCB design, made their own and are selling it under the Freeduino name. You could even make your own Arduino, with just a few cheap components, on a breadboard. The only stipulation that the Arduino development team put on outside developers is that the Arduino name can only be used exclusively by them on their own products and hence the clone boards have names such as Dfrobot, Freeduino, Boarduino, Roboduino, etc. As the designs are open source, any clone board, such as the Freeduino is 100% compatible with the Arduino and therefore any software, hardware, shields, etc. will all be 100% compatible with a genuine Arduino. www.b2cshop.com Ebay store: b2cqshop , E-qstore www.b2cqshop.com Ebay store: b2cqshop , E-qstore The Arduino can also be extended with the use of ‘Shields’ which are circuit boards containing other devices (e.g. GPS receivers, LCD Displays, Ethernet connections, etc.) that you can simply slot into the top of your Arduino to get extra functionality. You don’t have to use a shield if you don’t want to as you can make the exact same circuitry using a breadboard, some veroboard or even by making your own PCB’s. There are many different variants of the Arduino available. The most common one is the Diecimila or the Duemilanove. You can also get Mini, Nano and Bluetooth Arduino’s. New to the product line is the new Arduino Mega 2560 and Mega 1280 with increased memory and number of I/O pins. Probably the most versatile Arduino, and hence the reason it is the most popular, is the Duemilanove. This is because it uses a standard 28 pin chip, attached to an IC Socket. The beauty of this systems is that if you make something neat with the Arduino and then want to turn it into something permanent (e.g. Or understairs cupboard light), then instead of using the relatively expensive Arduino board, you can simply use the Arduino to develop your device, then pop the chip out of the board and place it into your own circuit board in your custom device. You would then have made a custom embedded device, which is really cool. Then, for a couple of quid or bucks you can replace the AVR chip in your Arduino with a new one. The chip must be pre-programmed with the Arduino Bootloader to enable it to work with the Arduino IDE, but you can either burn the bootloader yourself if you purchase an AVR Programmer, or you can buy these preprogrammed from many suppliers around the world. Of course, Earthshine Design provide preprogrammed Arduino chips in it’ store for a very reasonable price. If you do a search on the Internet by simply typing ‘Arduino’ into the search box of your favourite search engine, you will be amazed at the huge amount of websites dedicated to the Arduino. You can find a mind boggling amount of information on projects www.b2cshop.com Ebay store: b2cqshop , E-qstore www.b2cqshop.com Ebay store: b2cqshop , E-qstore made with the Arduino and if you have a project in mind, will easily find information that will help you to get your project up and running easily. The Arduino is an amazing device and will enable you to make anything from interactive works of art to robots. With a little enthusiasm to learn how to program the Arduino and make it interact with other components a well as a bit of imagination, you can build anything you want. This book and the kit will give you the necessary skills needed to get started in this exciting and creative hobby. So, now you know what an Arduino is and what you can do with it, let’s open up the starter kit and dive right in. www.b2cshop.com Ebay store: b2cqshop , E-qstore
Description: