ARDUINO FOR COMPLETE IDIOTS. by David Smith

Size: px
Start display at page:

Download "ARDUINO FOR COMPLETE IDIOTS. by David Smith"

Transcription

1

2

3 ARDUINO FOR COMPLETE IDIOTS by David Smith

4 All Rights Reserved. No part of this publication may be reproduced in any form or by any means, including scanning, photocopying, or otherwise without prior written permission of the copyright holder. Copyright 2017.

5 Other books in the Series: Digital Signal Processing for Complete Idiots Control Systems for Complete Idiots Circuit Analysis for Complete Idiots Basic Electronics for Complete Idiots Electromagnetic Theory for Complete Idiots Digital Electronics for Complete Idiots

6 Table of Contents PREFACE 1. WHAT IS AN ARDUINO? 2. WHY ARDUINO? 3. TYPES OF ARDUINOS 4. ARDUINO UNO 5. WHAT S ON THE BOARD? 6. BASICS OF C-PROGRAMMING 7. PROGRAMMING THE ARDUINO 8. SETTING UP THE ARDUINO 9. LED BLINK 10. MULTI LED BLINK 11. SERIAL COMMUNICATION 12. INTERFACING SERVO MOTOR WITH ARDUINO 13. INTERFACING LCD WITH ARDUINO 14. INTERFACING LDR WITH ARDUINO 15. INTERFACING RELAY MODULE WITH ARDUINO 16. INTERFACING ULTRASONIC SENSOR WITH ARDUINO 17. INTERFACING PIR SENSOR WITH ARDUINO 18. INTERFACING JOYSTICK MODULE WITH ARDUINO 19. INTERFACING IR SENSOR (TSOP1738) WITH ARDUINO 20. ARDUINO PROJECT 1: DIGITAL THERMOMETER 21. ARDUINO PROJECT 2: SMART CANE FOR VISUALLY IMPAIRED 22. ARDUINO PROJECT 3: ROBOTIC HAND 23. ARDUINO PROJECT 4: 4 x 4 x 4 LED CUBE 24. ARDUINO PROJECT 5: VOICE CONTROLLED ROBOT 25. HOME MADE ARDUINO BOARD REFERENCES CONTACT

7 PREFACE Arduino is a family of single-board microcontrollers, intended to make it easier to build interactive objects or environments. What the Arduino platform has done is to take what was once a fragmented and expensive market for robotics and microprocessors and become the major platform, largely by virtue of much lower cost and ease of use, leading to higher volume and popularity, and community support behind it. Arduino has made it simple to program their boards with any computer via USB and simple to integrate with a wide array of sensors and devices. The Arduino is great for hobbyists, prototypers, and people just starting out in robotics because of its low cost, ease of use, and large following online. It's easy to learn and teach people to be able to do basic things with the Arduino, yet it's capable enough to do fairly sophisticated things if you as a developer have the capability to take advantage of it. It's allowing people to develop projects inexpensively to build and control their own devices, such as sensors that send data to the Internet and control systems for all kinds of things. It's also reducing the cost of development by allowing companies to develop prototypes much more quickly and with less initial investment. Even after being so successful some changes are expected in the near future 1. We may see the next Arduino in the form of a cheap practical computer (like Raspberry pi), maybe a 64-bit processing beast. 2. We may see even more flexible programming environment and development options. 3. Standardization for industrial use. 4. New prototyping hardware and compatibility and interfacing with other consumer electronics/tv/smartphones and flooding of shields. The Arduino is going to enable businesses to do things that aren't commonly done today with remote sensor networks. This could lead to entirely new control strategies for making buildings more comfortable, saving energy, and reducing maintenance costs for equipment. The Arduino is going to allow businesses to develop products that are more easily upgradeable. Right now if you buy a product, such as a microwave, there's no way to change the functionality. If the microwave used an Arduino board, you would be able to change the interface or the way that the microwave cooked food to suit your desires. Arduino is backbone for many future technologies. Already 3D printers, DIY Drones etc. are open for the public to prototype and design. The main intention of this book is to give an introduction to the world of Arduinos. I've tried my best to keep the book as simple and informative as possible. Readers are welcome to give constructive suggestions for the improvement of the book and please do leave a review. GOOD LUCK

8 1. WHAT IS AN ARDUINO? Arduino is a very popular and easy to use programmable microcontroller board for creating your own projects. Consisting of a simple hardware platform and a free source code editor with an easy one click compile/upload feature, it s designed to be really easy to use without being an expert programmer. But don t be fooled by its simplicity, Arduinos are very versatile. Anything from robots, home automation, networking, you name it, it can be made using an Arduino. All you need is the right knowledge and some inspiration.

9 2. WHY ARDUINO? These days whenever somebody speaks about electronics, the word Arduino often pops up. It s not like there aren t any other development boards, trust me there are plenty. But why is Arduino so popular? There's good reason for that. 1. Arduino is easy to use, connects to computer via USB and communicates using standard serial protocol, runs in standalone mode and as interface connected to PC/Macintosh computers. 2. It is an open-source project, software/hardware is extremely accessible and very flexible to be customized and extended 3. It is flexible, offers a variety of digital and analog inputs, SPI and serial interface and digital and PWM output 4. It is inexpensive, around $25 per board and comes with free authorizing software 5. Arduino is backed up by a growing online community, lots of source code is already available and we can share and post our examples for others to use, too! So if you are into electronics and stuff, it s about time, you buy an Arduino board.

10 3. TYPES OF ARDUINOS Arduinos come in all different shapes and specifications. Choosing the right board is very important, while making a project. Let s take look at different types of Arduinos available. 1. Arduino Uno: It is the most common version of Arduino. Normally, when people talk about an Arduino, they're referring to an Arduino Uno. It connects to the computer with a standard USB cable and contains everything else you need to program and use the board. Buy here: Arduino_Uno

11 2. Arduino Mega 2560: The Mega is the second most commonly encountered version of the Arduino family. The Arduino Mega is like the Arduino Uno's older brother. It may make your project more powerful, but it will also make your project larger. So you only need to buy this one, if you are sure that the Arduino Uno can t handle your project. 3. Arduino LilyPad: Buy here: Arduino_Mega The LilyPad was designed for wearable and e-textile applications. It is intended to be sewn to fabric and connected to other sewable components using conductive thread. This board requires the use of a special FTDI-USB TTL serial programming cable.

12 Buy here: Arduino_Lilypad 4. Arduino fio: The Arduino Fio is intended for wireless applications. The user can upload sketches with an a FTDI cable or Sparkfun breakout board. The board comes without premounted headers, allowing the use of various types of connectors or direct soldering of wires. Buy here: Arduino_Fio

13 All the different types of Arduinos have different uses and specifications. The right board is selected based on the requirements of the project and comfort of the user. For beginners, I would recommend Arduino Uno as their first board. In this book, we will be dealing with Arduino Uno mostly, it being the easiest to learn and experiment. Proper understanding of at least one type of Arduino would go a long way in learning other types of Arduinos. There are lots of clone Arduino boards available for very cheap prices in the market today.

14 4. ARDUINO UNO Arduino Uno (generally referred to as simply Arduino ) is perhaps the most commonly used development board. First things first, there's generally a misconception, that Arduino board is a microcontroller. The Arduino board actually is a specially designed circuit board for programming and prototyping with Atmel microcontrollers. Bear with me, this chapter is very boring, but the interesting stuff will come soon enough.

15 SUMMARY: Microcontroller Operating Voltage Input Voltage (recommended) ATmega328 5V 7-12V Input Voltage (limits) 6-20V Digital I/O Pins 14 (of which 6 provide PWM output) Analog Input Pins 6 DC Current per I/O Pin DC Current for 3.3V Pin Flash Memory SRAM EEPROM 40 ma 50 Ma 32 KB (ATmega328) of which 0.5 KB used by bootloader 2 KB (ATmega328) 1 KB (ATmega328) SCHEMATICS: EAGLE files: (NOTE: works with Eagle 6.0 and newer) Schematic: POWERING AN ARDUINO: An Arduino can be powered using USB cable or an AC-DC adapter or a battery. The adapter can be connected by plugging a 2.1mm center-positive plug into the board's power jack. Leads from a battery can be inserted in the Gnd and Vin pin headers of the POWER connector. The board can operate in 7-12 V range. If lesser voltage is provided, pins will give out different voltages and the Arduino will be unstable. If greater voltage is provided, the voltage regulator may overheat and board will get damaged.

16 MEMORY: The Atmega328 has 32 KB (with 0.5 KB used for the bootloader). It also has 2 KB of SRAM and 1 KB of EEPROM (which can be read and written with the EEPROM Library) PHYSICAL CHARACTERISTICS: Maximum length:2.7 inch Maximum breadth:2.1 inch Four screw holes allow the board to be attached to a surface or case. USB OVERCURRENT PROTECTION: The Arduino Uno has a resettable polyfuse that protects your computer's USB ports from shorts and overcurrent. PROGRAMMING: The Arduino Uno can be programmed with the Arduino IDE software. It is the software tool needed to write code, and load into the Arduino main board. You can download the appropriate IDE based on your Operating system (Windows, Mac OS X, Linux): DOWNLOAD The ATmega328 on the Arduino Uno comes pre burned with a bootloader, so no external hardware is required to program the Arduino.

17 COMMUNICATION: Arduino facilitates the communication with computers, Arduinos, other microcontrollers etc. GETTING STARTED WITH ARDUINO UNO: Before anything, you would need 3 things: 1. Arduino Uno board (latest version is revision 3) 2. USB cable for loading program 3. Arduino IDE (Software). Once you get a hold of these, you are good to go.

18 A USB cable is used to connect Arduino Main Board to the computer/laptop for loading program, for power and also for serial communication. Arduino UNO and earlier version uses USB B type cable. Do check if the Arduino board comes with the cable, else you need to buy it separately it! By the way, USB B type cable is commonly used on USB printers, if you have one, just use it temporary. If you are getting the latest version of Arduino, you will need the USB Micro B cable.

19 5. WHAT S ON THE BOARD? There's a lot going on an Arduino board and it s very overwhelming for a beginner. Let s go through each part one by one. POWER (USB/BARREL JACK) Every Arduino board needs a way to be connected to a power source. The Arduino UNO can be powered from a USB cable connected to your computer or a DC adapter, that is terminated in a barrel jack. RESET BUTTON It's the red button to the right of the power jack. Pushing it will temporarily connect the reset pin to ground and restart any code that is loaded on the Arduino. POWER LED INDICATOR Just beneath and to the right of the word UNO on your circuit board, there s a tiny LED next to the word ON This LED should light up whenever you plug your Arduino into a power source.

20 VOLTAGE REGULATOR Voltage Regulator is responsible for providing a constant DC power to the board. It functions when an external power supply is used instead of USB. MICROCONTROLLER The black thing with a lot of metal legs on your board, that is the microcontroller. Think of it as the brain of the Arduino. In an Arduino Uno, ATmega 328 microcontroller is used. There are 3 sets of pins on an Arduino Uno board: Power Pins, Digital Pins, Analog Pins POWER PINS They are the set of 6 pins (+ 2 additional pins in Revision 3) on the bottom of the board, right of the adapter input. What does these pin do? 1. 5V pin-provides 5V DC power. You can provide 5V to your circuit from this pin 2. 3V3-provides 3.3V DC power (many devices work at this voltage) 3. GND-there are 2 ground pins. These can be used to ground your circuit. 4. Vin-If you are not powering it from USB but rather from an external power supply, that supply is directly available on VIN. However, the ATmega328 is still powered from 5V which is available on the 5V pin after being passed through the regulator.

21 So the VIN pin is unregulated (unless your external supply is regulated) and should probably not be used to power external components. DIGITAL INPUT/OUTPUT PINS They are a set of 14 pins on the top of the Arduino (on top of UNO ). They can provide a maximum of 5V. They have only 2 states- 1 or 0 (HIGH or LOW) ie 5V or 0V. They can be used as input or output using the appropriate functions when coding (ex pinmode(), digitalwrite(), digitalread() etc.). Each pin can provide or receive a maximum of 40 ma. Besides the common function, these pins also have some special functions: Serial: 0 (RX) and 1 (TX). Are used to receive (RX) and transmit (TX) TTL serial data to other microcontrollers etc. PWM: 3, 5, 6, 9, 10, and 11 provide 8-bit PWM output with the analogwrite() function. PWM is a technique to produce analog signals from digital signals. LED: 13: There is a built-in LED connected to digital pin 13. When the pin is HIGH value, the LED is on, when the pin is LOW, it's off. ANALOG PINS Arduino Uno has 6 analog pins. The analog pins let you read/write analog values basically this means that, instead of giving out a voltage of 0 or 5 (as with digital), they can give a range of voltages between 0 and 5 (both as input and output). Note that the voltage during analog output is only the observed voltage with a multimeter. In reality, the analog pins send pulses of 0V and 5V signals to get an output that "looks" analog (this is PWM).

22

23 6. BASICS OF C-PROGRAMMING The main advantage of Microcontrollers over traditional IC s is that, they are programmable. There functionalities aren t fixed, they can be programmed to do things according to our wish. So in dealing with Microcontrollers, a good knowledge in computer programming could come in handy. So what better than C programming. For beginners, learning a programming language might seem an uphill task, but once you get hang of things, there's no looking back. For those of you who have decent knowledge in at least one kind of programming language (be it C, C++, java, python etc.), you are free to skip this chapter without any hesitation. 6.1 INTRODUCTION What is a Programming Language? A Programming language, like any other language is used to communicate. It is used to communicate with a machines, mostly computers or in our case, with an Arduino. It is no different from a normal language, like English, Chinese, French or any other. Like in English (or any other language) there are a set of rules to be followed (nouns, verbs, pronouns, pronunciation, that kind of stuff). We don t follow those rules in the strictest sense communicating, only thing that matters to us is, whether the other person has got the message or not. In a programming language, every single rule has to be followed every (computer tends to take its rules seriously, so no messing around). What is C? C is a general purpose programming language, developed sometime in the early 70's (it must be very good, why else would it be relevant even today). C is one of the most widely used programming languages of all time, and C compilers are available for the majority of available computers and operating systems. A C-program basically consists of the following parts:

24 Preprocessor Commands Functions Variables Statements & Expressions Comments Let us look at a simple code that would print the words "Hello World": #include <stdio.h> int main () { */this is my first program.im excited */ printf( Hello World\n ); return 0; } Let s now look at various aspects of this program: 1) The first line of the program #include <stdio.h> is called the preprocessor command. With this line of code we include a file called stdio.h (Standard Input/Output header file). This file lets us use certain commands for input or output which we can use in our program. (Look at it as lines of code commands) that have been written for us by someone else). For instance, it has commands for input like reading from the keyboard and output commands like printing things on the screen. Think of it this way, the compiler has a collection of books with it. But it would be difficult to carry all the books with it all the time. Right?? What we are doing with preprocessor command is giving it permission to carry the appropriate books with it, for it to refer them when necessary. So in our example, if we simply use printf function without including <stdio.h> header, the compiler doesn t know what printf means. Because we allowed it to carry the book called <stdio.h>, now it can understand the meaning of printf command. 2) The next line int main() is the main function where the program execution begins. Every program must have a main(). The int is what is called the return value (in this case of the type integer). 3) The next line is just a comment, it has nothing to do with the program. It's ignored by the compiler. It is a good practice to add comments as you write code, so that anybody else looking at the code can figure it out easily. 4) The next line is printf( Hello World ). The printf is a function used for printing things on the screen. It displays whatever's between the 2 doubles quotes as such (Hello World in this case). 5) Finally the return statement, terminates the function and returns a value (here there nothing to return so its 0).

25 So far you understood nothing right?? Well, I didn t expect you to. Programming may seem overwhelming at first, but trust me, all these will make sense as we go forward. Just tag along for now. 6.2 TOKENS IN C Tokens are the basic buildings blocks in C language, which are constructed together to write a C program (sorts of like words in English). We make code by combining these tokens in a meaningful fashion. C tokens are of six types. They are, 1. Identifiers (ex: i, j, k, sal, age etc.) Identifiers are the names you give for variables, functions, and labels in your program. The name we provide to a variable or a function, is used to identify it throughout the program. For example: int x = 10; Here x is the name or the identifier for the variable that stores the value Keywords (ex: int, while), They are the reserved words. They have special meaning. So they can't be used as identifiers. 3. Constants (ex: 10, 20), Their values can t be changed every time. 4. Strings (ex: total, hello ), They are basically words, like in english. Whatever's enclosed between is considered a string. 5. Special symbols (eg: (), {}), 6. Operators (eg: +, /, -, *), Consider an example: int main() { int x,y,total; x=10; y=50; total=x+y; printf( sum=%d\n,total); } All the tokens in this program are: main, int keyword x, y, total identifiers + operator 6.3 DATA TYPES

26 In computer programming, when you define a variable, you must also tell the compiler what type of data is to be associated with that variable. Data types are necessary because, unlike humans a computer can t differentiate between 1234 and abcd. The data type of the variable determines how many bytes of memory are dedicated to that variable, and what kind of data can be stored in the variable. Basic data types in C: 1. char: It is the most basic data type in C. It stores a single character and requires a single byte of memory in almost all compilers. char keyword is used to refer character data type. For example, A can be stored using char datatype. You can t store more than one character using char data type. 2. int: As the name suggests, an integer data type allows a variable to store numeric values. int keyword is used to refer integer data type. The storage size of int data type is 2 or 4 or 8 byte. It varies depend upon the processor in the CPU that we use. 3. float: It is used to store decimal numbers with single precision. We can use up-to 6 digits after decimal using float data type. float keyword is used to refer float data type. 4. double: It is also used to store decimal numbers with double precision. It allows us to use up-to 10 digits after decimal. double keyword is used to refer float data type. 6.4 OPERATORS In maths, +, -, /, *,! etc. are operators. Similarly, they exist in C programming also. All they do is perform operations. Example: x+y, x-y, x/10, y+x-100 C language offers many types of operators. They are: 1. Arithmetic operators: These are used to perform mathematical calculations like addition, subtraction, multiplication, division and modulus. (ex +, -, /, *, % etc.) 2. Assignment operators: These are used to assign the values for the variables in C programs. (ex =, +=, -= etc.) 3. Relational operators: These operators are used to compare the value of two variables. (ex >, <, == etc.) 4. Logical operators: These operators are used to perform logical operations on the given two variables. (ex &&, etc.) 5. Bit wise operators: These operators are used to perform bit operations on given two variables. (ex >>, <<, & etc.)

27 6. Conditional (ternary) operators: These operators return one value if condition is true and returns another value is condition is false. 7. Increment/decrement operators: These operators are used to either increase or decrease the value of the variable by one. 8. Special operators: &, *, sizeof( ) and ternary operators. 6.5 DECISION CONTROL The statements which are used to execute only specific block of statements in a series of blocks are called case control statements. There are 4 types of case control statements in C language. They are: 1. switch Switch case statements are used to execute only specific case statements based on the switch expression. syntax: switch (expression) { case label1: statements; break; case label2: statements; break; default: statements; break; }

28 2. break Break statement is used to terminate loops from the subsequent execution i.e. break statements ensure that the next case isn t executed once a case is executed. syntax: break; 3. continue Continue statement is used to continue the next iteration of for loop, while loop and dowhile loops. So, the remaining statements are skipped within the loop for that particular iteration. syntax: continue; 4. goto

29 goto statement is used to transfer the normal flow of a program to the specified label in the program. syntax: {. go to label;.. LABEL: statements; } 6.6 LOOP STATEMENTS Loop control statements in C are used to perform looping operations until the given condition is true. Control comes out of the loop statements once condition becomes false There are 3 types of loop control statements in C language. 1. for loop syntax: for (exp1; exp2; expr3) { statements; } exp1 variable initialization ( Example: i=0, j=2, k=3 ) exp2 condition checking ( Example: i>5, j<3, k=3 ) exp3 increment/decrement ( Example: ++i, j, ++k )

30 2. while loop syntax: while (condition) { statements; } where, condition might be a>5, i<10 etc.

31 For loop and while loop are very similar in sequence of execution. More often, for loop is the simpler choice and is used when the exact number of times the loop should run is known. 3. do while syntax: do { statements; }while (condition); where, condition might be a>5, i<10 etc.

32 The critical difference between the for/while loop and the do-while loop is that, in the dowhile loop is only after the code is executed. This means that the loop is executed at least once. 6.7 STRING Strings are nothing but array of characters ended with null character ( \0 ). This null character indicates the end of the string. Strings are always enclosed by double quotes. Whereas, character is enclosed by single quotes in C. Example: char string[12] = { h, e, l, l, o, w, o, r, l, d, 7, \0 }; (or) char string[12] = helloworld7 ;

33 (or) char string [ ] = helloworld7 ; Difference between above declarations is that when we declare char as string[12], 12 bytes of memory space is allocated for holding the string value. When we declare char as string[ ], memory space will be allocated as per the requirement during execution of the program. There are some predefined string functions available in C. They can be accessed by using #include<string.h> header file. Some of common string functions are: FUNCTION Strlen Strlwr Strupr Strcat Strcmp Strcpy Strdup Strchr Strset Strrev USE Finds length of a string Converts a string to lower case Converts a string to upper case Appends one string at the end of another Compares two strings Copies a string into another Duplicates a string Finds first occurance of a given character in a string Sets all characters of a string to a given character Reverses a string 6.8 FUNCTIONS A function is a set of statements that take inputs, do some specific computation and produces output. The idea is to put some commonly or repeatedly done task together and make a function, so that instead of writing the same code again and again for different inputs, we can call the function. Every C program has at least one function, which is main(), and all the most trivial programs can define additional functions. You can divide up your code into separate functions. How you divide up your code among different functions is up to you, but logically the division usually is so each function performs a specific task. The C standard library provides numerous built-in functions that your program can call. For example, function strcat() to concatenate two strings, function memcpy() to copy one memory location to another location and many more functions. To access these built in functions, you need their respective header files. Defining a Function: The general form of a function definition in C programming language is as follows:

34 A function definition in C programming language consists of a function header and a function body. Here are all the parts of a function: 1. Return Type: A function may return a value. The return type is the data type of the value the function returns. Some functions perform the desired operations without returning a value. In this case, the return type void is used. 2. Function Name: This is the actual name of the function. The function name and the parameter list together constitute the function signature. 3. Parameters: A parameter is like a placeholder. When a function is invoked, you pass a value to the parameter. This value is referred to as actual parameter or argument. The parameter list refers to the type, order, and number of the parameters of a function. Parameters are optional; that is, a function may contain no parameters. 4. Function Body: The function body contains a collection of statements that define what the function does. for example: Following is the source code for a function called max(). This function takes two parameters num1 and num2 and returns the maximum between the two: int max (int num1, int num2) { int result; if (num1 > num2) {result = num1; } else {result = num2;

35 } return result; } Calling a Function While creating a C function, you give a definition of what the function has to do. To use a function, you will have to call that function to perform the defined task. When a program calls a function, program control is transferred to the called function. A called function performs defined task and when its return statement is executed or when its functionending closing brace is reached, it returns program control back to the main program. To call a function, you simply need to pass the required parameters along with function name, and if function returns a value, then you can store returned value. for example: #include<stdio.h> int max(int num1,int num2); int main() { int a=100; int b=200; ret = max(a,b); printf( max value=%d,ret); return 0; } In our code we needed to find the maximum of two values a =100 and b =200. To perform the task we call the function max (which we have defined earlier) and pass our inputs (in this case there are 2 inputs a and b). We have also defined variable ret to be the output of whatever that happens inside the function max. The function treats a as num1 and b as num2 and performs its task. After finishing its task it returns it output as ret back to the our program. We can call this function as many times as we want. This chapter was added with the intention of giving absolute beginners (in programming) a brief introduction. All most all the programming language have these basic elements discussed previously. We chose to explain C program as it is the closest (rather a variation) to the Arduino programming which we require. This chapter s intention was never to teach you C Programming in depth. If you wish to learn C-programming further here are some resources that might help: Head first C: A brain friendly guide by Dawn & David Griffiths: 4. Objective C for dummies by Dan Gookin: Dan-Gookin/dp/ Let us C by Yaahavant Kanetkar: Science/dp/

36 Anyway, there is no shortage of C programming resources online if you do wish learn more.

37 7. PROGRAMMING THE ARDUINO The Arduino language is variation of C/C++ language. Unlike in proper C, many of the processes are automatically done behind the curtains. What we see outside is the simplified version. A descent knowledge in C/C++ will make it very easy to program an Arduino. Having said that, there s no need to worry, you ll be fine even without any prior knowledge in programming. Programming an Arduino is a piece of cake and you can make sense of it very easily (Refer the last chapter if you are completely new to programming). In this chapter, let s try to program our Arduino. Arduino programs can be divided in three main parts: structure, values (variable + constants) & functions. 7.1 STRUCTURE 1. setup(): Every Arduino program begins with setup() function. It's similar to main() in C. The setup() function is called, every time the reset button is pressed. We assign pins as inputs or outputs inside the setup() function Example: int x = 3; void setup() { Serial.begin(9600); pinmode(x, INPUT); }.. 2. loop(): The loop() function, as its name suggests runs over and over a set of statements written inside it. In the loop() function, we make the pins defined inside the setup function do things. For example, we can set pins as high, low, read values from pins etc. We code all these inside the loop() function Example:... void loop() { if (digitalread(x) == LOW) Serial.write('A'); else Serial.write('B');

38 delay(1000); } 7.2 CONSTANTS 1. HIGH/LOW: HIGH and LOW are the terms used to define the state of a pin in the Arduino when configured as an input or an output. When a pin is configured as an INPUT pin, we can read values from a pin or rather the sensor connected to pin. The microcontroller will report HIGH if a voltage greater than 3 volts is present at the pin Similarly, when a pin is configured as an OUTPUT pin, we can set the pin to HIGH or LOW state. In this case HIGH means 5V and LOW means 0V. 2. INPUT/OUTPUT: When a pin is configured as an INPUT pin, we can read values from the sensor connected to pin. Arduino pins are configured as INPUT with pinmode(). In this state they can t power any circuits. when a pin is configured as an OUTPUT pin, we can decide the state of the pin (HIGH or LOW). Arduino pins are configured as OUTPUT with pinmode(). In this state they can be used to power other circuits (like an LED for instance) 3. LED_BUILTIN: As already mentioned, Arduinos have a built in LED (attached to pin 13 in UNO). Instead of manually declaring the pin by a variable name (like x or pin13 or led) LED_BUILTIN is a pre-defined replacement. (YES, I KNOW.IT S STUPID RIGHT??) 7.3 FUNCTIONS Functions in Arduino programming are no different from those in C programming. Most of the commonly used functions in Arduino programming are predefined and can be accessed by using the proper headers. There is seldom any chance that we have to define functions by ourselves, in our code for Arduino. Commonly used Functions in Arduino programs are: 1. pinmode(): This function is used to configure a pin as an input or output pin. Syntax: pinmode(pin, mode)

39 Example: int x =13 void setup() { pinmode(x,output); } 2. digitalwrite(): This function is used to a set a value (HIGH/LOW or 5V/0V) to a digital pin configured as an Input. Syntax: digitalwrite(pin, value) Example:... void loop() { digitalwrite(x,high); } The analog input pins can be used as digital pins, referred to as A0, A1, etc. 3. digitalread(): This function is used to read values (HIGH or LOW) from a digital pin configured as an Output. Syntax: digitalread(pin) Example: void loop() { x=digitalread(inpin); digitalwrite(ledpin,x); } 4. analogreference(): This function is used to configure the reference voltage for analog input. (maximum input value) Syntax: analogreference(type) Type can be: DEFAULT: the default analog reference of 5 volts (on 5V Arduino boards) INTERNAL: an built-in reference, equal to 1.1 volts EXTERNAL: the voltage applied to the AREF pin (0 to 5V only) is used as the reference.

40 5. analogread(): This function is used to read values from an analog pin. Syntax: analogread(pin) Example: void loop() { y = analogread(analogpin); //analogread values go from 0 to 1023 Serial.println(y); } 6. analogwrite(): This function is used to write an analog value (value in between 0V and 5V) to a pin. Syntax: analogwrite(pin, value) Example: void loop() { val = analogread(analogpin); analogwrite(ledpin, val / 4); //analogwrite values from 0 to 255 } 7. tone(): This function is used to generate a square wave of specified frequency Syntax: tone(pin, frequency, duration) The function notone() is used to stop the wave generated by tone(),incase duration is not specified. 8. delay(): This function is used to pause the program for specified amount of time (in milliseconds) Syntax: delay(ms) 9. Serial.print(): This function is used to print data on the serial monitor (More details in chapter 11)

41 Syntax: Serial.print(val) There are many more inbuilt Arduino functions that can be accessed by using the including the appropriate header file. For example, servo.write() can be used for servo motors with <servo.h> header file. We will learn about these functions as we interface Arduino with sensors and other devices.

42 8. SETTING UP THE ARDUINO 1. Firstly download the appropriate IDE for your Operating system (Windows, Mac OS X, Linux): DOWNLOAD. 2. Extract the zip file and install the Arduino IDE. 3. Connect the B type end of USB cable to Arduino UNO, and the other end to the computer/laptop USB port. Windows will try to install drivers, but will fail.

43 4. Open the control panel and go to device manager. The Device Manager will display the Arduino under Ports (COM & LPT) or Other devices. 5. Right-click the Arduino board and then click Update Driver Software on the popup menu.

44 6. The Update Driver Software dialog box will pop up. Click Browse my computer for driver software.

45 7. Click the Browse Button. Navigate to the drivers folder in the Arduino folder that you downloaded.

46

47 8. Click the Next Button. In the dialog box that pops up, click Install this driver software anyway. 9. Installation will finish soon. Do note the COM port number (we need it later).

48 10. Open the Arduino IDE and navigate to Tools >Board and select the appropriate board (Arduino Uno in this case). 11. Now check that the correct serial port is selected and change if necessary. This is the serial port that you took note of after installing the Arduino driver.

49 12. To test if everything is working well, upload the Blink sketch under examples. If things go well, the on-board LED should start blinking.

50

51 Now the headache is over. Now you can write your desired program to the Arduino.

52 9. LED BLINK Having dealt with the hard stuff, now it s time for some fun. It s time for your first Program. Let s blink some LED s. Things you will need: Arduino UNO Breadboard LED 100 Ohm Resistor Circuit

53 Here are the connections for each part: LED positive to Resistor one end. Resistor other end to Arduino D10. LED negative to Arduino GND. Code //LED blinker int ledpin = 10; //pin 10 is named ledpin void setup() { pinmode(ledpin, OUTPUT); //initialise the digital pin as output } void loop() { digitalwrite(ledpin, HIGH); //turn on led(high state) delay(1000); //wait for 1000ms = 1 second digitalwrite(ledpin, LOW); //turn off led(low state) delay(1000); //wait for 1000ms or 1 second } Now you can click the upload icon, Arduino IDE will compile the sketch and upload into Arduino UNO connected to your computer (if there is no error). You will just have to wait until the message box say Upload Done. That s it, the LED will Blink at 1 second rate. Do try this same experiment with different delay times (say turn on for 2 sec, turn off for 1 sec).

54 10. MULTI LED BLINK Last experiment went well, so now we will up the ante. Now let s make 5 more LED's blink, in a sequence. Things you ll need Arduino UNO LED x ohm Resistors x 6 Bread Board wires Circuit

55 Here are the connections for each part: LED s positive to Resistor one end. Resistor s other end to Arduino D2, D3, D4, D5, D6, D7. LED s negative to Arduino GND. Code //Multi LED Blink void setup() { for (int led = 2; led < 8; led ++) { pinmode(led,output); //instead of using a for loop, all pins can be intialised one after the other } } void loop() { for (int led = 2; led < 8; led ++) { digitalwrite(led, LOW); } for (int led = 7; led >= 2; led --) { digitalwrite(led, HIGH); delay(500); digitalwrite(led, LOW); } }

56

57 11. SERIAL COMMUNICATION What is serial Communication? Serial may sound like a tasty breakfast food, but it s actually quite different. The word serial means "one after the other." For example, a serial killer doesn't stop with one murder, but stabs many people one after the other. Serial data transfer is when we transfer data one bit at a time, one right after the other. Serial communication is used for communication between the Arduino board and a computer or other devices (like Raspberry Pi for example). Serial communication is based on the binary system (0's and 1's).The Arduino sends these 1s and 0s (bits) one by one. These bits are sent in the form of Highs(1) and Lows(0), 8 of these bits together form one byte. Serial communication can be done either through digital pins 0(RX),1(TX)or through the USB cable. We have used quite a bit of Serial communication already. that's how we send sketches to the Arduino! When you Compile what you're really doing is turning the sketch into binary data (ones and zeros). When you Upload it to the Arduino, the bits are shoved out one at a time through the USB cable to the Arduino where they are stored in the main chip.

58 Next time you upload a sketch, look carefully at the two LEDs near the USB connector, they'll blink when data is being transmitted. One blinks when the Arduino is receiving data (RX) and one blinks when the Arduino is transmitting data (TX) In many cases while using an Arduino, you will want to see the data being generated by the Arduino. Arduino IDE has a built in serial monitor that allows you to both send messages from your computer to the Arduino board (over USB) and also to receive messages from the Arduino.

59 To start Serial Communication, use the command Serial.begin(9600) in the setup(). The value 9600 is called the 'baud rate' of the connection. This is how fast the data is to be sent (leave it at 9600). Now let s try out this serial thing in action. Let s try out some code that will make the Arduino echo anything you send to it. Therefore, if you type a 5, the Arduino will send back a 5. If you type a letter D, the Arduino will send back a letter D. Code byte byteread; void setup() {// Turn the Serial Protocol ON Serial.begin(9600); } void loop() { if (Serial.available()) //checks if data has been sent from the computer { byteread = Serial.read(); //reads the most recent byte Serial.write(byteRead); //returns back the value that was read, back to the serial port } } There is one other function that we often use when using serial monitor: Serial.println(). It is used to print data to the serial port as human readable text. It is often used to view analog sensor readings (which we do in coming chapters). Serial.print() is essentially the same function, just that it prints next data in the same line, while Serial.println() function prints new data in the next line.

60 12. INTERFACING SERVO MOTOR WITH ARDUINO What is Servo Motor? A servo motor is basically a DC motor along with some other special purpose components. In a servo unit, you will find a small DC motor, a potentiometer, gear arrangement and an intelligent circuitry. Unlike a normal dc motor, a servo motor doesn t spin continuously. Rather it can only move from 0 0 to What makes a servo motor so useful is that, we can precisely control its shaft position, we can rotate it to 10 0 or 45 0 or anything. Servo motors are an absolute favourite for hobbyists and robotics enthusiasts.

61 Servo motor with Arduino A servo motor has 3 pins: Power (Red), Ground (Black) and Control (Yellow or orange)

62 Now let s try a program to control the position of a servo motor using Arduino. Circuit Plug in the control wire of the servo motor into one of the PWM pins. Here are the connections for each part: Code Servo VCC to Arduino 5V. Servo GND to Arduino GND. Servo control pin to Arduino D9. //When using servo motor, you need to use include <Servo.h> header include <Servo.h> Servo servomain; // Define the Servo, named it servomain void setup() { servomain.attach(9); // servo on digital pin 9 } void loop() { servomain.write(45); // Turn Servo Left to 45 degrees delay(1000); // Wait 1 second servomain.write(0); // Turn Servo Left to 0 degrees

63 delay(1000); // Wait 1 second servomain.write(90); // Turn Servo back to center position (90 degrees) delay(1000); // Wait 1 second servomain.write(135); // Turn Servo Right to 135 degrees delay(1000); // Wait 1 second servomain.write(180); // Turn Servo Right to 180 degrees delay(1000); // Wait 1 second servomain.write(90); // Turn Servo back to center position (90 degrees) delay(1000); // Wait 1 second } //End of Code Buy Here: Servo_Motor Buy Here: MiniServo_Motor More Servo projects:

64 13. INTERFACING LCD WITH ARDUINO LCD displays that are compatible with the Hitachi HD44780 driver (the ones with 16 pin interface), can be interfaced with Arduino. The LCDs have a parallel interface, meaning that the microcontroller has to manipulate several interface pins at once control the display. The interface consists of the following pins: 1. register select (RS) pin: This pin that controls where in the LCD's memory you're writing data to. You can select either the data register, which holds what goes on the screen, or an instruction register, which is where the LCD's controller looks for instructions on what to do next. 2. Read/Write (R/W) pin: This pin is used to select between reading mode or writing mode. 3. Enable pin: It enables writing to the registers data pins (D0 -D7). The states of these pins (high or low) are the bits that you're writing to a register when you write, or the values you're reading when you read. 5. There's also a display contrast pin(vo), power supply pins (+5V and Gnd) and LED Backlight (Bklt+ and BKlt-) pins that you can use to power the LCD, control the display contrast, and turn on and off the LED backlight, respectively.

65 Now let s try display something on the LCD using Arduino. Things you will need Arduino LCD Screen (compatible with Hitachi HD44780 driver) pin headers to solder to the LCD display pins 10k ohm potentiometer wires breadboard Circuit Here are the connections for each part: LCD VCC to Arduino 5V. LCD GND to Arduino GND.

66 Code LCD R/W to Arduino GND. LCD D7 to Arduino D2. LCD D6 to Arduino D3. LCD D5 to Arduino D4. LCD D4 to Arduino D5. LCD E to Arduino D11. LCD RS to Potentiometer Mid terminal. #include <LiquidCrystal.h> //when using LCD, you need to use include <LiquidCrystal.h> header // initialize the library by associating any needed LCD interface pin // with the arduino pin number it is connected to const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2; LiquidCrystal lcd(rs, en, d4, d5, d6, d7); void setup() { lcd.begin(16, 2); // It tells the Arduino that the display is a 16x2 type // Print a message to the LCD lcd.print("hello, world!"); } void loop() { // set the cursor to column 0, line 1 // (note: line 1 is the second row, since counting begins with 0) lcd.setcursor(0, 1); // print the number of seconds since reset lcd.print(millis()/1000); } //End of Code

67 Buy Here: LCD_Display More Display projects:

68 14. INTERFACING LDR WITH ARDUINO What is an LDR? The LDR / Photo-resistor is basically a very simple light sensor that changes its resistance with light, lowering with more light. You can find these used in everything from the furby to automatic night lights and things like that. The LDR isn t very precise, so you can t get a quantitative LUX reading or anything like that. But it is good enough to tell the difference between light and shadow, or know if the light in your room is on/off. So if you just need to know if the light in the room has changed, or someone walked by (casting a shadow) this is your part. The LDR changes its resistance with light so we can measure that change using one of the Arduino s analog pins. But to do that we need a fixed resistor that we can use for that comparison (We are using a 10K resistor). This is called a voltage divider and divides the 5v between the LDR and the resistor. Then we measure how much voltage is on the LDR using the analog read on your Arduino, and we have our reading. The amount of that 5V that each part gets is proportional to its resistance. With the Arduino analogread, at 5V (its max) it would read 1023, and at 0v it read 0. So if the the LDR and the resistor have the same resistance, the 5V is split evenly (2.5V), to each part. (analogread of 512) Circuit

69 Here are the connections for each part: Code LDR terminal to Arduino A0. LDR terminal to Arduino GND. Resistance terminal to Arduino 5V. Resistance terminal to Arduino A0. int LDR_Pin = A0; //analog pin 0 void setup() { Serial.begin(9600); } void loop(){ int LDRReading = analogread(ldr_pin); Serial.println(LDRReading); delay(250); //just here to slow down the output for easier reading } //End of code Buy Here: LDR_

70 15. INTERFACING RELAY MODULE WITH ARDUINO Relays are very important electronic devices, it allows you to turn on and off a wide range of devices, both AC and DC. A relay is a simple electromechanical switch made up of an electromagnet and a set of contacts. It functions exactly like a normal switch, except that you can don t have to physically turn it on. Instead a relay switch can be turned on or off by providing signals(voltage). This makes it easier to automate stuff. A relay can be used in a lot of different ways for home automation projects. NC- normally closed NO- normally open C- common The working of a relay is very simple actually. When a current of sufficient magnitude, is passed through the coil, the latch gets attracted to the center of the coil (towards NO) and the circuit C-NC is opened (at the same time circuit C-NO will be closed). However, a relay is not directly used with the Arduino, as the Arduino can t provide sufficient magnitude current to trigger the relay. So current amplification needs to be done. This problem is overcome by using relay modules (available in sets of 4, 8, 12 etc.). They have inbuilt amplification mechanism, so we can connect it directly to an Arduino.

71 Now let s try an experiment. Let s try to switch on and off a 230V light (or any other devices) automatically after a fixed interval of time. Note: Be careful when you try this experiment as we are dealing with 230V supply. Ensure that the connections are made correctly. Things you will need Arduino Relay Module Wires 230V AC appliance (Bulb)

72 Circuit

73 Here are the connections for each part: Code Relay module VCC to Arduino 5V. Relay module GND to Arduino GND. Relay module IN1 to Arduino D6. Relay module IN2 to Arduino D7. Relay module IN3 to Arduino D8. Relay module IN4 to Arduino D9. // define names for the 4 Digital pins On the Arduino 7,8,9,10 // These data pins link to 4 Relay board pins IN1, IN2, IN3, IN4 int relay1 = 6; int relay2 = 7; int relay3 = 8; int relay4 = 9; void setup() { // Initialise the Arduino data pins for OUTPUT pinmode(relay1, OUTPUT); pinmode(relay2, OUTPUT); pinmode(relay3, OUTPUT); pinmode(relay4, OUTPUT); } void loop() { digitalwrite(relay1,low); // Turns ON Relays 1 delay(2000); // Wait 2 seconds digitalwrite(relay1,high); // Turns Relay Off digitalwrite(relay2,low); // Turns ON Relays 2 delay(2000); // Wait 2 seconds digitalwrite(relay2,high); // Turns Relay Off // This code is to control the devices (bulbs) connected to pins 6 and 7 // Similar code can be written to control other relays too } //End of Code Buy Here: 4Channel_Relay Buy Here: 8Channel_Relay More Relay projects:

74 16. INTERFACING ULTRASONIC SENSOR WITH ARDUINO What is an Ultrasonic sensor? Ultrasonic sensors work on a principle similar to radar, which evaluate attributes of a target by interpreting the echoes from radio or sound waves respectively. Active ultrasonic sensors generate high frequency sound waves and evaluate the echo which is received back by the sensor, measuring the time interval between sending the signal and receiving the echo to determine the distance to an object. Ultrasonic sensors are perfect for making obstacle avoiding robots.

75 HC-SR04 has 4 pins: 1. Vcc pin 2. GND 3. trig pin (Input) 4. echo pin (Output) Let s make a circuit to measure the distance between the Arduino setup and a solid object using the Ultrasonic sensor. Things you will need Arduino HC-SR04 Ultrasonic sensor Bread board Wires Circuit

76 Here are the connections for each part: Code Ultrasonic VCC to Arduino 5V. Ultrasonic GND to Arduino GND. Ultrasonic TRIG to Arduino D8. Ultrasonic ECHO to Arduino D7. int trigpin = 11; //trig pin is connected to Arduino pin 11 int echopin = 12; //trig pin is connected to Arduino pin 12 long duration, distance; //long is a data type void setup() { Serial.begin (9600); pinmode(trigpin, OUTPUT); pinmode(echopin, INPUT); } void loop() { digitalwrite(trigpin, LOW); // Clears the trigpin delaymicroseconds(2); // Sets the trigpin on HIGH state for 10 micro seconds digitalwrite(trigpin, HIGH); delaymicroseconds(10); digitalwrite(trigpin, LOW); // Reads the echopin, returns the sound wave travel time in microseconds duration = pulsein(echopin, HIGH); // Calculating the distance distance= duration*0.034/2; // Prints the distance on the Serial Monitor Serial.print("Distance: "); Serial.println(distance); } //End of Code Ultrasonic sensors are perfect for making obstacle avoiding robots. Buy Here: Ultrasonic_sensors More Ultrasonic projects:

77 17. INTERFACING PIR SENSOR WITH ARDUINO What is a PIR sensor? PIR (Passive Infrared sensors) sensors are small, inexpensive, low-power sensors that allow you to sense motion. PIRs are basically made of a pyroelectric sensor, which can detect levels of infrared radiation. Everything object emits some low level radiation, and the hotter it is, the more radiation is emitted.

78 Let s make a motion detector using PIR sensor. Circuit Here are the connections for each part: PIR sensor VCC to Arduino 5V. PIR sensor GND to Arduino GND. Buzzer positive to Arduino D12. Buzzer positive to Arduino GND. PIR sensor output to Arduino D2. Once motion is detected, the PIR motion sensor will send a voltage signal to Digital pin 2 of the Arduino. As soon as the Arduino detects this signal, it will turn on the buzzer(1.5-3v) connected to Digital pin 12 on the Arduino.

79 Code //code for motion detector alarm circuit int buzzerpin= 12; int inputpin= 2; void setup() { pinmode(buzzerpin, OUTPUT); pinmode(inputpin, INPUT); } void loop() { int value= digitalread(inputpin); if (value == HIGH) { digitalwrite(buzzerpin, HIGH); } } //End of Code For many basic projects that requires to detect, whether a person has left or entered a room, PIR sensors are a great choice. Buy Here: PIR_Sensor More PIR projects:

80 18. INTERFACING JOYSTICK MODULE WITH ARDUINO Joysticks are a great way to control your Robots. The thumbstick is analog and should provide more accurate readings than simple directional joysticks that use some forms of buttons, or mechanical switches. Additionally, you can press the joystick down to activate a press to select push-button. The Joystick module has 5 pins: 1. Vcc 2. Ground 3. X 4. Y 5. Key We have to use analog Arduino pins to read the data from the X/Y pins, and a digital pin to read the button. The Key pin is connected to ground, when the joystick is pressed down, and is floating otherwise.

81 Circuit Here are the connections for each part: Code Joystick VCC to Arduino 5V. Joystick GND to Arduino GND. Joystick VER to Arduino A0. Joystick HOR to Arduino A1. Joystick SEL to Arduino D2. int xpin = A1; //Read movement in x direction int ypin = A0; //Read movement in y direction int buttonpin = 2; int xposition = 0; int yposition = 0; int buttonstate = 0; void setup() { Serial.begin(9600); pinmode(xpin, INPUT); pinmode(ypin, INPUT);

82 pinmode(buttonpin, INPUT); digitalwrite(buttonpin, HIGH); } void loop() { xposition = analogread(xpin); //variable xposition reads value in x direction yposition = analogread(ypin); //variable xposition reads value in y direction buttonstate = digitalread(buttonpin); Serial.print("X: "); Serial.print(xPosition); Serial.print(" Y: "); Serial.print(yPosition); Serial.print(" Button: "); Serial.println(buttonState); delay(100); // add some delay between reads } //End of Code Buy Here: Joystick_Module

83 19. INTERFACING IR SENSOR (TSOP1738) WITH ARDUINO Remote controls are one of the commonly found devices in almost all homes. They help us operate appliances like TV, Air Conditioning, etc. The main feature of a remote control is that it is specific to a device. For example, a TV remote control unit can only be used for that corresponding TV. Why is it so? What is a TSOP1738 Sensor? TSOP 1738 is an Infrared receiver module widely used in remote control applications including TV. It is a versatile sensor that receives the coded Infrared pulses from the transmitter and directs the functions of the device. TSOP 1738 sensor is designed to receive IR rays pulsating in the 38 KHz and hence the number There is a PIN Photodiode inside the module which is the receiver of the Infrared rays from the transmitter. Normally when it is in the ideal state without receiving the IR rays, it produces an output of 5 volts and when the module receives, IR rays, it sinks current and output turns low to zero volts. According the coded IR pulses from the remote, the output of the sensor turns low and high alternately. The speed of this transition depends on the bandwidth of the coded pulses. By interfacing the TSOP1738 module with the Arduino, we can decode the code corresponding to each button on your remote control and hence use the remote control to

84 control whatever we want. First let s decode an IR remote handset (any that you have), then we will turn on and off an LED with our remote handset. Things you will need Arduino TSOP1738

85 Breadboard LED Connecting wires Any IR remote Decoding IR Remote control Circuit To use TSOP module with Arduino board, we need external IRremote library: Download. Then open up the Arduino IDE and on the menu select Sketch>IncludeLibrary>Add Library and select the 'IRremote' folder. This is a one time thing, so you don t need to do this every time you use the TSOP module.

86 Code #include <IRremote.h> int RECV_PIN = 11; IRrecv irrecv(recv_pin); decode_results results; void setup() { Serial.begin(9600); irrecv.enableirin(); // Start the receiver } void loop() { if (irrecv.decode(&results)) { Serial.println(results.value, HEX; irrecv.resume(); // Receive the next value } } // End of Code Now open the Serial Monitor and press the Remote handset buttons. Values will be displayed corresponding to each button, Note it down.

87 Here the hex value C2C4 is for button 1 and hex value C244 is for button 2. This way we can decode every button on Remote handset. Controlling LED with Remote handset Circuit Here are the connections for each part: Code TSOP1738 VCC to Arduino 5V. TSOP1738 GND to Arduino GND. TSOP1738 Output to Arduino D3. LED positive to Arduino D9. LED negative to Arduino GND. #include <IRremote.h> int RECV_PIN = 3; //declared for receiving pulses IRrecv irrecv(recv_pin); decode_results results;

88 void setup() { pinmode(9, OUTPUT); Serial.begin(9600); irrecv.enableirin(); } // Start the receiver void loop() { if (irrecv.decode(&results)) { Serial.println(results.value); irrecv.resume(); // Receive the next value if(results.value==c2c4) //Use the value you obtained for button1 { digitalwrite(9,high); } else if (results.value==c244) //Use the value you obtained for button2 { digitalwrite(9,low); } } } //End of Code Buy Here: TSOP1738_Sensor

89 20. ARDUINO PROJECT 1: DIGITAL THERMOMETER Till now, we have learnt how to program an Arduino, how to interface different sensors with Arduino. There are many other sensors that can be used with Arduino (one s that operate at 5 or 3.3V). These sensors can be interfaced with the Arduino in the same way we have done so far. Now it s time to take a plunge and try out some proper projects, that involve using more than one sensor, output devices at the same time. Our first project is a digital thermometer. This project shows an interesting way to read temperature from the environment with the Arduino, and shows it on a LCD 16x2 display (in Fahrenheit), by using some elements from its programming and the temperature sensor.

90 Things you will need Arduino Uno 16 x 2 LCD 10K potentiometer LM35 Temperature sensor Connecting Wires The LM35 is an integrated circuit sensor that can be used to measure temperature with an electrical output proportional to the temperature (in o C). The scale factor is.01v/ o C.

91 Circuit Here are the connections for each part: Code LCD VCC to Arduino 5V. LCD GND to Arduino GND. LCD R/W to Arduino GND. LCD D7 to Arduino D2. LCD D6 to Arduino D3. LCD D5 to Arduino D4. LCD D4 to Arduino D5. LCD E to Arduino D11. LCD RS to Potentiometer Mid terminal. Temperature Sensor VCC to Arduino 5V. Temperature Sensor GND to Arduino GND. Temperature Sensor output to Arduino A0. #include <LiquidCrystal.h> // Include the library to use a LCD display #define sensor 0 // Define the A0 pin as sensor int Vin; // Variable to read the value from the Arduino s pin float Temperature; // Variable that receives the converted voltage value to temperature float TF; // Variable to receive the converted value from 0 C to 0 F

92 LiquidCrystal lcd (12, 11, 5, 4, 3, 2); // The function above declares which Arduino s pins will be used for controlling the LCD void setup() { lcd.begin(16,2); // It tells the Arduino that the display is a 16x2 type lcd.print("temperature: "); // Send the text to the screen of the display. } void loop() { Vin = analogread (sensor); // Tells the Arduino to read the pin and stores the value in Vin Temperature=(500*Vin)/1023; // Converts the voltage value into temperature and stores it into the Temperature variable (in 0 C) TF = ((9*Temperature)/5)+32; // Converts 0 C to 0 F lcd.setcursor(0, 1); // Moves the cursor of the display to the next line lcd.print(tf); // Exhibits the value of the temperature on the display lcd.print(" F"); // Writes F to indicate that it is in Fahrenheit scale. delay(1000); // Waits for a second to read the pin again } //End of Code The conversion step in the code can be avoided to get the reading in 0 C. Output

93 21. ARDUINO PROJECT 2: SMART CANE FOR VISUALLY IMPAIRED It is a real challenge for visually impaired people to cross busy streets and most times they have to depend on others to do so. Using this Arduino Smart Cane, a visually impaired person can walk without anyone s help. The cane can automatically detect the obstacle in front of the person and give them a feedback response by vibrating the walking stick and giving a warning sound. Through this tool, the blind person thus be aware of the obstacles in front of them. Things you will need Arduino uno. Ultrasonic sensor (HCSR04). breadboard. 9 volt battery. 9 volt battery connector. DC male power jack. Buzzer. Some jumper wires. A broken cellphone (for the vibration motor). Toggle switch. Other tools needed 3/4 inch diameter PVC pipe and PVC elbow. (You can use make this out of a wooden cane too) Insulation tape.

94 Some small screws for mounting Arduino. Screwdriver. Utility knife. Instant adhesive Glue. A Box to put your Arduino and other electronics. The technology behind the Arduino Smart Cane is pretty straight forward. There are mainly three blocks behind it: input, controller (Arduino), and output. The input consists of an ultrasonic sensor that is capable of detecting obstacles in front of it at a range of up to 400cm. It is interfaced to the Arduino which determines if an obstacle is too close to the cane and triggers the output if it is. The output consists of a vibration motor to provide haptic response and a piezo buzzer. Salvaging the Vibration motor from a cell phone After finding a broken cell phone, we need to remove the vibration motor from it. You will have to do this step with care and patience. A micro vibrator motor from an old broken cell phone is perfect because of its very small size and also it works with low voltages.

95 Please note: different cell phones have different vibrator motors (in size and shape). Now solder the motor on a small piece of general purpose PCB. Then solder two wires to the terminals of the motor like shown in the above images.

96 Circuit Here are the connections for each part: Ultrasonic VCC to Arduino 5V. Ultrasonic GND to Arduino GND. Ultrasonic TRIG to Arduino D12. Ultrasonic ECHO to Arduino D11. Buzzer RED to Arduino D8. Buzzer BLACK to Arduino GND. Vibrator motor pin 1 to Arduino D7. Vibrator motor pin 2 to Arduino GND 9 volt battery RED to Toggle switch pin 1. 9 volt battery BLACK to DC male power jack(-). Toggle switch pin 2 to DC male power jack (+).

97 Code #define trigpin 13 #define echopin 12 #define motor 7 #define buzzer 6 void setup() { pinmode(trigpin, OUTPUT); pinmode(echopin, INPUT); pinmode(motor, OUTPUT); pinmode(buzzer,output); } void loop() { long duration, distance; digitalwrite(trigpin, LOW); delaymicroseconds(2); digitalwrite(trigpin, HIGH); delaymicroseconds(10); digitalwrite(trigpin, LOW); duration = pulsein(echopin, HIGH); distance = (duration/2) / 29.1; if (distance < 70) // Checking the distance, you can change the value { digitalwrite(motor,high); // When the the distance below 100cm digitalwrite(buzzer,high); } else { digitalwrite(motor,low);// when greater than 100cm digitalwrite(buzzer,low); } delay(500); } //End of Code Attaching the Components on the Smart Cane This is the least fun part of this project. Find a box that you can use to put all your electronics together.

98 Fix your Arduino in the box using screws. Now make two holes for fixing the Ultrasonic sensor on the lid of the box as shown in the above image. Fix the buzzer outside the box for better sound. Next, attach the toggle switch at the side of the box and make a small hole for connecting the vibration motor to the Arduino. Fix the battery inside of the box and connect the power jack to the Arduino. Now attach the box to the walking stick using glue or pvc clamps.

99 22. ARDUINO PROJECT 3: ROBOTIC HAND In this project, we'll make a low cost Robotic hand that can replicate the movements of our hand. Sounds hard right?? Not really Things you will need Arduino UNO servo motors(sg90) x 5 Flex sensor x 5 2.2K resistance x 5 Materials to build robotic hand Tubes Glue Paper Wire Glove etc Flex sensor are inserted on the fingers of a glove. The idea for this project is very simple. The Flex sensors are small flexible rods that indicate the amount of bending to which they are subjected. Attaching them to the fingers of a glove you can detect the exact movement of each finger. Values of these sensors are obtained in real time and servo motors are made to move accordingly, pulling a wire connected to each finger of the robotic hand.

100 Circuit The flex sensors must be connected to Arduino with resistors as in the figure. Inserting a resistance of 2.2 K ohms, sensor reading will be 50 if the sensor is not bent, and equal to 90 if the sensor is flexed fully. if the sensor is bent in the opposite direction. if you use another type of resistance these values will be different. But that range does not always give best. So it is a good idea to try flexing the glove and view the values in serial monitor before deciding the range.

101 The sensor sends a value between 90 and 10. The motor needs a value between 0 and 180. To make the motor move proportional to value obtained from sensor, we can use map() function. Ex: value = map (value, 90, 10, 0, 179); Circuit Make the connections for sensors as shown.

102 After making the connections, attach these sensors on top of the glove (one on each finger). Make these connecting wires light and long as possible.

103 Now for the robotic hand. Making the hand is the hardest part of the entire project. The aim is to create a hand with fingers connected to strings. When the motor pulls the string, the finger bends. Either you can buy a robotic hand or take apart a toy hand and get those fingers, or you can 3d print them. Make a wooden or plastic frame and fix the 5 servo motors on them.

104 Make the connections for the servo motors.

105 Make the same connection for all the 5 sensors. Code #include <Servo.h> Servo servothumb; Servo servoindex; Servo servomidf; Servo servoring; Servo servopinky;

106 int thumb; int index; int midfngr; int ring; int pinky; void setup () { Serial.begin (9600); servothumb.attach (9); servoindex.attach (10); servomidf.attach (11); servoring.attach (12); servopinky.attach (13); } void loop () { thumb = analogread (A0); index = analogread (A1); midfngr = analogread (A2); ring = analogread (A3); pinky = analogread (A4); thumb = map (thumb, 20, 40, 0, 179); //as mentioned it s best to find out the sensor range urself index = map (index, 20, 40, 0, 179); midfngr = map (midfngr, 20, 40, 0, 179); ring = map (ring, 20, 40, 0, 179); pinky = map (pinky, 20, 40, 0, 179); servothumb.write (thumb); servoindex.write (index); servomidf.write (average); servoring.write (road); servopinky.write (little finger); delay (150); } //End of Code

107 23. ARDUINO PROJECT 4: 4 x 4 x 4 LED CUBE This is a fun project using Arduino and some LED's. At the end of this project, you'll have a whole new respect for LED's. Things you will need Arduino 64 LEDs 100 OHM Resistors x 4 Pin Header Slide Switch Wire Craft Wire Perf Board (dot type PCB) Project Box ( a cardboard box will do) 9V Power Supply

108 Tools you will need Drill 1/16" Drill Bit 5/16" Drill Bit Knife Straight Edge Needle Nose Pliers Soldering Iron Solder Hot Glue Gun Making the LED jig First, Draw a 4x4x4 LED cube template (similar to the one, given in the figure). Then print out 4x4x4 LED Cube Template and paste it to a cardboard box. Make sure that the printing settings are set to actual size and landscape orientation. Next, punch out all 16 LED holes (at points marked) using a pencil. Insert a LED into the individual holes to test the fit.

109 Making the LED cube 1. Take the 64 LEDs and test them to ensure that they all work using a button cell battery. This may sound tedious but in the end this will save from a lot of frustration. 2. Next, insert 16 LEDs into the holes and bend the leads to the direction of the arrows using needle nose pliers. The arrows that make up the square represent the positives (anodes)and the arrows projected outside the square represent the negatives(cathodes). 3. Solder all of the positive leads together and trim off the access of the leads. Now, you might have noticed that there are two gaps in the layer of the positive leads. This can be solved by straightening a length of craft wire by pulling both ends of the wire with pliers and trimming two 1" sections that are then soldered in place. 4. After soldering all these, flip the box over and start pushing the tips of the LEDs out of the holes in the jig. Make sure to do this evenly to avoid bending or damaging the layer structure. Now your first LED layer is finished!

110 5. Repeat the same and make 3 more layers.

111 6. Next, take the four LED layers and solder the negative leads together by stacking the individual layers on the top of each other. Start by soldering the leads in the centre, then work out to the leads on the edge. The 4x4x4 LED cube is starting to take shape! 7. Straighten another length of craft wire and cut and bend four sections that will later connect the four layers to the perf board. Finally, solder them in place. Installing The LED Cube 1. Start by marking an outline of a square with a marker. Use a straight edge and a knife to score the outline along the lines, then break off the access material by placing the perf board in a vice or on the edge of a table, then apply pressure till the scored sides snap off. 2. Drill 20 holes with a 1/16" drill bit for the leads on the top of the project box. An easy way of doing this is by marking the holes where the leads poke out of the perf board and then taping the board to the top of the project box. 3. Mark the 20 holes on the top of the box through the board with a sharpened pencil. Take the perf board off and drill where the markings are on the project box. Then glue the perf board inside of the box with some hot glue. Make sure that all 20 holes line up with the holes on the perf board.

112 4. Next install the LED cube by carefully inserting each lead through the holes on the project box. Finally, solder the leads in place, then trim off the access wire.

113 Wiring the Circuit Strip and start soldering wires to the 16 digital leads(columns) on the perf board. For the 4 analog leads(layers), solder 100 OHM resistors to the leads. Next strip and solder the opposite ends of the wires to the 3 pin headers. If you look straight down from the top of the LED cube it looks like the 1st quadrant on a graph except that the origin is (1,1) on the cube. Likewise each LED can be named using the fundamental graphing technique. Let s try an example; look at the demonstrational picture and find A (1,4). "A" means that it is on the first layer and "(1,4)" is X=1,Y=4 on the graph.

114 Connection Setup Columns [(x,y)-pin] (1,1)-13 (1,2)-12 (1,3)-11 (1,4)-10 (2,1)-9 (2,2)-8 (2,3)-7 (2,4)-6 (3,1)-5 (3-2)-4 (3-3)-3 (3,4)-2 (4,1)-1 (4,2)-0 (4,3)-A5 (4,4)-A4 Layers [Layer-Pin] a-a0 b-a1 c-a2 d-a3

115 Power Supply Add power supply to Arduino from a dc battery or thro USB. Also include a slider switch in the supply wire. Code DOWNLOAD (Code is lengthy to included here.) Output VIDEO (This video is of a 8 x 8 x 8 LED cube. This project is a smaller version of it and the output is very similar)

116 24. ARDUINO PROJECT 5: VOICE CONTROLLED ROBOT In this Project, we'll make a simple Android voice control Arduino Bot. Things you will need Arduino Uno Bluetooth Module(hc05) L293D Motor Driver Gear Motor x 2 Wheel x 2 Chasis breadboard Connecting wires HC-05 is a class-2 bluetooth module with Serial Port Profile, which can configure as either Master or slave. Arduino does not have Bluetooth inbuilt in it. So to use Bluetooth, you need to add a Bluetooth module to it. You can use it simply for a serial port replacement to establish connection between MCU, PC to your embedded project and etc.

117 Similar to a relay, a Motor can t be used directly with Arduino, because an Arduino can t supply the required current. So a motor driver is used. L293D is the commonly used motor driver. L293D is a dual H-bridge motor driver integrated circuit (IC). In its common mode of operation, two DC motors can be driven simultaneously, both in forward and reverse direction. The motor operations of two motors can be controlled by input logic at pins 2 & 7 and 10 & 15. Input logic 00 or 11 will stop the corresponding motor. Logic 01 and 10 will rotate it in clockwise and anticlockwise directions, respectively. Input A Input B Motor State High Low Turns clockwise Low High Turns Anti-clockwise High High Braking Occurs Low Low Braking Occurs

118

119 Circuit Here are the connections for each part: HC-05 TXD to Arduino D10. HC-05 RXD to Arduino D11. L293D Pin 2 to Arduino D4. L293D Pin 7 to Arduino D6. L293D Pin 9 to Arduino D5. L293D Pin 15 to Arduino D3. L293D Pin 3 to Motor 1 Terminal. L293D Pin 6 to Motor 1 Terminal. L293D Pin 11 to Motor 2 Terminal.

120 L293D Pin 14 to Motor 1 Terminal. L293D Pin 1, 8, 9, 16 to Positive of Battery. L293D Pin 4, 5 to Negative of Battery. L293D Pin 12, 13 to Negative of Battery. Negative of Battery. to Arduino Gnd. Code #include <SoftwareSerial.h> SoftwareSerial BT(10, 11); //TX, RX respectively String readvoice; void setup() { BT.begin(9600); Serial.begin(9600); pinmode(3, OUTPUT); pinmode(4, OUTPUT); pinmode(5, OUTPUT); pinmode(6, OUTPUT); } void loop() { while (BT.available()){ //Check if there is an available byte to read delay(10); //Delay added to make thing stable char c = BT.read(); //Conduct a serial read readvoice += c; //build the string- "forward", "reverse", "left" and "right" } if (readvoice.length() > 0) { Serial.println(readvoice); if(readvoice == "forward") { digitalwrite(3, HIGH); digitalwrite (4, HIGH); digitalwrite(5,low); digitalwrite(6,low); delay(100); } else if(readvoice == "reverse") { digitalwrite(3, LOW); digitalwrite(4, LOW); digitalwrite(5, HIGH); digitalwrite(6,high);

121 delay(100); } else if(readvoice == "right") { digitalwrite (3,HIGH); digitalwrite (4,LOW); digitalwrite (5,LOW); digitalwrite (6,LOW); delay (100); } else if(readvoice == "left") { digitalwrite (3, LOW); digitalwrite (4, HIGH); digitalwrite (5, LOW); digitalwrite (6, LOW); delay (100); } else if(readvoice == "stop") { digitalwrite (3, LOW); digitalwrite (4, LOW); digitalwrite (5, LOW); digitalwrite (6, LOW); delay (100); } readvoice="";}} //Reset the variable //End of Code

122 ANDROID APP: DOWNLOAD The app is developed in such a way that it converts the voice command to text and transfer the text to the connected Bluetooth device. The bluetooth connected on the Arduino board receives text from the Android app as characters and stored them as string to the assigned String. There are words pre-programmed (forward, reverse, right, left and stop) to the Arduino. Whenever the received text matches with the pre-programmed words, the Arduino executes the command that is assigned to the words. Arduino can be connected to a Laptop to monitor serial communication and check the working process and the words received by the Bluetooth. Details of App development has not been mentioned.

123 25. HOME MADE ARDUINO BOARD Arduinos are very user friendly, and can be used for variety of projects. But an Arduino board is slightly expensive (although its cheap compared to some of the similar products). Also many a times, not all the functionalities of an Arduino are useful for a particular project. Wouldn't it be great if it was possible to make an Arduino board at home? Yes without a doubt. Not only will this cut down the cost to half ($15), but also allows you to omit those functionalities, not useful for a particular project i.e. you can custom make the board according to the project. Things you will need 1. An Arduino bootloader or ATmega328/168 or any compatible Atmel IC. 2. LM7805 IC Mhz crystal. 4. Tactile button. 5. Led s. 6. Capacitors 22pF x 2, 10Uf x 2, 0.1uF x 2 7. Resistors 220 Ohm x 2, 1k x Pin headers (Male) pin IC socket.

124

125 Steps 1. Find a nice big perf board (dot type PCB). Solder the 28 pin IC socket somewhere in the middle of the perf board. Sometimes the holes in the perf board might need to be made larger. (use a drill in that case) 2. Try out the circuit on breadboard before soldering on to a perf board. (You can directly solder, if you are good at it) 3. Solder the voltage regulator IC (LM 7805), Resistors, Switch, Oscillator etc. on the perf board. 4. Make the connections as shown as in the schematic. If you are not experienced enough in soldering, then use a larger area to solder.

126 Uploading the bootloader This step is for those who have a blank ATmega chip and want to upload the Arduino bootloader to it. Others can simply skip this step and can go ahead and use the board. Here you can either use another Arduino to bootload the blank chip or use an AVR pocket programmer. Here I have used an AVR pocket programmer to bootload the blank chip. Connections:

127 This method of uploading the bootloader best in my opinion. You just need to buy an AVR pocket programmer. Once you have that, you will be able to burn the bootloader to various types of ATmega chips. Insert the blank chip to the socket of an Arduino board. Connect the programmer to the Arduino like in the diagram above. Go to your installed Arduino folder -> hardware -> Arduino -> boards.txt. Then check the document for your chip s name and the bootloader (Duemilanove/Uno) (this step can be ignored if you re using blank ATmega328P chips). Check the values of the following parameters on it: efuse, hfuse, and lfuse. Now we will set the fuse bits for the blank chip. Open the command prompt (windows users) or terminal (Linux users) and paste the following commands: NOTE: Substitute the value for efuse, hfuse, and lfuse parameters after checking the boards.txt file and edit m328p in the below command to your chips name only if it is not an ATmega328 IC. avrdude -b c usbtiny -p m328p -v -e -U efuse:w:0x05:m -U hfuse:w:0xd6:m -U lfuse:w:0xff:m Next, use the command below to upload the bootloader or your hex program file. Go to the path of your program file or bootloader (/hardware/arduino/bootloaders/atmega) from the command prompt or terminal and instead of hexfilename.hex substitute the name of your file. avrdude -b c usbtiny -p m328p -v -e -U flash:w:hexfilename.hex -U lock:w:0x0f:m Now the file will be successfully uploaded to the ATmega chip. Buy Here: AVR_Pocket_Programmer

128 REFERENCES Beginning C for Arduino by Jack Purdum 30 Arduino Projects for the evil Genius by Simon Monk Getting started with Arduino by Massimo Banzi More Arduino Projects:

129 CONTACT

Lab 01 Arduino 程式設計實驗. Essential Arduino Programming and Digital Signal Process

Lab 01 Arduino 程式設計實驗. Essential Arduino Programming and Digital Signal Process Lab 01 Arduino 程式設計實驗 Essential Arduino Programming and Digital Signal Process Arduino Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It's

More information

keyestudio Keyestudio MEGA 2560 R3 Board

keyestudio Keyestudio MEGA 2560 R3 Board Keyestudio MEGA 2560 R3 Board Introduction: Keyestudio Mega 2560 R3 is a microcontroller board based on the ATMEGA2560-16AU, fully compatible with ARDUINO MEGA 2560 REV3. It has 54 digital input/output

More information

Note. The above image and many others are courtesy of - this is a wonderful resource for designing circuits.

Note. The above image and many others are courtesy of   - this is a wonderful resource for designing circuits. Robotics and Electronics Unit 2. Arduino Objectives. Students will understand the basic characteristics of an Arduino Uno microcontroller. understand the basic structure of an Arduino program. know how

More information

How to Use an Arduino

How to Use an Arduino How to Use an Arduino By Vivian Law Introduction The first microcontroller, TMS-1802-NC, was built in 1971 by Texas Instruments. It owed its existence to the innovation and versatility of silicon and the

More information

Introduction to Arduino. Wilson Wingston Sharon

Introduction to Arduino. Wilson Wingston Sharon Introduction to Arduino Wilson Wingston Sharon cto@workshopindia.com Physical computing Developing solutions that implement a software to interact with elements in the physical universe. 1. Sensors convert

More information

Arduino Prof. Dr. Magdy M. Abdelhameed

Arduino Prof. Dr. Magdy M. Abdelhameed Course Code: MDP 454, Course Name:, Second Semester 2014 Arduino What is Arduino? Microcontroller Platform Okay but what s a Microcontroller? Tiny, self-contained computers in an IC Often contain peripherals

More information

Arduino Uno. Arduino Uno R3 Front. Arduino Uno R2 Front

Arduino Uno. Arduino Uno R3 Front. Arduino Uno R2 Front Arduino Uno Arduino Uno R3 Front Arduino Uno R2 Front Arduino Uno SMD Arduino Uno R3 Back Arduino Uno Front Arduino Uno Back Overview The Arduino Uno is a microcontroller board based on the ATmega328 (datasheet).

More information

ARDUINO MEGA 2560 REV3 Code: A000067

ARDUINO MEGA 2560 REV3 Code: A000067 ARDUINO MEGA 2560 REV3 Code: A000067 The MEGA 2560 is designed for more complex projects. With 54 digital I/O pins, 16 analog inputs and a larger space for your sketch it is the recommended board for 3D

More information

Lab-3: LCDs Serial Communication Analog Inputs Temperature Measurement System

Lab-3: LCDs Serial Communication Analog Inputs Temperature Measurement System Mechatronics Engineering and Automation Faculty of Engineering, Ain Shams University MCT-151, Spring 2015 Lab-3: LCDs Serial Communication Analog Inputs Temperature Measurement System Ahmed Okasha okasha1st@gmail.com

More information

ARDUINO UNO REV3 Code: A000066

ARDUINO UNO REV3 Code: A000066 ARDUINO UNO REV3 Code: A000066 The UNO is the best board to get started with electronics and coding. If this is your first experience tinkering with the platform, the UNO is the most robust board you can

More information

TANGIBLE MEDIA & PHYSICAL COMPUTING INTRODUCTION TO ARDUINO

TANGIBLE MEDIA & PHYSICAL COMPUTING INTRODUCTION TO ARDUINO TANGIBLE MEDIA & PHYSICAL COMPUTING INTRODUCTION TO ARDUINO AGENDA ARDUINO HARDWARE THE IDE & SETUP BASIC PROGRAMMING CONCEPTS DEBUGGING & HELLO WORLD INPUTS AND OUTPUTS DEMOS ARDUINO HISTORY IN 2003 HERNANDO

More information

Arduino ADK Rev.3 Board A000069

Arduino ADK Rev.3 Board A000069 Arduino ADK Rev.3 Board A000069 Overview The Arduino ADK is a microcontroller board based on the ATmega2560 (datasheet). It has a USB host interface to connect with Android based phones, based on the MAX3421e

More information

ARDUINO LEONARDO ETH Code: A000022

ARDUINO LEONARDO ETH Code: A000022 ARDUINO LEONARDO ETH Code: A000022 All the fun of a Leonardo, plus an Ethernet port to extend your project to the IoT world. You can control sensors and actuators via the internet as a client or server.

More information

Digital Pins and Constants

Digital Pins and Constants Lesson Lesson : Digital Pins and Constants Digital Pins and Constants The Big Idea: This lesson is the first step toward learning to connect the Arduino to its surrounding world. You will connect lights

More information

ARDUINO UNO REV3 SMD Code: A The board everybody gets started with, based on the ATmega328 (SMD).

ARDUINO UNO REV3 SMD Code: A The board everybody gets started with, based on the ATmega328 (SMD). ARDUINO UNO REV3 SMD Code: A000073 The board everybody gets started with, based on the ATmega328 (SMD). The Arduino Uno SMD R3 is a microcontroller board based on the ATmega328. It has 14 digital input/output

More information

FUNCTIONS USED IN CODING pinmode()

FUNCTIONS USED IN CODING pinmode() FUNCTIONS USED IN CODING pinmode() Configures the specified pin to behave either as an input or an output. See the description of digital pins for details on the functionality of the pins. As of Arduino

More information

ARDUINO M0 PRO Code: A000111

ARDUINO M0 PRO Code: A000111 ARDUINO M0 PRO Code: A000111 The Arduino M0 Pro is an Arduino M0 with a step by step debugger With the new Arduino M0 Pro board, the more creative individual will have the potential to create one s most

More information

ROBOTLINKING THE POWER SUPPLY LEARNING KIT TUTORIAL

ROBOTLINKING THE POWER SUPPLY LEARNING KIT TUTORIAL ROBOTLINKING THE POWER SUPPLY LEARNING KIT TUTORIAL 1 Preface About RobotLinking RobotLinking is a technology company focused on 3D Printer, Raspberry Pi and Arduino open source community development.

More information

ARDUINO LEONARDO WITH HEADERS Code: A000057

ARDUINO LEONARDO WITH HEADERS Code: A000057 ARDUINO LEONARDO WITH HEADERS Code: A000057 Similar to an Arduino UNO, can be recognized by computer as a mouse or keyboard. The Arduino Leonardo is a microcontroller board based on the ATmega32u4 (datasheet).

More information

USER MANUAL ARDUINO I/O EXPANSION SHIELD

USER MANUAL ARDUINO I/O EXPANSION SHIELD USER MANUAL ARDUINO I/O EXPANSION SHIELD Description: Sometimes Arduino Uno users run short of pins because there s a lot of projects that requires more than 20 signal pins. The only option they are left

More information

ARDUINO MEGA ADK REV3 Code: A000069

ARDUINO MEGA ADK REV3 Code: A000069 ARDUINO MEGA ADK REV3 Code: A000069 OVERVIEW The Arduino MEGA ADK is a microcontroller board based on the ATmega2560. It has a USB host interface to connect with Android based phones, based on the MAX3421e

More information

FUNCTIONS For controlling the Arduino board and performing computations.

FUNCTIONS For controlling the Arduino board and performing computations. d i g i t a l R e a d ( ) [Digital I/O] Reads the value from a specified digital pin, either HIGH or LOW. digitalread(pin) pin: the number of the digital pin you want to read HIGH or LOW Sets pin 13 to

More information

Arduino 101 AN INTRODUCTION TO ARDUINO BY WOMEN IN ENGINEERING FT T I NA A ND AW E S O ME ME NTO R S

Arduino 101 AN INTRODUCTION TO ARDUINO BY WOMEN IN ENGINEERING FT T I NA A ND AW E S O ME ME NTO R S Arduino 101 AN INTRODUCTION TO ARDUINO BY WOMEN IN ENGINEERING FT T I NA A ND AW E S O ME ME NTO R S Overview Motivation Circuit Design and Arduino Architecture Projects Blink the LED Switch Night Lamp

More information

Introduction to Arduino

Introduction to Arduino Introduction to Arduino Paco Abad May 20 th, 2011 WGM #21 Outline What is Arduino? Where to start Types Shields Alternatives Know your board Installing and using the IDE Digital output Serial communication

More information

ARDUINO. By Kiran Tiwari BCT 2072 CoTS.

ARDUINO. By Kiran Tiwari BCT 2072 CoTS. ARDUINO By Kiran Tiwari BCT 2072 CoTS www.kirantiwari.com.np SO What is an Arduino? WELL!! Arduino is an open-source prototyping platform based on easy-to-use hardware and software. Why Arduino? Simplifies

More information

The Arduino Briefing. The Arduino Briefing

The Arduino Briefing. The Arduino Briefing Mr. Yee Choon Seng Email : csyee@simtech.a-star.edu.sg Design Project resources http://guppy.mpe.nus.edu.sg/me3design.html One-Stop robotics shop A-Main Objectives Pte Ltd, Block 1 Rochor Road, #02-608,

More information

RedBoard Hookup Guide

RedBoard Hookup Guide Page 1 of 11 RedBoard Hookup Guide CONTRIBUTORS: JIMB0 Introduction The Redboard is an Arduino-compatible development platform that enables quick-and-easy project prototyping. It can interact with real-world

More information

ARDUINO YÚN Code: A000008

ARDUINO YÚN Code: A000008 ARDUINO YÚN Code: A000008 Arduino YÚN is the perfect board to use when designing connected devices and, more in general, Internet of Things projects. It combines the power of Linux with the ease of use

More information

Adafruit Metro Mini. Created by lady ada. Last updated on :12:28 PM UTC

Adafruit Metro Mini. Created by lady ada. Last updated on :12:28 PM UTC Adafruit Metro Mini Created by lady ada Last updated on 2018-01-24 08:12:28 PM UTC Guide Contents Guide Contents Overview Pinouts USB & Serial converter Microcontroller & Crystal LEDs Power Pins & Regulators

More information

Adapted from a lab originally written by Simon Hastings and Bill Ashmanskas

Adapted from a lab originally written by Simon Hastings and Bill Ashmanskas Physics 364 Arduino Lab 1 Adapted from a lab originally written by Simon Hastings and Bill Ashmanskas Vithayathil/Kroll Introduction Last revised: 2014-11-12 This lab introduces you to an electronic development

More information

ARDUINO MICRO WITHOUT HEADERS Code: A000093

ARDUINO MICRO WITHOUT HEADERS Code: A000093 ARDUINO MICRO WITHOUT HEADERS Code: A000093 Arduino Micro is the smallest board of the family, easy to integrate it in everyday objects to make them interactive. The Micro is based on the ATmega32U4 microcontroller

More information

IME-100 Interdisciplinary Design and Manufacturing

IME-100 Interdisciplinary Design and Manufacturing IME-100 Interdisciplinary Design and Manufacturing Introduction Arduino and Programming Topics: 1. Introduction to Microprocessors/Microcontrollers 2. Introduction to Arduino 3. Arduino Programming Basics

More information

More Arduino Programming

More Arduino Programming Introductory Medical Device Prototyping Arduino Part 2, http://saliterman.umn.edu/ Department of Biomedical Engineering, University of Minnesota More Arduino Programming Digital I/O (Read/Write) Analog

More information

Introduction to Arduino

Introduction to Arduino Introduction to Arduino Mobile Computing, aa. 2016/2017 May 12, 2017 Daniele Ronzani - Ph.D student in Computer Science dronzani@math.unipd.it What are Microcontrollers Very small and simple computers

More information

Arduino Part 2. Introductory Medical Device Prototyping

Arduino Part 2. Introductory Medical Device Prototyping Introductory Medical Device Prototyping Arduino Part 2, http://saliterman.umn.edu/ Department of Biomedical Engineering, University of Minnesota More Arduino Programming Digital I/O (Read/Write) Analog

More information

Alessandra de Vitis. Arduino

Alessandra de Vitis. Arduino Alessandra de Vitis Arduino Arduino types Alessandra de Vitis 2 Interfacing Interfacing represents the link between devices that operate with different physical quantities. Interface board or simply or

More information

Electronic Brick Starter Kit

Electronic Brick Starter Kit Electronic Brick Starter Kit Getting Started Guide v1.0 by Introduction Hello and thank you for purchasing the Electronic Brick Starter Pack from Little Bird Electronics. We hope that you will find learning

More information

Make your own secret locking mechanism to keep unwanted guests out of your space!

Make your own secret locking mechanism to keep unwanted guests out of your space! KNOCK LOCK Make your own secret locking mechanism to keep unwanted guests out of your space! Discover : input with a piezo, writing your own functions Time : 1 hour Level : Builds on projects : 1,,3,4,5

More information

Arduino Uno. Power & Interface. Arduino Part 1. Introductory Medical Device Prototyping. Digital I/O Pins. Reset Button. USB Interface.

Arduino Uno. Power & Interface. Arduino Part 1. Introductory Medical Device Prototyping. Digital I/O Pins. Reset Button. USB Interface. Introductory Medical Device Prototyping Arduino Part 1, http://saliterman.umn.edu/ Department of Biomedical Engineering, University of Minnesota Arduino Uno Power & Interface Reset Button USB Interface

More information

Arduino Programming and Interfacing

Arduino Programming and Interfacing Arduino Programming and Interfacing Stensat Group LLC, Copyright 2017 1 Robotic Arm Experimenters Kit 2 Legal Stuff Stensat Group LLC assumes no responsibility and/or liability for the use of the kit and

More information

University of Hull Department of Computer Science C4DI Interfacing with Arduinos

University of Hull Department of Computer Science C4DI Interfacing with Arduinos Introduction Welcome to our Arduino hardware sessions. University of Hull Department of Computer Science C4DI Interfacing with Arduinos Vsn. 1.0 Rob Miles 2014 Please follow the instructions carefully.

More information

Arduino Uno Microcontroller Overview

Arduino Uno Microcontroller Overview Innovation Fellows Program Arduino Uno Microcontroller Overview, http://saliterman.umn.edu/ Department of Biomedical Engineering, University of Minnesota Arduino Uno Power & Interface Reset Button USB

More information

Smart Objects. SAPIENZA Università di Roma, M.Sc. in Product Design Fabio Patrizi

Smart Objects. SAPIENZA Università di Roma, M.Sc. in Product Design Fabio Patrizi Smart Objects SAPIENZA Università di Roma, M.Sc. in Product Design Fabio Patrizi 1 What is a Smart Object? Essentially, an object that: Senses Thinks Acts 2 Example 1 https://www.youtube.com/watch?v=6bncjd8eke0

More information

Lab 2.2 Ohm s Law and Introduction to Arduinos

Lab 2.2 Ohm s Law and Introduction to Arduinos Lab 2.2 Ohm s Law and Introduction to Arduinos Objectives: Get experience using an Arduino Learn to use a multimeter to measure Potential units of volts (V) Current units of amps (A) Resistance units of

More information

IME-100 ECE. Lab 4. Electrical and Computer Engineering Department Kettering University. G. Tewolde, IME100-ECE,

IME-100 ECE. Lab 4. Electrical and Computer Engineering Department Kettering University. G. Tewolde, IME100-ECE, IME-100 ECE Lab 4 Electrical and Computer Engineering Department Kettering University 4-1 1. Laboratory Computers Getting Started i. Log-in with User Name: Kettering Student (no password required) ii.

More information

StenBOT Robot Kit. Stensat Group LLC, Copyright 2018

StenBOT Robot Kit. Stensat Group LLC, Copyright 2018 StenBOT Robot Kit 1 Stensat Group LLC, Copyright 2018 Legal Stuff Stensat Group LLC assumes no responsibility and/or liability for the use of the kit and documentation. There is a 90 day warranty for the

More information

Robotics/Electronics Review for the Final Exam

Robotics/Electronics Review for the Final Exam Robotics/Electronics Review for the Final Exam Unit 1 Review. 1. The battery is 12V, R1 is 400 ohms, and the current through R1 is 20 ma. How many ohms is R2? ohms What is the voltage drop across R1? V

More information

Introduction to Microcontrollers Using Arduino. PhilRobotics

Introduction to Microcontrollers Using Arduino. PhilRobotics Introduction to Microcontrollers Using Arduino PhilRobotics Objectives Know what is a microcontroller Learn the capabilities of a microcontroller Understand how microcontroller execute instructions Objectives

More information

EEG 101L INTRODUCTION TO ENGINEERING EXPERIENCE

EEG 101L INTRODUCTION TO ENGINEERING EXPERIENCE EEG 101L INTRODUCTION TO ENGINEERING EXPERIENCE LABORATORY 1: INTRODUCTION TO ARDUINO IDE AND PROGRAMMING DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING UNIVERSITY OF NEVADA, LAS VEGAS 1. FYS KIT COMPONENTS

More information

This is the Arduino Uno: This is the Arduino motor shield: Digital pins (0-13) Ground Rail

This is the Arduino Uno: This is the Arduino motor shield: Digital pins (0-13) Ground Rail Reacting to Sensors In this tutorial we will be going over how to program the Arduino to react to sensors. By the end of this workshop you will have an understanding of how to use sensors with the Arduino

More information

Arduino Ethernet. Arduino Ethernet Rev. 2 board front view with optional PoE module. (http://arduino.cc/en/uploads/main/arduinoethernetfrontpoe.

Arduino Ethernet. Arduino Ethernet Rev. 2 board front view with optional PoE module. (http://arduino.cc/en/uploads/main/arduinoethernetfrontpoe. Arduino - ArduinoBoardEthernet Page 1 of 10 Arduino Ethernet (http://arduino.cc/en/uploads/main/arduinoethernetfront.jpg) Arduino Ethernet Rev. 3 board front view (http://arduino.cc/en/uploads/main/arduinoethernetback.jpg)

More information

University of Portland EE 271 Electrical Circuits Laboratory. Experiment: Arduino

University of Portland EE 271 Electrical Circuits Laboratory. Experiment: Arduino University of Portland EE 271 Electrical Circuits Laboratory Experiment: Arduino I. Objective The objective of this experiment is to learn how to use the Arduino microcontroller to monitor switches and

More information

IME-100 ECE. Lab 3. Electrical and Computer Engineering Department Kettering University. G. Tewolde, IME100-ECE,

IME-100 ECE. Lab 3. Electrical and Computer Engineering Department Kettering University. G. Tewolde, IME100-ECE, IME-100 ECE Lab 3 Electrical and Computer Engineering Department Kettering University 3-1 1. Laboratory Computers Getting Started i. Log-in with User Name: Kettering Student (no password required) ii.

More information

Arduino Smart Robot Car Kit User Guide

Arduino Smart Robot Car Kit User Guide User Guide V1.0 04.2017 UCTRONIC Table of Contents 1. Introduction...3 2. Assembly...4 2.1 Arduino Uno R3...4 2.2 HC-SR04 Ultrasonic Sensor Module with Bracket / Holder...5 2.3 L293D Motor Drive Expansion

More information

Introduction to Internet of Things Prof. Sudip Misra Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur

Introduction to Internet of Things Prof. Sudip Misra Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Introduction to Internet of Things Prof. Sudip Misra Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Lecture - 23 Introduction to Arduino- II Hi. Now, we will continue

More information

Microcontrollers for Ham Radio

Microcontrollers for Ham Radio Microcontrollers for Ham Radio MARTIN BUEHRING - KB4MG MAT T PESCH KK4NLK TOM PERRY KN4LSE What is a Microcontroller? A micro-controller is a small computer on a single integrated circuit containing a

More information

Arduino Programming. Arduino UNO & Innoesys Educational Shield

Arduino Programming. Arduino UNO & Innoesys Educational Shield Arduino Programming Arduino UNO & Innoesys Educational Shield www.devobox.com Electronic Components & Prototyping Tools 79 Leandrou, 10443, Athens +30 210 51 55 513, info@devobox.com ARDUINO UNO... 3 INNOESYS

More information

Arduino 05: Digital I/O. Jeffrey A. Meunier University of Connecticut

Arduino 05: Digital I/O. Jeffrey A. Meunier University of Connecticut Arduino 05: Digital I/O Jeffrey A. Meunier jeffm@engr.uconn.edu University of Connecticut About: How to use this document I designed this tutorial to be tall and narrow so that you can read it on one side

More information

Laboratory 1 Introduction to the Arduino boards

Laboratory 1 Introduction to the Arduino boards Laboratory 1 Introduction to the Arduino boards The set of Arduino development tools include µc (microcontroller) boards, accessories (peripheral modules, components etc.) and open source software tools

More information

Introduction To Arduino

Introduction To Arduino Introduction To Arduino What is Arduino? Hardware Boards / microcontrollers Shields Software Arduino IDE Simplified C Community Tutorials Forums Sample projects Arduino Uno Power: 5v (7-12v input) Digital

More information

Prototyping & Engineering Electronics Kits Basic Kit Guide

Prototyping & Engineering Electronics Kits Basic Kit Guide Prototyping & Engineering Electronics Kits Basic Kit Guide odysseyboard.com Please refer to www.odysseyboard.com for a PDF updated version of this guide. Guide version 1.0, February, 2018. Copyright Odyssey

More information

TA0139 USER MANUAL ARDUINO 2 WHEEL DRIVE WIRELESS BLUETOOTH ROBOT KIT

TA0139 USER MANUAL ARDUINO 2 WHEEL DRIVE WIRELESS BLUETOOTH ROBOT KIT TA0139 USER MANUAL ARDUINO 2 WHEEL DRIVE WIRELESS BLUETOOTH ROBOT KIT I Contents Overview TA0139... 1 Getting started: Arduino 2 Wheel Drive Wireless Bluetooth Robot Kit using Arduino UNO... 1 2.1. What

More information

STEPD StepDuino Quickstart Guide

STEPD StepDuino Quickstart Guide STEPD StepDuino Quickstart Guide The Freetronics StepDuino is Arduino Uno compatible, uses the ATmega328P Microcontroller and works with most Arduino software. The StepDuino can be powered automatically

More information

Sanguino TSB. Introduction: Features:

Sanguino TSB. Introduction: Features: Sanguino TSB Introduction: Atmega644 is being used as CNC machine driver for a while. In 2012, Kristian Sloth Lauszus from Denmark developed a hardware add-on of Atmega644 for the popular Arduino IDE and

More information

EXPERIMENT 7 Please visit https://www.arduino.cc/en/reference/homepage to learn all features of arduino before you start the experiments

EXPERIMENT 7 Please visit https://www.arduino.cc/en/reference/homepage to learn all features of arduino before you start the experiments EXPERIMENT 7 Please visit https://www.arduino.cc/en/reference/homepage to learn all features of arduino before you start the experiments TEMPERATURE MEASUREMENT AND CONTROL USING LM35 Purpose: To measure

More information

LAMPIRAN I (LISTING PROGRAM)

LAMPIRAN I (LISTING PROGRAM) LAMPIRAN I (LISTING PROGRAM) #include LiquidCrystal lcd(8, 9, 4, 5, 6, 7); const int numreadings = 10; int readings[numreadings]; // the readings from the analog input int readindex =

More information

PDF of this portion of workshop notes:

PDF of this portion of workshop notes: PDF of this portion of workshop notes: http://goo.gl/jfpeym Teaching Engineering Design with Student-Owned Digital and Analog Lab Equipment John B. Schneider Washington State University June 15, 2015 Overview

More information

Lesson 5 Arduino Prototype Development Platforms. Chapter-8 L05: "Internet of Things ", Raj Kamal, Publs.: McGraw-Hill Education

Lesson 5 Arduino Prototype Development Platforms. Chapter-8 L05: Internet of Things , Raj Kamal, Publs.: McGraw-Hill Education Lesson 5 Arduino Prototype Development Platforms 1 Arduino Boards, Modules And Shields Popular AVR MCU based products Each board has clear markings on the connection pins, sockets and in-circuit connections

More information

Lesson 8: Digital Input, If Else

Lesson 8: Digital Input, If Else Lesson 8 Lesson 8: Digital Input, If Else Digital Input, If Else The Big Idea: This lesson adds the ability of an Arduino sketch to respond to its environment, taking different actions for different situations.

More information

CTEC 1802 Embedded Programming Labs

CTEC 1802 Embedded Programming Labs CTEC 1802 Embedded Programming Labs This document is intended to get you started using the Arduino and our I/O board in the laboratory - and at home! Many of the lab sessions this year will involve 'embedded

More information

Computer Architectures

Computer Architectures Implementing the door lock with Arduino Gábor Horváth 2017. február 24. Budapest associate professor BUTE Dept. Of Networked Systems and Services ghorvath@hit.bme.hu Outline Aim of the lecture: To show

More information

1/Build a Mintronics: MintDuino

1/Build a Mintronics: MintDuino 1/Build a Mintronics: The is perfect for anyone interested in learning (or teaching) the fundamentals of how micro controllers work. It will have you building your own micro controller from scratch on

More information

ARDUINO BOARD LINE UP

ARDUINO BOARD LINE UP Technical Specifications Pinout Diagrams Technical Comparison Board Name Processor Operating/Input Voltage CPU Speed Analog In/Out Digital IO/PWM USB UART 101 Intel Curie 3.3 V/ 7-12V 32MHz 6/0 14/4 Regular

More information

Module 003: Introduction to the Arduino/RedBoard

Module 003: Introduction to the Arduino/RedBoard Name/NetID: Points: /5 Module 003: Introduction to the Arduino/RedBoard Module Outline In this module you will be introduced to the microcontroller board included in your kit. You bought either An Arduino

More information

Fall Harris & Harris

Fall Harris & Harris E11: Autonomous Vehicles Fall 2011 Harris & Harris PS 1: Welcome to Arduino This is the first of five programming problem sets. In this assignment you will learn to program the Arduino board that you recently

More information

Serial.begin ( ); Serial.println( ); analogread ( ); map ( );

Serial.begin ( ); Serial.println( ); analogread ( ); map ( ); Control and Serial.begin ( ); Serial.println( ); analogread ( ); map ( ); A system output can be changed through the use of knobs, motion, or environmental conditions. Many electronic systems in our world

More information

ARDUINO YÚN MINI Code: A000108

ARDUINO YÚN MINI Code: A000108 ARDUINO YÚN MINI Code: A000108 The Arduino Yún Mini is a compact version of the Arduino YUN OVERVIEW: Arduino Yún Mini is a breadboard PCB developed with ATmega 32u4 MCU and QCA MIPS 24K SoC CPU operating

More information

Sten-SLATE ESP Kit. Description and Programming

Sten-SLATE ESP Kit. Description and Programming Sten-SLATE ESP Kit Description and Programming Stensat Group LLC, Copyright 2016 Overview In this section, you will be introduced to the processor board electronics and the arduino software. At the end

More information

ARDUINO MINI 05 Code: A000087

ARDUINO MINI 05 Code: A000087 ARDUINO MINI 05 Code: A000087 The Arduino Mini is a very compact version of the Arduino Nano without an on board USB to Serial connection The Arduino Mini 05 is a small microcontroller board originally

More information

Workshop on Microcontroller Based Project Development

Workshop on Microcontroller Based Project Development Organized by: EEE Club Workshop on Microcontroller Based Project Development Presented By Mohammed Abdul Kader Assistant Professor, Dept. of EEE, IIUC Email:kader05cuet@gmail.com Website: kader05cuet.wordpress.com

More information

ARDUINO INDUSTRIAL 1 01 Code: A000126

ARDUINO INDUSTRIAL 1 01 Code: A000126 ARDUINO INDUSTRIAL 1 01 Code: A000126 The Industrial 101 is a small form-factor YUN designed for product integration. OVERVIEW: Arduino Industrial 101 is an Evaluation board for Arduino 101 LGA module.

More information

The Big Idea: Background: About Serial

The Big Idea: Background: About Serial Lesson 6 Lesson 6: Serial Serial Input Input The Big Idea: Information coming into an Arduino sketch is called input. This lesson focuses on text in the form of characters that come from the user via the

More information

ArdOS The Arduino Operating System Quick Start Guide and Examples

ArdOS The Arduino Operating System Quick Start Guide and Examples ArdOS The Arduino Operating System Quick Start Guide and Examples Contents 1. Introduction... 1 2. Obtaining ArdOS... 2 3. Installing ArdOS... 2 a. Arduino IDE Versions 1.0.4 and Prior... 2 b. Arduino

More information

Lab 2 - Powering the Fubarino. Fubarino,, Intro to Serial, Functions and Variables

Lab 2 - Powering the Fubarino. Fubarino,, Intro to Serial, Functions and Variables Lab 2 - Powering the Fubarino Fubarino,, Intro to Serial, Functions and Variables Part 1 - Powering the Fubarino SD The Fubarino SD is a 56 pin device. Each pin on a chipkit device falls broadly into one

More information

KNOCK LOCK MAKE YOUR OWN SECRET LOCKING MECHANISM TO KEEP UNWANTED GUESTS OUT OF YOUR SPACE! Discover: input with a piezo, writing your own functions

KNOCK LOCK MAKE YOUR OWN SECRET LOCKING MECHANISM TO KEEP UNWANTED GUESTS OUT OF YOUR SPACE! Discover: input with a piezo, writing your own functions 125 KNOCK LOCK MAKE YOUR OWN SECRET LOCKING MECHANISM TO KEEP UNWANTED GUESTS OUT OF YOUR SPACE! Discover: input with a piezo, writing your own functions Time: 1 HOUR Level: Builds on projects: 1, 2, 3,

More information

Workshop Arduino English starters workshop 2

Workshop Arduino English starters workshop 2 Workshop Arduino English starters workshop 2 We advice to finish part 1 of this workshop before following this one. There are a set of assignments in this workshop that can be taken individually. First

More information

The DTMF generator comprises 3 main components.

The DTMF generator comprises 3 main components. Make a DTMF generator with an Arduino board This article is for absolute beginners, and describes the design and construction of a DTMF generator. DTMF generators are often used to signal with equipment

More information

TABLE OF CONTENTS INTRODUCTION LESSONS PROJECTS

TABLE OF CONTENTS INTRODUCTION LESSONS PROJECTS TABLE OF CONTENTS INTRODUCTION Introduction to Components - Maker UNO 5 - Maker UNO Board 6 - Setting Up - Download Arduino IDE 7 - Install Maker UNO Drivers - Install Maker UNO Board Package 3 LESSONS.

More information

LEGO BB-8 Release: LEGO BB-8. Learn how to automate a LEGO BB-8for motion, light, and sound using Crazy Circuits. Written By: Joshua

LEGO BB-8 Release: LEGO BB-8. Learn how to automate a LEGO BB-8for motion, light, and sound using Crazy Circuits. Written By: Joshua LEGO BB-8 Learn how to automate a LEGO BB-8for motion, light, and sound using Crazy Circuits. Written By: Joshua 2018 browndoggadgets.dozuki.com/ Page 1 of 18 INTRODUCTION We absolutely LOVE the new LEGO

More information

Getting to know the Arduino IDE

Getting to know the Arduino IDE Getting to know the Arduino IDE I ve heard about Arduino, what the heck is it? Arduino is a development environment Combination of hardware and software Hardware based on Atmel AVR processors Software

More information

IDUINO for maker s life. User Manual. For IDUINO development Board.

IDUINO for maker s life. User Manual. For IDUINO development Board. User Manual For IDUINO development Board 1.Overview 1.1 what is Arduino? Arduino is an open-source prototyping platform based on easy-to-use hardware and software. Arduino boards are able to read inputs

More information

Procedure: Determine the polarity of the LED. Use the following image to help:

Procedure: Determine the polarity of the LED. Use the following image to help: Section 2: Lab Activity Section 2.1 Getting started: LED Blink Purpose: To understand how to upload a program to the Arduino and to understand the function of each line of code in a simple program. This

More information

Quickstart CHAPTER 1. Powering Up. Installing the Software

Quickstart CHAPTER 1. Powering Up. Installing the Software CHAPTER 1 Quickstart THIS IS A CHAPTER for the impatient Evil Genius. Your new Arduino board has arrived and you are eager to have it do something. So, without further ado... Powering Up When you buy an

More information

2SKILL. Variables Lesson 6. Remembering numbers (and other stuff)...

2SKILL. Variables Lesson 6. Remembering numbers (and other stuff)... Remembering numbers (and other stuff)... Let s talk about one of the most important things in any programming language. It s called a variable. Don t let the name scare you. What it does is really simple.

More information

Update: Ver 1.3 Dec Arduino Learning Guide For Beginner Using. Created by Cytron Technologies Sdn Bhd - All Rights Reserved

Update: Ver 1.3 Dec Arduino Learning Guide For Beginner Using. Created by Cytron Technologies Sdn Bhd - All Rights Reserved Update: Ver 1.3 Dec 2018 Arduino Learning Guide For Beginner Using Created by Cytron Technologies Sdn Bhd - All Rights Reserved LESSON 0 SETTING UP HARDWARE & SOFTWARE Part 1: Put Up Label Stickers for

More information

Lecture 05 I/O statements Printf, Scanf Simple statements, Compound statements

Lecture 05 I/O statements Printf, Scanf Simple statements, Compound statements Programming, Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture 05 I/O statements Printf, Scanf Simple

More information

AT42QT101X Capacitive Touch Breakout Hookup Guide

AT42QT101X Capacitive Touch Breakout Hookup Guide Page 1 of 10 AT42QT101X Capacitive Touch Breakout Hookup Guide Introduction If you need to add user input without using a button, then a capacitive touch interface might be the answer. The AT42QT1010 and

More information

Freeduino USB 1.0. Arduino Compatible Development Board Starter Guide. 1. Overview

Freeduino USB 1.0. Arduino Compatible Development Board Starter Guide. 1. Overview Freeduino USB 1.0 Arduino Compatible Development Board Starter Guide 1. Overview 1 Arduino is an open source embedded development platform consisting of a simple development board based on Atmel s AVR

More information

Coding Workshop. Learning to Program with an Arduino. Lecture Notes. Programming Introduction Values Assignment Arithmetic.

Coding Workshop. Learning to Program with an Arduino. Lecture Notes. Programming Introduction Values Assignment Arithmetic. Coding Workshop Learning to Program with an Arduino Lecture Notes Table of Contents Programming ntroduction Values Assignment Arithmetic Control Tests f Blocks For Blocks Functions Arduino Main Functions

More information

Arduino Platform Part I

Arduino Platform Part I Arduino Platform Part I Justin Mclean Class Software Email: justin@classsoftware.com Twitter: @justinmclean Blog: http://blog.classsoftware.com Who am I? Director of Class Software for almost 15 years

More information