INTRODUCTION to MICRO-CONTROLLERS

Size: px
Start display at page:

Download "INTRODUCTION to MICRO-CONTROLLERS"

Transcription

1 PH-315 Portland State University INTRODUCTION to MICRO-CONTROLLERS Bret Comnes, Dan Lankow, and Andres La Rosa 1. ABSTRACT A microcontroller is an integrated circuit containing a processor and programmable read-only memory, which is widely used as an interface between hardware and software systems. This laboratory session pursues obtaining familiarity with microcontrollers operation, namely installation of communication with your computer, downloading the proper software, and programming code. An Arduino Leonardo microcontroller will be used to implement simple, still, very instructive tasks. One of them includes the implementation of a proportional, integral, derivative (PID) controller, which is used to regulate the amount of light emitted by a light emitting diode (LED); the controller's function is to adjust the amount of LED light incident on the photoresistor as needed to keep the voltage across the photoresistor (which will be purposely perturbed by external agents) at a desired value. [The examples will require some knowledge of pulse-width-modulation PWM (a widely use technique for converting an analog signal into digital one). A short note on PWM is attached at the end of this file.] Once familiarized with the microcontroller operation, you will be required to implement a PID controller to automate the response of a fan to the input signal from a thermistor. 2. INTRODUCTION Microcontrollers are small computers designed to go where desktop computers dare not to. A microcontroller is essentially a small programmable computer contained on a single integrated circuit, consisting of a processor, read-only memory (ROM) used to store the program instructions, and a set of input and output pins which can be used to interact with an external circuit. The microcontroller IC is a digital device, and since the processor operates on transistor to transistor logic (TTL), only two logic states are acceptable, HIGH (~ +5 V), and LOW (~0 V). They come in all shapes, sizes, and layouts. Usually, they are quite small and use less power than traditional computers. Microcontrollers are often deployed in appliances and serve an unmodifiable dedicated purpose, such as keeping track of what spin cycle your washing machine is on, or how much time is left before it should turn off your microwave oven. Make no mistake, however, these are general purpose computers. Another major difference between a microcontroller and traditional computers is that they come with an array of analog and digital inputs and outputs. These inputs and outputs can be used to read environmental data from sensors, talk to other computers or devices and electronically control other systems which provide environmental outputs such as a LCD screens, mechanical switches or servo motors etc. [13] Getting started with microcontrollers can be a tedious process, as they can require a number of supporting circuits, USB controllers, programmers, boot-loaders and power supplies just to load your first program onto the microcontroller chip. Often times you will start with a prototyping board which puts all of the necessary components in a convenient, ready to use package. 2.1 Arduino Microcontroller and its advantages This lab will be using the single board Arduino Leonardo Microcontroller[2]. It is similar to

2 the Arduino Uno[4], with the major difference being that the latter uses Surface Mount Technology (SMT)[15] instead of the older thru-hole [16] technology. Arduino drastically lowers the difficulty of getting started with a microcontroller (compared to to plain ATMEGA/PIC/ARM chips), as it provides all the necessary tools to start making the microcontroller do interesting things, which would be daunting if staring with just a plain microcontroller chip. The Arduino is based around an 8-bit Atmel AVR microcontroller, and has supporting systems like a boot loader for uploading programs, a USB controller as well as a barrel jack for external power. It is programmed using a language that is based off of C++ and uses an integrated development environment (IDE) for writing, compiling and uploading your programs to the board. Many example Arduino-projects will rely on programs running on your computer using Processing (an open source programming language), but can interface with any serial enabled programs.[10] Figure 1: T h e Arduino Leonardo Microcontroller[2]. Arduino is a tool for making computers that can sense and control more of the physical world than your desktop computer. It s an open-source physical computing platform based on a simple microcontroller board, and a development environment for writing software for the board. Arduino.cc[5] 3. GETTING STARTED This lab is based off of the Arduino software which can be downloaded for free from the Arduino website.[3] Unlike other embedded systems development environments, the Arduino software is quick to download and set up, and has zero cost associated with the software which makes it a convenient to work with when your primary goal is to come up with a working prototype quickly and cheaply. There is a large community of Arduino users and there exists a massive pool of example programs and libraries compared to other educational prototyping boards. Whatever you do, DO NOT APPLY MORE THAN 5V TO ANY PIN ON THE ARDUINO. otherwise it will damage or destroy the microcontroller board. Also, avoid powering directly with the Arduino devices that draw high current. Instead opt for a separate power source and an NPN transistor or something similar. Basically, avoid finding creative ways to

3 break the equipment. 3.1 Find a Computer You are free to use your own laptop or one of the classroom computers. Plug your Arduino into the computer using the micro USB cable. Please be careful with the delicate connectors. 3.2 Download and Launch the Arduino Software Download the latest Arduino Integrated Development Environment (IDE)[3] available at the following site, [If you have decided to use your own Arduino, make sure you find the necessary USB drivers if you have a board that is older than the Uno. You may also check around class to see if the Arduino software is available on someone s USB drive.] At the time of writing these notes, we selected Arduino from the menu. The downloading process may take a few minutes. Then go to the downloads folder in your computer (typically located in the favorites section), identify with your mouse the Arduino application file, and enter a left-click. After a few minutes, the monitor screen should pop-up the following message: Do you want to allow this program making change in your computer? Proceed accordingly. (You may be prompted to add hardware if you are on windows. If it asks for a driver, tell the windows driver wizard to look inside a folder called drivers inside the Arduino folder. If the computer you are using already has the Arduino software downloaded, look inside that folder usually found in Program Files, or wherever you copied it, or the shortcut on the desktop leads too.) 3.3 Selecting the Board The Arduino application software is now installed in your computer. It should be available from the Start menu (lower left corner) of your computer Click on the Arduino application to launch the Arduino Integrated Development Environment (IDE) It is time now to tell the Arduino IDE what particular Arduino board we will be using (i.e. to tell the IDE what hardware it will be compiling). For that purpose, once the IDE is open, navigate to the toolbar and select the Leonardo board, Toolbar Tools Board Arduino Leonardo. If you are using a different board, select the one you have from this list instead. This step may vary from system to system. 3.4 Selecting a Serial Port This step varies from system to system. This step is to tell the computer which serial port the Arduino chip can be reached at, for both programing the board as well as talking to it during

4 runtime. Figure 2: Port selection in Windows and OS X Windows Select Toolbar Tools Serial Port COM5 where COM5 is the serial port that has been assigned to your Arduino by windows. You may have more than one port in the list. To know which port is associated with the Arduino, you can check the list with the Arduino unplugged, and check it again with it plugged in, and the port that appears after is your Arduino OS X Usually the Arduino is the first item in the Serial Port list. Another way to tell is that it has tty in the name and does not have the world bluetooth in it. 3.5 Compiling and uploading your first program (The Blink program) Next we will open an example program; we have chosen the blink program available in the Arduino library. For that purpose, navigate to, Toolbar File Examples 01. Basics Blink. The program shown in Fig. 5 will appear in your screen. We proceed now to verify that it compiles, and then upload it to your board. Compiling your program lets the compiler check your work for syntax and structure errors.

5 Press the verify button (top-left side of the screen; see also Fig. 3). It will take some minutes to compile the sketch, and then to return a Done compiling message (see Figure 3). If you get an error, something went wrong. Figure 3. Left: The Verify and Compile buttons. Right: Successful-compile message. Once the compiling process is completed, go ahead and upload the program to the micro-controller board by pressing the upload button (located right next to verify button). This process should provide a similar completion message after a few seconds. The LEDs on the Arduino will blink during the upload, but should settle down after a few seconds. Your program is now on the Arduino and running in a loop sequence. Once the program you uploaded is running, the tiny LED labeled L on your Arduino should be slowly blinking in response to the uploaded Blink program. The LED labeled L is wired to Pin 13 on the Arduino, a digital pin with a resistor built in so that an LED can be connected directly between that pin and ground. Go ahead and connect an LED between Pin 13 and GND. It should blink at the same rate as the L LED on the board. Congratulations! You now have a working Arduino that is talking to the Arduino IDE. 4. PROGRAMMING the ARDUINO Arduino is based off the Processing[10] (an open source programming language) which has some similarities to C. However much of the language has been simplified from C. In this section we will go over the basics of the language, look at some simple examples of code, and even write some of our own. 4.1 The Bare Minimum The bare minimum code you need for an Arduino program is presented in Figure 4. 1 void setup() { 2 // put your setup code here, to run once: 3 } 4 void loop() { 5 // put your main code here, to run repeatedly: 6 } Figure 4: The minimum amount of code for an Arduino Program. There are two parts to this minimum program,

6 the void setup() {} section, and the void loop() {} section. When your program runs, it starts executing your code line by line, starting with the void setup() section; your program will execute any code that is inside the brackets, {}, Next, it will start executing the code inside void loop() {}, until it gets to the end of the available instructions, at which point, the program starts back over in at the beginning of void loop() {}, retaining any variables or settings from prior lines of code. Let s look at a simple example that you should already have pulled up, the Blink program, which is found in Figure 5. If you still need to open this, refer to Section UNDERSTANDING the Blink Program 1 /* 2 Blink 3 Turns on an LED on for one second, then off for one second, repeatedly. 4 5 This example code is in the public domain. 6 */ 7 8 // Pin 13 has an LED connected on most Arduino boards. 9 // Give it a name: 10 int led = 13; // the setup routine runs once when you press reset: 13 void setup() { 14 // initialize the digital pin as an output. 15 pinmode(led, OUTPUT); 16 } // the loop routine runs over and over again forever: 19 void loop() { 20 digitalwrite(led, HIGH); // turn the LED on (HIGH is the voltage level) 21 delay(1000); // wait for a second 22 digitalwrite(led, LOW); // turn the LED off by making the voltage LOW 23 delay(2000); // wait for a second 24 } Figure 5: The Blink Program in all its glory. 5.1 Comments If a block of text is wrapped inside the symbols, /* */ (such as lines 1 thru 6 in Figure 5), or if a command line has the symbol, // in front of it (such as line 12), it means that the content is a comment.

7 Comments are little notes you leave in your code. They are not executed or interpreted by your program in any way. It is good practice to add comments to your code. They can help you think about your program, and will also remind you, and others that see your code, what the program does or how it works. Running down lines 1-9, we see a block of comments describing the function of the program, how it works, as well as the license. The first piece of code we see is on line Variables int led = 13; First, notice that this code is not inside the void setup() nor the void loop(). That is because it is a variable and variables have to be declared at the beginning of our program, outside either loop. Variables are incredibly useful tools. Variables store information that can be used later in the program as many times as you need. They can be updated during run-time and can be used to store values temporarily for repeated use. Any variable we decide to use has to be declared at the beginning of the program. That is, variables are declared before your void setup() or void loop() sections. Line 10 declares a variable named led; i t a l s o declares it as an integer variable int; and then assigns the 13 to that variable. This variable is used to reference the physical pin t h at we will be using in our program. It is used as an abstraction layer, so that if we ever go back and change which pin we want to use, we can update all the places in our program that reference this pin number simply by updating the initial variable value. The basic syntax of a variable declaration is: type variable_name = value; The available variable types can be found on the Arduino website.[8] Please reference that list if you want to use values other than integers. 5.3 Pin Modes The next piece of code in our program is void setup(). Stepping inside the curly braces of this structure, we come to the following line: pinmode(led, OUTPUT); Each pin on the Arduino has a name assigned to it. The name i s printed next to the corresponding pin, as shown in Figure 1. There are two primary types of pins: Digital and Analog. Digital pins simply have a number for a name, and analog pins have the letter A followed by a number for a name Digital pins Digital pins can be either inputs or outputs Digital pins can either read or write digital signals (0 or 5v ). Before you do either, you must tell your program what you will be using the digital pin for. The command pinmode(led, OUTPUT); tells our program that the pin associated with the led variable will be a digital output. The general command to define the pin type is as follows:

8 pinmode([pin-number], [PIN-TYPE]); PWM digital signals Some digital pins can also output PWM signals (square signal with different duty cycle), which is a way to produce a similar effect of analog voltage signals with a digital pin. Digital pins with PWM capability have a tilt-symbol printed next to their name on the board. See Section 6.1 below for more information. Digital mode pins produce outputs at either the high or low digital voltage level as expected. However, many external circuit components may require analog voltage values. PWM is one way to produce output digital voltages whose net effect is similar to analog voltages in the range of 0 5 V. This is accomplished by outputting a periodic pulse signal, but with variable duration of the high and low voltage levels. 1 When looking at the RMS value of this periodic signal of different duty cycle, i) shortening the duration of the high level will lower the RMS voltage (up to the point that when the HIGH pulse width is 0 seconds its effect is that of a 0 V), and ii) by increasing it will raise it, (up to the point that the low pulse width is 0 s, then the output is just 5 V). This has the net effect of simulating a continuous DC voltage range, using only digital voltages. The pin value still must be assigned (via the microcontroller software) in discrete steps between 0 and 255, giving possible output voltages that differ by steps of Veq = 5 V/ Analog pins Analog Pins can read in analog voltages between 0v and 5v, The Arduino has inside an analog-to-digital converter circuit that reads this voltage and converts it to a single 10-bit value (a number between 0 and 1023). H e r e 0 represents 0V, and 1024 represents 5 V. This 10-bit value is what the software sees as the input on that pin. The discrete values of the input and output pins pins are a limitation of the microcontroller when working with external systems that expect continuous values, such as LED - photoresistor system regulated in this experiment. Analog pins do not need a pin mode set before reading within your program. Available pin modes can be found at the Arduino website.[7] 5.4 Generating an output Once the pin mode is set, the program exit the void setup() and enters the void loop(), the part of the program that will run over and over in an infinite loop. The first command to execute is, digitalwrite(led, HIGH); 1 See also Sections 7 and 9 below.

9 The command digitalwrite([pin],[value]) lets us set the output value of a digital pin that has been set to an OUTPUT type. In this case, we write a value of HIGH, or 5V, to the pin referred to by the led variable. A value of LOW would refer to 0v. Next the program tells the Arduino to wait for a g i v e n period, before executing the next line of code. This period is equal to 1000 ms. delay(1000); After waiting for 1000 ms, the code writes a value of LOW to the led pin, and then makes it wait for 2000 ms. digitalwrite(led, LOW); delay(2000); At this point, there is no more code left in our program, so it starts executing void loop() again. Congratulations, you now should have some basic understanding of how an Arduino program is written. 6. MODIFYING the BLINK PROGRAM Now you will try your hand at modifying the blink program. What we are going to do is define a new variable called wait, give it a value, and then replace the delay time on the Arduino with our new variable. 6.1 Create a new variable Right below the led variable declaration, add a new variable named wait of type int and assign a reasonable value different than 1000 (like 100). Add also a comment describing what this variable is used for. 6.2 Use your new variable We want to use this new variable to declare the time we wait in between turning our LED on and off. Go ahead and replace the old delay values with your new variable name. 6.3 Verify and upload your modified program The Arduino should still be set up from when you first uploaded the first blink program. Verify your new program to see if it compiles. If you get an error, check your work for syntax error. Did you forget a semicolon or a brace? Once your program verifies, and you are able to upload it to your board, you should start to see your LED blink faster or slower, depending on the value you defined your variable. 1 int led = 13; 2 int wait = 100; // Time to wait before blinking 3 4 void setup() { 5 pinmode(led, OUTPUT); 6 } 7

10 8 void loop() { 9 digitalwrite(led, HIGH); 10 delay(wait); //Wait for the amount declared in the wait variable 11 digitalwrite(led, LOW); 12 delay(wait); //Wait for the amount declared in the wait variable 13 } Figure 6: The modified Blink Program 6.4 Final modification Once you make your modification, you will have code that looks similar to Figure USING INPUTS to CONTROL OUTPUTS 7.1 Understanding PWM Arduino cannot output true analog signals. One way to output a digital signal that reflects the value of an analog signal is pulse-width-modulation (PWM) Compared to a square signal, where the duty cycle is 50% (half of the period HIGH and half of the period LOW), the PWM signal has a duty cycle in which the time during which the signal remains HIGH is proportional to the analog signal (see Section 9 below). Accordingly, when driving an LED with a PWM signal, one is able to vary the brightness of the LED by writing on the PWM pin a proper (digital) value. Actually, an analog signal should be first read by the Arduino (which converts it to a value between 0 and 1023) and then one has to convert that value into an 8 bit (0 to 255 range) number; the latter is used to write the PWM pin. The net result is that you can generate digital signals (switching on and off) that have similar effects as analog signals Observing PWM signals Load the 01.Basic Fade example program and upload it to your Arduino board (a modified version of the program is shown in Fig. 8 below). Wire up the LED to the pin that is used in the program; if it is a digital pin other than pin 13, you will need to add a 330 Ω resistor in series with the LED. If you increase the delay time to 80, you should be able to observe the PWM flicker at lower brightness levels. You can leave the LED in place. Observe how the signal looks like on your oscilloscope. 7.2 Controlling the PWM output with a potentiometer We will control the the PWM signal (i.e. we will control the duty cycle of the square signal) by reading the voltage from a potentiometer lead connected to the analog input A0.

11 5V 10 k PWM GND Figure 7: Potentiometer and LED wired up to the Arduino. Pin 9 is a PWM output. Hook up a 10k potentiometer between the 5v and ground and the middle leg to the A0 analog input on your Arduino as seen in Figure 7. Modify your Fade code from Section to the code shown in Figure Understanding the changes made to the Fade program We have modified the original Fade program to, instead, control the LED brightness with a potentiometer. In the new program we have declared a few new variables to keep track of an analog input pin, the variables used for storing values from our analog input readings, and our PWM output values. See the comments in the code for more context. Establishing serial communication In the void setup() loop we use Serial.begin(9600); to begin serial communications, at 9600 bits of data per second, between the Arduino and the computer (remember how we picked a serial port in Section 3.4?) Outputting data to the serial line is a nice way to see (on the computer screen) what is going on in your code while it is running. But remember that your program will run no faster than the speed of your serial line. Reading the analog signal from the potentiometer The next new piece of code is analogread(pot); It reads the analog input (0-5v range) on pin pot (in the program this pin has been declared as pin A0) and converts it to a discrete value between 0 and 1023 (2 10 discrete values range.) 1

12 (Recall the Arduino has inside an analog-to-digital converter circuit that reads this voltage and converts it to a number between 0 and 1023). Controlling the PMW Pin led (declared as pin 9 in the program) only outputs PWM values ( i.e. square wave with different duty cycles). Firs, we have to solve the following issue: On one hand, the PWM can be controlled only by an 8 bit digital number (that is, one needs to write a value between 0 and 255 to the led pin). On the other hand, in our current experiment we have a number between 0 and 1023 read from the analog pin pot. We need to make a corresponding conversion then. One alternative is to use the command called map() which handles the analog-input-range to t h e PWM-output-range conversion. Its syntax is, map (valuetoscale, fromlow, fromhigh, tolow, tohigh) In our program we use, outputvalue = map(sensorvalue, 0, 1023, 0, 255); /* Map sensorvalue to 8 bits (0 to 255) */ See the map info page for more details.[6] Next we write the adjusted input value to our led pin using, analogwrite(led, outputvalue); Displaying the input and output voltages Finally we print these input and output values the the serial line using the command, Serial.print(value); Open the serial monitor now to view these values in real time. Go to Tools Serial Monitor. You should see the input and output values similar to Figure 9. 1 const int led = 9; // the PWM pin where the LED is attached to 2 const int pot = A0; // A0 will be the analog input channel 3 int sensorvalue = 0; // sensorvalue will store the value read from the pot 4 int outputvalue = 0; // this is the value sent to the PWM pin 5 6 void setup() { 7 pinmode(led, OUTPUT); // declare the PWM pin 9 to be an output 8 Serial.begin(9600); // Open a serial monitor at 9600 baud 9 } 10 void loop() { 11 sensorvalue = analogread(pot); // store pot value in sensorvalue 12 outputvalue = map(sensorvalue, 0, 1023, 0, 255); // map sensorvalue to a 8 bit number (0 to 255) 13 analogwrite(led, outputvalue); // write the analog out value to pin led: Serial.print("sensor = " ); // print the results to the serial monitor: 16 Serial.print(sensorValue);

13 17 Serial.print("\t output = "); 18 Serial.println(outputValue); delay(2); // wait 2 milliseconds for daq to settle 21 } Figure 8: The Fade program modified to control the LED with a potentiometer. Figure 9: The serial monitor in action. 7.3 Photo Resistor Remove the potentiometer and wire in a photo-resistor as seen in Figure 10. A photo-resistor has a variable resistance depending on how much light is incident on it.[10]

14 10 k Photoresistor A0 GND 5V D9 330 LED PWM Figure 10: Photo-resistor connected to the analog input A0. Using the same code as in Section 7.2, observe the output of the photo resistor and the PWM output on pin 9 simultaneously on your oscilloscope. Vary the amount of light incident on the photo-resistor and observe and compare the PWM output and analog voltage across the photoresistor. Check also what happens, upon light incident on the photoresistor, when you interchange the position of the photoresistor with the 10 k resistor in the circuit. If there is any difference, explain why. 7.4 Arduino Thermostat We will now use a TMP36 temperature sensor as an analog input to read in temperature data, and control an LED to indicate we have reached a particular temperature. The TMP36 provides an accurate, linear representation of temperature between the range of 40 C and +125 C using the factor of 10 mv/ o C. [11] See the data sheet for more information.[1] Hook up the circuit shown in Figure 11. For our code, we will, a) read the potentiometer as an analog input and use its position as a threshold value. b) read the current temperature indicated by the thermostat c) compare the threshold value to the temperature value. If the temperature is above the threshold, the LED will turn on, and if it is below, it will turn off. We will also be monitoring the values using the serial monitor so we can tell what is going on. See if you can write this program on your own, or look at Figure Testing the Thermostat Upload your program and open the the serial monitor. You should see a value from your TMP36 as well as your potentiometer and the state of the LED. Adjust the pot to where the LED turns on, with the threshold below the temperature value. Then try setting the threshold above the

15 current temperature and confirm that the LED turns off. Now, set the threshold a few integer values above the current temperature value. Confirm that it turns on. DO NOT touch the temperature sensor with your fingers; if its pins are placed wrong in the circuit, the device will be very hot and could blister your fingers! A1 A0 10 k Bottom View: The legs of the device should be pointing towards you when reading this pin identification GND 5V V S D9 PWM GND V OUT LED 330 Figure 11: L e f t : Circuit for comparing the voltage set by the potentiometer (analog signal read at A0 ) and the output from the thermostat (analog signal read at A1 ). Right: TMP36 pinout. You now have a working temperature sensor controlling hardware. You could write a program on your computer to log the incoming data. You could hook up a fan using an npn-transistor (since the Arduino cannot provide enough current to motors typically) and turn on a fan if it gets too hot in here. You could also have the Arduino calculate the actual temperature using the TMP36 characteristics described in the beginning of Section 7.4 and print a more realistic value to the serial monitor. 1 const int threshold = A0; // threshold set with 10 k pot 2 const int temp = A1; // TMP36 Temp sensor 3 const int led = 9; // LED Pin 4 Recall, analog pins do not need a pin mode set before reading within your program. 5 int thresholdvalue = 0; // value used to store threshold value from the pot 6 int tempvalue = 0; // value used to store temp read from the temp sensor 7 boolean ledstate = false; // value used to write the led state

16 8 9 void setup() { 10 digitalwrite(led, ledstate); 11 Serial.begin(9600); 12 } void loop() { 15 thresholdvalue = analogread(threshold); // read threshold from AO tempvalue = analogread(temp); // read the temp if (tempvalue > thresholdvalue) { 20 ledstate = true; //if temp > threshold, turn on LED 21 } 22 else { 23 ledstate = false; //if temp < threshold, turn off LED 24 } 25 digitalwrite(led,ledstate); // This writes the state determined above // print the results to the serial monitor: 28 Serial.print("thresholdValue = " ); 29 Serial.print(thresholdValue); 30 Serial.print("\t tempvalue = "); 31 Serial.print(tempValue); 32 Serial.print("\t LED on?: "); 33 Serial.println(ledState); delay(2); //Small settle delay for ADC 36 } Figure 12: Arduino Thermostat Program. 8. Communicating with other devices over the serial line We shall attempt having the Arduino communicate with an external program running on our computer. For this t a s k we will use Processing, since it integrates well with Arduino and has similar code syntax, but you could do this using any other programming language such as Python or LabVIEW. While we have already talked to the Arduino using our computer and the handy serial monitor, here we will write a program that interfaces with the Arduino directly over the serial line. 8.1 Downloading and installing Processing Short version 1. The 'Processing' Libraries are located at the Arduino 'Playground' website here: 2. Go to the link above and follow the instructions on the website for installing the 'Processing' libraries on your computer.

17 3. The actual program is located here: 4. Again, follow the instructions on the website to install 'Processing.' 5. Run processing in order to confirm it installed correctly Detailed version Download Processing from the following address. Choose either 64 bit or 32 bit based on your computer. Unzip the zip file to the desktop. The Processing.exe program can be run from within the folder or a shortcut can be placed wherever you choose. Now download the Arduino library for Processing (version 2.0 for new processing downloads) from the Arduino Playground at following address. Open the zip file and copy the folder names arduino into your Processing library folder, found in your documents. Example C:\Users\username\Documents\Processing\libraries. From here, open the Arduino IDE and the Processing IDE. They will appear very similar once open. Arduino will be green and Processing will be black. In the Arduino IDE, open the the Standard Firmata sketch by navigating Toolbar > File > Examples > Firmata > StandardFirmata and upload it to the Arduino board. In Processing, go to Toolbar >File > Open, and navigate to one of the Arduino examples found in C:\Users\username\Documents\Processing\libraries\arduino\examples Find the following line of code in Processing: arduino = new Arduino(this, Arduino.list()[0], 57600); You may need to edit the code to have Processing select the correct serial port used by Arduino. Specifically, change the [0] in this line. To find the correct number, run this code in Processing: import processing.serial.*; import cc.arduino.*; println(arduino.list()); The correct value for [0] will be given to you. Finally, run the program. Now you are ready to run any Arduino program in Processing. 8.2 Sending Data to an External Program This example is based off of the Graph example program found in, File Examples 04. Communication Graph We can use the same circuit as above, as all we are doing is sending the potentiometer signal out of the serial line again. Go ahead and upload this program to your Arduino and make sure it runs by watching the serial

18 bus Steps to set up the 'Graph' program (Getting Graph in Processing-code) 1. Run the Arduino IDE. 2. Open 'Graph' located in the dropdown menu, 'Open -> 04.Communication -> Graph' or 'File - > Open -> examples -> 04.Communication -> Graph -> Graph.ino'. 3. About halfway down the program there is a line that looks like this: /* Processing code for this example 4. Copy all the code below this line and above the block of gibberish and past it into a new 'Processing' sketch. 5. Uncomment the code by deleting all the '/*' and the '*/' at the start and end of the copied section of the code. (Everything between these is commented out). 6. Once those are deleted, the code should change color to confirm it is no longer commented. 7. Compile the code now, if it compiles correctly, 'Processing' should be able to run the 'Graph' program. Steps for running the program: 1. Ensure 'Serial Monitor' is not running, processing cannot read the serial port if another program is reading from it. 2. Start the 'Graph' program in 'Processing', you should see a window with a black background and a yellow output signal. This signal is being read from the potentiometer and its amplitude will vary as the potentiometer is adjusted. 3. If you do not see this graph, double check the serial port settings in 'Processing,' it will be a little different than the Arduino IDE and may take a little bit more effort to get working. 4. The serial port on 'Processing' is set to '0' by default, try incrementing the value by '1' and try again, repeat as necessary. 5. Note: You can stop 'Processing' and start 'Serial Monitor' from IDE in order to get a numerical representation of what signal is getting sent from the potentiometer. The following graphic is a rough example of the flow of data in this setup. The Arduino IDE program transmits the code you used in section 7 to the Arduino over the serial port. The Arduino saves the code and starts running the program by sending inputs through the circuit and looking at the output signals it receives. The Arduino then sends the output signal to the computer across the serial cable and any program on the computer can now look at that information but only one-at-a-time can look at it. If the Arduino IDE is running the 'Serial Monitor' program, it will block any other program from looking at it. Same goes for the 'Processing' program. Basically its a first-come-first-serve basis to see which program gets to look at the serial port. If you did everything right, when you launch the Processing sketch, it should start plotting the value being read in from the potentiometer value. You may have to futz around with the serial port selection on the processing sketch. Now is your chance to troubleshoot! 8.3 Sending commands Arduino externally In this example, we will be exploring two new concepts: i) the case structure, and

19 ii) setting up the Arduino to respond to messages sent to it by a computer over the serial port. Note that these messages could conceivably come from any other device or program that can talk over a serial line. We will be able to send a command over the serial monitor and turn a specific LED on or off Wire up some LEDs Wire up two LEDs to two separate digital pin channels as see in Figure 13. Figure 13: Schematic for Serial switch program The Serial Switch Code Either type or copy in the following program. The code can be found at h t t p s : / / g i t h u b. c o m / b c o m n e s / l a b - m i c r o c o n t r o l l e r / b l o b / m a s t e r / c o d e / s e r i a l _ s w i t c h / s e r i a l _ s w i t c h. i n o 1 const int led1 = 9; 2 const int led2 = 10; 3 4 boolean led1state = false; //Value used to store the state of LED1 5 boolean led2state = false; //Value used to store the state of LED2 6 7 void setup() { 8 // initialize serial communication: 9 Serial.begin(9600); //Start a serial session 10 pinmode(led1, OUTPUT); //set led1 and led2 pins as outputs 11 pinmode(led2, OUTPUT); 12 digitalwrite(led1, led1state); //Turn off both LEDs 13 digitalwrite(led2, led2state); 14 } 15 void loop() { 16 //Check to see if any incoming commands have been received

20 17 if ( Serial.available() > 0 ) { 18 int inint = Serial.read(); //Read what command it is 19 switch (inint) { //Decide what to do with the command 20 case 1: // If we get a 1 over serial 21 if (led1state == false) { // and led1 is off 22 led1state = true; // set its state to on 23 Serial.println("LED1 ON"); // and let us know 24 } 25 else { 26 led1state = false; //or if led1 is on turn it off 27 Serial.println("LED1 OFF"); //tell us that its turning off 28 } 29 digitalwrite(led1, led1state); //and update its actual state 30 break; //end case 1 31 case 2: //if we get an incoming 2 32 if (led2state == false) { //and if led2 is off 33 led2state = true; //set its state to on 34 Serial.println("LED2 ON"); // let us know 35 } 36 else { //or if its already on 37 led2state = false; //set its state to off 38 Serial.println("LED1 OFF"); //and let us know 39 } 40 digitalwrite(led2, led2state); //update its actual state 41 break; // end case 2 42 case 0: // if someone sends us a 0 43 led1state = false; // turn off both leds 44 led2state = false; 45 digitalwrite(led1, led1state); 46 digitalwrite(led2, led2state); 47 Serial.println("LEDS OFF"); //and let us know 48 break; //end case 0 49 default: 50 Serial.println(Serial.read()); //if we get something else just print it 51 } 52 } 53 } Literally we will be entering the keyboard keys 0, 1, or 2; right? 8.4 Running the switch Verify that it compiles and upload the program to your Arduino. Open the serial monitor and type in 1 and press send.led 1 should turn on. Try sending 2 now. Now send 0. Your Arduino is now responding to input during runtime!

21 9. Pulse-width Modulation The objective is to measure, in a digital format, the analog voltage output from a sensor device. Use the op amp LM358AP to compare two input volages: a) the sensor voltage V sensor, and b) a sawthooth voltage of constant frequency (try 100 Hz). We will mimic the sensor voltage by providing a manually-variable voltage (0 to 5 V range.) Voltage comparator V C 5 Volts sawtooth (100 Hz) +12V - + A V out Sensor V sensor voltage LM358AP Fig. 9.1 Left: Comparator circuit. Right: Pin connections of the LM358AP. Notice that a ground terminal replaces V CC. Notice in Fig.1 that a ground terminal replaces the rail voltage V CC. Monitor in the oscilloscope both, the sawtooth input voltage (channel-1) and the output voltage (channel-2.) Figure 3 show the expected signal corresponding to two different sensor voltages. Verify if your set up works as expected. V C (Volts) V max V sensor V C (t) V max V sensor T 0 2T 0 time T 0 2T 0 time V out V out V CC V CC T high T high T 0 2T 0 t(ms) T 0 2T 0 t(ms) Notice the correlation between the magnitude of the analog voltage V sensor, and the time during which the output digital signal is in the HIGH state. Fig. 9.2 Left: Signals corresponding to a relatively low V sensor. Right: Signals corresponding to a higher V sensor signal. In both figures, Thigh stands for the interval of time during which the

22 output voltage stays in the high digital level. Notice the higher the sensor-voltage V sensor, the longer the time Thigh the output voltage stays in the high level. To is the period of the sawtooth signal V c. Notice in Fig. 3 that V max T 0 V T sensor high T. That is, T 0 high V sensor Vmax where T high is the time the output voltage remain the high level. T 0 is the period of the sawtooth input signal The pulse-width modulator then convert the analog voltage sensor to an output that is digital in nature (high or low); the time during which the output is high is proportional to the voltage sensor. Implementation: a) Use the op amp LM358AP to implement the comparator circuit shown in Fig.1. Initially, use a sawtooth voltage of 100 Hz b) Verify that the circuit works as advertised in Fig. 2 c) Increase gradually the frequency of the sawtooth signal, and estimate the bandwidth of the device. REFERENCES [1] Tmp35/tmp36/tmp37 low voltage temperature sensors. cloudfront.net/datasheets/sensors/temp/tmp35_36_37.pdf. [2] Arduino.cc. Arduino leonardo [3] Arduino.cc. Arduino software download [4] Arduino.cc. Arduino uno [5] Arduino.cc. Introduction [6] Arduino.cc. map() [7] Arduino.cc. Pinmode() [8] Arduino.cc. Reference page [9] Marshal Colville. Process control with a microcontroller pwm output, pid control, and hardware implementation [10] processing.org. Processing programming language

23 [11] SparkFun. Tmp36 - temperature sensor [12] Wikipedia. Pulse-width modulation [13] Wikipedia. Microcontroller [14] Wikipedia. Pid controller [15] Wikipedia. Surface-mount technology [16] Wikipedia. Through-hole technology [17] [18] Connecting a phoresistor 1 So we get 10-bit reading capabilities with a 8-bit arduino microprocessor. You can find a description of the trick at

INTRODUCTION to MICRO-CONTROLLERS

INTRODUCTION to MICRO-CONTROLLERS PH-315 Portland State University INTRODUCTION to MICRO-CONTROLLERS Bret Comnes, Dan Lankow, and Andres La Rosa 1. ABSTRACT A microcontroller is an integrated circuit containing a processor and programmable

More information

INTRODUCTION to MICRO-CONTROLLERS

INTRODUCTION to MICRO-CONTROLLERS PH-315 Portland State University INTRODUCTION to MICRO-CONTROLLERS Bret Comnes and A. La Rosa 1. ABSTRACT This laboratory session pursues getting familiar with the operation of microcontrollers, namely

More information

MICROCONTROLLERS BASIC INPUTS and OUTPUTS (I/O)

MICROCONTROLLERS BASIC INPUTS and OUTPUTS (I/O) PH-315 Portland State University MICROCONTROLLERS BASIC INPUTS and OUTPUTS (I/O) ABSTRACT A microcontroller is an integrated circuit containing a processor and programmable read-only memory, 1 which is

More information

MICROCONTROLLERS BASIC INPUTS and OUTPUTS (I/O)

MICROCONTROLLERS BASIC INPUTS and OUTPUTS (I/O) PH-315 Portland State University MICROCONTROLLERS BASIC INPUTS and OUTPUTS (I/O) ABSTRACT A microcontroller is an integrated circuit containing a processor and programmable read-only memory, 1 which is

More information

EE-110 Introduction to Engineering & Laboratory Experience Saeid Rahimi, Ph.D. Labs Introduction to Arduino

EE-110 Introduction to Engineering & Laboratory Experience Saeid Rahimi, Ph.D. Labs Introduction to Arduino EE-110 Introduction to Engineering & Laboratory Experience Saeid Rahimi, Ph.D. Labs 10-11 Introduction to Arduino In this lab we will introduce the idea of using a microcontroller as a tool for controlling

More information

Arduino Lesson 1. Blink. Created by Simon Monk

Arduino Lesson 1. Blink. Created by Simon Monk Arduino Lesson 1. Blink Created by Simon Monk Guide Contents Guide Contents Overview Parts Part Qty The 'L' LED Loading the 'Blink' Example Saving a Copy of 'Blink' Uploading Blink to the Board How 'Blink'

More information

Lesson 3: Arduino. Goals

Lesson 3: Arduino. Goals Introduction: This project introduces you to the wonderful world of Arduino and how to program physical devices. In this lesson you will learn how to write code and make an LED flash. Goals 1 - Get to

More information

For this exercise, you will need a partner, an Arduino kit (in the plastic tub), and a laptop with the Arduino programming environment.

For this exercise, you will need a partner, an Arduino kit (in the plastic tub), and a laptop with the Arduino programming environment. Physics 222 Name: Exercise 6: Mr. Blinky This exercise is designed to help you wire a simple circuit based on the Arduino microprocessor, which is a particular brand of microprocessor that also includes

More information

MAE106 Laboratory Exercises Lab # 1 - Laboratory tools

MAE106 Laboratory Exercises Lab # 1 - Laboratory tools MAE106 Laboratory Exercises Lab # 1 - Laboratory tools University of California, Irvine Department of Mechanical and Aerospace Engineering Goals To learn how to use the oscilloscope, function generator,

More information

Coding with Arduino to operate the prosthetic arm

Coding with Arduino to operate the prosthetic arm Setup Board Install FTDI Drivers This is so that your RedBoard will be able to communicate with your computer. If you have Windows 8 or above you might already have the drivers. 1. Download the FTDI driver

More information

J. La Favre Using Arduino with Raspberry Pi February 7, 2018

J. La Favre Using Arduino with Raspberry Pi February 7, 2018 As you have already discovered, the Raspberry Pi is a very capable digital device. Nevertheless, it does have some weaknesses. For example, it does not produce a clean pulse width modulation output (unless

More information

INA169 Breakout Board Hookup Guide

INA169 Breakout Board Hookup Guide Page 1 of 10 INA169 Breakout Board Hookup Guide CONTRIBUTORS: SHAWNHYMEL Introduction Have a project where you want to measure the current draw? Need to carefully monitor low current through an LED? The

More information

Programming 2 Servos. Learn to connect and write code to control two servos.

Programming 2 Servos. Learn to connect and write code to control two servos. Programming 2 Servos Learn to connect and write code to control two servos. Many students who visit the lab and learn how to use a Servo want to use 2 Servos in their project rather than just 1. This lesson

More information

Understanding the Arduino to LabVIEW Interface

Understanding the Arduino to LabVIEW Interface E-122 Design II Understanding the Arduino to LabVIEW Interface Overview The Arduino microcontroller introduced in Design I will be used as a LabVIEW data acquisition (DAQ) device/controller for Experiments

More information

Module: Arduino as Signal Generator

Module: Arduino as Signal Generator Name/NetID: Teammate/NetID: Module: Laboratory Outline In our continuing quest to access the development and debugging capabilities of the equipment on your bench at home Arduino/RedBoard as signal generator.

More information

CURIE Academy, Summer 2014 Lab 2: Computer Engineering Software Perspective Sign-Off Sheet

CURIE Academy, Summer 2014 Lab 2: Computer Engineering Software Perspective Sign-Off Sheet Lab : Computer Engineering Software Perspective Sign-Off Sheet NAME: NAME: DATE: Sign-Off Milestone TA Initials Part 1.A Part 1.B Part.A Part.B Part.C Part 3.A Part 3.B Part 3.C Test Simple Addition Program

More information

FABO ACADEMY X ELECTRONIC DESIGN

FABO ACADEMY X ELECTRONIC DESIGN ELECTRONIC DESIGN MAKE A DEVICE WITH INPUT & OUTPUT The Shanghaino can be programmed to use many input and output devices (a motor, a light sensor, etc) uploading an instruction code (a program) to it

More information

TWEAK THE ARDUINO LOGO

TWEAK THE ARDUINO LOGO TWEAK THE ARDUINO LOGO Using serial communication, you'll use your Arduino to control a program on your computer Discover : serial communication with a computer program, Processing Time : 45 minutes Level

More information

.:Twisting:..:Potentiometers:.

.:Twisting:..:Potentiometers:. CIRC-08.:Twisting:..:Potentiometers:. WHAT WE RE DOING: Along with the digital pins, the also has 6 pins which can be used for analog input. These inputs take a voltage (from 0 to 5 volts) and convert

More information

CPSC 226 Lab Four Spring 2018

CPSC 226 Lab Four Spring 2018 CPSC 226 Lab Four Spring 2018 Directions. This lab is a quick introduction to programming your Arduino to do some basic internal operations and arithmetic, perform character IO, read analog voltages, drive

More information

Lab 2: Blinkie Lab. Objectives. Materials. Theory

Lab 2: Blinkie Lab. Objectives. Materials. Theory Lab 2: Blinkie Lab Objectives This lab introduces the Arduino Uno as students will need to use the Arduino to control their final robot. Students will build a basic circuit on their prototyping board and

More information

HAW-Arduino. Sensors and Arduino F. Schubert HAW - Arduino 1

HAW-Arduino. Sensors and Arduino F. Schubert HAW - Arduino 1 HAW-Arduino Sensors and Arduino 14.10.2010 F. Schubert HAW - Arduino 1 Content of the USB-Stick PDF-File of this script Arduino-software Source-codes Helpful links 14.10.2010 HAW - Arduino 2 Report for

More information

Attribution Thank you to Arduino and SparkFun for open source access to reference materials.

Attribution Thank you to Arduino and SparkFun for open source access to reference materials. Attribution Thank you to Arduino and SparkFun for open source access to reference materials. Contents Parts Reference... 1 Installing Arduino... 7 Unit 1: LEDs, Resistors, & Buttons... 7 1.1 Blink (Hello

More information

1Getting Started SIK BINDER //3

1Getting Started SIK BINDER //3 SIK BINDER //1 SIK BINDER //2 1Getting Started SIK BINDER //3 Sparkfun Inventor s Kit Teacher s Helper These worksheets and handouts are supplemental material intended to make the educator s job a little

More information

Portland State University MICROCONTROLLERS

Portland State University MICROCONTROLLERS PH-315 MICROCONTROLLERS INTERRUPTS and ACCURATE TIMING I Portland State University OBJECTIVE We aim at becoming familiar with the concept of interrupt, and, through a specific example, learn how to implement

More information

LED + Servo 2 devices, 1 Arduino

LED + Servo 2 devices, 1 Arduino LED + Servo 2 devices, 1 Arduino Learn to connect and write code to control both a Servo and an LED at the same time. Many students who come through the lab ask if they can use both an LED and a Servo

More information

LESSONS Lesson 1. Microcontrollers and SBCs. The Big Idea: Lesson 1: Microcontrollers and SBCs. Background: What, precisely, is computer science?

LESSONS Lesson 1. Microcontrollers and SBCs. The Big Idea: Lesson 1: Microcontrollers and SBCs. Background: What, precisely, is computer science? LESSONS Lesson Lesson : Microcontrollers and SBCs Microcontrollers and SBCs The Big Idea: This book is about computer science. It is not about the Arduino, the C programming language, electronic components,

More information

Rodni What will yours be?

Rodni What will yours be? Rodni What will yours be? version 4 Welcome to Rodni, a modular animatronic animal of your own creation for learning how easy it is to enter the world of software programming and micro controllers. During

More information

Arduino An Introduction

Arduino An Introduction Arduino An Introduction Hardware and Programming Presented by Madu Suthanan, P. Eng., FEC. Volunteer, Former Chair (2013-14) PEO Scarborough Chapter 2 Arduino for Mechatronics 2017 This note is for those

More information

Objectives: Learn what an Arduino is and what it can do Learn what an LED is and how to use it Be able to wire and program an LED to blink

Objectives: Learn what an Arduino is and what it can do Learn what an LED is and how to use it Be able to wire and program an LED to blink Objectives: Learn what an Arduino is and what it can do Learn what an LED is and how to use it Be able to wire and program an LED to blink By the end of this session: You will know how to use an Arduino

More information

Programming a Servo. Servo. Red Wire. Black Wire. White Wire

Programming a Servo. Servo. Red Wire. Black Wire. White Wire Programming a Servo Learn to connect wires and write code to program a Servo motor. If you have gone through the LED Circuit and LED Blink exercises, you are ready to move on to programming a Servo. A

More information

Community College of Allegheny County Unit 4 Page #1. Timers and PWM Motor Control

Community College of Allegheny County Unit 4 Page #1. Timers and PWM Motor Control Community College of Allegheny County Unit 4 Page #1 Timers and PWM Motor Control Revised: Dan Wolf, 3/1/2018 Community College of Allegheny County Unit 4 Page #2 OBJECTIVES: Timers: Astable and Mono-Stable

More information

Application Note. Communication between arduino and IMU Software capturing the data

Application Note. Communication between arduino and IMU Software capturing the data Application Note Communication between arduino and IMU Software capturing the data ECE 480 Team 8 Chenli Yuan Presentation Prep Date: April 8, 2013 Executive Summary In summary, this application note is

More information

1. Introduction to Analog I/O

1. Introduction to Analog I/O EduCake Analog I/O Intro 1. Introduction to Analog I/O In previous chapter, we introduced the 86Duino EduCake, talked about EduCake s I/O features and specification, the development IDE and multiple examples

More information

Training Schedule. Robotic System Design using Arduino Platform

Training Schedule. Robotic System Design using Arduino Platform Training Schedule Robotic System Design using Arduino Platform Session - 1 Embedded System Design Basics : Scope : To introduce Embedded Systems hardware design fundamentals to students. Processor Selection

More information

Lab 5: Arduino Uno Microcontroller Innovation Fellows Program Bootcamp Prof. Steven S. Saliterman

Lab 5: Arduino Uno Microcontroller Innovation Fellows Program Bootcamp Prof. Steven S. Saliterman Lab 5: Arduino Uno Microcontroller Innovation Fellows Program Bootcamp Prof. Steven S. Saliterman Exercise 5-1: Familiarization with Lab Box Contents Objective: To review the items required for working

More information

MAKEVMA502 BASIC DIY KIT WITH ATMEGA2560 FOR ARDUINO USER MANUAL

MAKEVMA502 BASIC DIY KIT WITH ATMEGA2560 FOR ARDUINO USER MANUAL BASIC DIY KIT WITH ATMEGA2560 FOR ARDUINO USER MANUAL USER MANUAL 1. Introduction To all residents of the European Union Important environmental information about this product This symbol on the device

More information

Pulse Width Modulation and

Pulse Width Modulation and Pulse Width Modulation and analogwrite ( ); 28 Materials needed to wire one LED. Odyssey Board 1 dowel Socket block Wire clip (optional) 1 Female to Female (F/F) wire 1 F/F resistor wire LED Note: The

More information

Arduino STEAM Academy Arduino STEM Academy Art without Engineering is dreaming. Engineering without Art is calculating. - Steven K.

Arduino STEAM Academy Arduino STEM Academy Art without Engineering is dreaming. Engineering without Art is calculating. - Steven K. Arduino STEAM Academy Arduino STEM Academy Art without Engineering is dreaming. Engineering without Art is calculating. - Steven K. Roberts Page 1 See Appendix A, for Licensing Attribution information

More information

Arduino: Sensors for Fun and Non Profit

Arduino: Sensors for Fun and Non Profit Arduino: Sensors for Fun and Non Profit Slides and Programs: http://pamplin.com/dms/ Nicholas Webb DMS: @NickWebb 1 Arduino: Sensors for Fun and Non Profit Slides and Programs: http://pamplin.com/dms/

More information

APDS-9960 RGB and Gesture Sensor Hookup Guide

APDS-9960 RGB and Gesture Sensor Hookup Guide Page 1 of 12 APDS-9960 RGB and Gesture Sensor Hookup Guide Introduction Touchless gestures are the new frontier in the world of human-machine interfaces. By swiping your hand over a sensor, you can control

More information

Tarocco Closed Loop Motor Controller

Tarocco Closed Loop Motor Controller Contents Safety Information... 3 Overview... 4 Features... 4 SoC for Closed Loop Control... 4 Gate Driver... 5 MOSFETs in H Bridge Configuration... 5 Device Characteristics... 6 Installation... 7 Motor

More information

Interfacing with Other Programming Environments _Processing, _MAXMSP, _PureData,

Interfacing with Other Programming Environments _Processing,   _MAXMSP,   _PureData, + + + Interfacing with Other Programming Environments _Processing, http://processing.org/ _MAXMSP, http://cycling74.com/ _PureData, http://puredata.info/ Using the Firmata Library Firmata a generic protocol

More information

Welcome to Arduino Day 2016

Welcome to Arduino Day 2016 Welcome to Arduino Day 2016 An Intro to Arduino From Zero to Hero in an Hour! Paul Court (aka @Courty) Welcome to the SLMS Arduino Day 2016 Arduino / Genuino?! What?? Part 1 Intro Quick Look at the Uno

More information

Getting Started with the micro:bit

Getting Started with the micro:bit Page 1 of 10 Getting Started with the micro:bit Introduction So you bought this thing called a micro:bit what is it? micro:bit Board DEV-14208 The BBC micro:bit is a pocket-sized computer that lets you

More information

Computational Crafting with Arduino. Christopher Michaud Marist School ECEP Programs, Georgia Tech

Computational Crafting with Arduino. Christopher Michaud Marist School ECEP Programs, Georgia Tech Computational Crafting with Arduino Christopher Michaud Marist School ECEP Programs, Georgia Tech Introduction What do you want to learn and do today? Goals with Arduino / Computational Crafting Purpose

More information

ZX Distance and Gesture Sensor Hookup Guide

ZX Distance and Gesture Sensor Hookup Guide Page 1 of 13 ZX Distance and Gesture Sensor Hookup Guide Introduction The ZX Distance and Gesture Sensor is a collaboration product with XYZ Interactive. The very smart people at XYZ Interactive have created

More information

Lesson 13. The Big Idea: Lesson 13: Infrared Transmitters

Lesson 13. The Big Idea: Lesson 13: Infrared Transmitters Lesson Lesson : Infrared Transmitters The Big Idea: In Lesson 12 the ability to detect infrared radiation modulated at 38,000 Hertz was added to the Arduino. This lesson brings the ability to generate

More information

EGG 101L INTRODUCTION TO ENGINEERING EXPERIENCE

EGG 101L INTRODUCTION TO ENGINEERING EXPERIENCE EGG 101L INTRODUCTION TO ENGINEERING EXPERIENCE LABORATORY 7: IR SENSORS AND DISTANCE DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING UNIVERSITY OF NEVADA, LAS VEGAS GOAL: This section will introduce

More information

You'll create a lamp that turns a light on and off when you touch a piece of conductive material

You'll create a lamp that turns a light on and off when you touch a piece of conductive material TOUCHY-FEELY LAMP You'll create a lamp that turns a light on and off when you touch a piece of conductive material Discover : installing third party libraries, creating a touch sensor Time : 5 minutes

More information

Arduino Microcontroller Processing for Everyone!: Third Edition / Steven F. Barrett

Arduino Microcontroller Processing for Everyone!: Third Edition / Steven F. Barrett Arduino Microcontroller Processing for Everyone!: Third Edition / Steven F. Barrett Anatomy of a Program Programs written for a microcontroller have a fairly repeatable format. Slight variations exist

More information

On the front of the board there are a number of components that are pretty visible right off the bat!

On the front of the board there are a number of components that are pretty visible right off the bat! Hardware Overview The micro:bit has a lot to offer when it comes to onboard inputs and outputs. In fact, there are so many things packed onto this little board that you would be hard pressed to really

More information

Light Emitting Diode IV Characterization

Light Emitting Diode IV Characterization Light Emitting Diode IV Characterization In this lab you will build a basic current-voltage characterization tool and determine the IV response of a set of light emitting diodes (LEDs) of various wavelengths.

More information

Practical Assignment 1: Arduino interface with Simulink

Practical Assignment 1: Arduino interface with Simulink !! Department of Electrical Engineering Indian Institute of Technology Dharwad EE 303: Control Systems Practical Assignment - 1 Adapted from Take Home Labs, Oklahoma State University Practical Assignment

More information

Introduction to. An Open-Source Prototyping Platform. Hans-Petter Halvorsen

Introduction to. An Open-Source Prototyping Platform. Hans-Petter Halvorsen Introduction to An Open-Source Prototyping Platform Hans-Petter Halvorsen Contents 1.Overview 2.Installation 3.Arduino Starter Kit 4.Arduino TinkerKit 5.Arduino Examples 6.LabVIEW Interface for Arduino

More information

Lab 4 Rev. 1 Open Lab Due COB Friday April 6, 2018

Lab 4 Rev. 1 Open Lab Due COB Friday April 6, 2018 EE314 Systems Spring Semester 2018 College of Engineering Prof. C.R. Tolle South Dakota School of Mines & Technology Lab 4 Rev. 1 Open Lab Due COB Friday April 6, 2018 In this lab we will setup Matlab

More information

Embedded Test System. Design and Implementation of Digital to Analog Converter. TEAM BIG HERO 3 John Sopczynski Karim Shik-Khahil Yanzhe Zhao

Embedded Test System. Design and Implementation of Digital to Analog Converter. TEAM BIG HERO 3 John Sopczynski Karim Shik-Khahil Yanzhe Zhao Embedded Test System Design and Implementation of Digital to Analog Converter TEAM BIG HERO 3 John Sopczynski Karim Shik-Khahil Yanzhe Zhao EE 300W Section 1 Spring 2015 Big Hero 3 DAC 2 INTRODUCTION (KS)

More information

Figure 1. Digilent DC Motor

Figure 1. Digilent DC Motor Laboratory 9 - Usage of DC- and servo-motors The current laboratory describes the usage of DC and servomotors 1. DC motors Figure 1. Digilent DC Motor Classical DC motors are converting electrical energy

More information

Lab Exercise 9: Stepper and Servo Motors

Lab Exercise 9: Stepper and Servo Motors ME 3200 Mechatronics Laboratory Lab Exercise 9: Stepper and Servo Motors Introduction In this laboratory exercise, you will explore some of the properties of stepper and servomotors. These actuators are

More information

Microcontrollers and Interfacing

Microcontrollers and Interfacing Microcontrollers and Interfacing Week 07 digital input, debouncing, interrupts and concurrency College of Information Science and Engineering Ritsumeikan University 1 this week digital input push-button

More information

micro:bit Basics The basic programming interface, utilizes Block Programming and Javascript2. It can be found at

micro:bit Basics The basic programming interface, utilizes Block Programming and Javascript2. It can be found at Name: Class: micro:bit Basics What is a micro:bit? The micro:bit is a small computer1, created to teach computing and electronics. You can use it on its own, or connect it to external devices. People have

More information

Name & SID 1 : Name & SID 2:

Name & SID 1 : Name & SID 2: EE40 Final Project-1 Smart Car Name & SID 1 : Name & SID 2: Introduction The final project is to create an intelligent vehicle, better known as a robot. You will be provided with a chassis(motorized base),

More information

Disclaimer. Arduino Hands-On 2 CS5968 / ART4455 9/1/10. ! Many of these slides are mine. ! But, some are stolen from various places on the web

Disclaimer. Arduino Hands-On 2 CS5968 / ART4455 9/1/10. ! Many of these slides are mine. ! But, some are stolen from various places on the web Arduino Hands-On 2 CS5968 / ART4455 Disclaimer! Many of these slides are mine! But, some are stolen from various places on the web! todbot.com Bionic Arduino and Spooky Arduino class notes from Tod E.Kurt!

More information

EE 314 Spring 2003 Microprocessor Systems

EE 314 Spring 2003 Microprocessor Systems EE 314 Spring 2003 Microprocessor Systems Laboratory Project #9 Closed Loop Control Overview and Introduction This project will bring together several pieces of software and draw on knowledge gained in

More information

EVDP610 IXDP610 Digital PWM Controller IC Evaluation Board

EVDP610 IXDP610 Digital PWM Controller IC Evaluation Board IXDP610 Digital PWM Controller IC Evaluation Board General Description The IXDP610 Digital Pulse Width Modulator (DPWM) is a programmable CMOS LSI device, which accepts digital pulse width data from a

More information

Workshops Elisava Introduction to programming and electronics (Scratch & Arduino)

Workshops Elisava Introduction to programming and electronics (Scratch & Arduino) Workshops Elisava 2011 Introduction to programming and electronics (Scratch & Arduino) What is programming? Make an algorithm to do something in a specific language programming. Algorithm: a procedure

More information

MAX11300PMB1 Peripheral Module and Munich (USB2PMB1) Adapter Board Quick Start Guide

MAX11300PMB1 Peripheral Module and Munich (USB2PMB1) Adapter Board Quick Start Guide MAX11300PMB1 Peripheral Module and Munich (USB2PMB1) Adapter Board Quick Start Guide Rev 0; 7/14 For pricing, delivery, and ordering information, please contact Maxim Direct at 1-888-629-4642, or visit

More information

Touch Potentiometer Hookup Guide

Touch Potentiometer Hookup Guide Page 1 of 14 Touch Potentiometer Hookup Guide Introduction The Touch Potentiometer, or Touch Pot for short, is an intelligent, linear capacitive touch sensor that implements potentiometer functionality

More information

MD04-24Volt 20Amp H Bridge Motor Drive

MD04-24Volt 20Amp H Bridge Motor Drive MD04-24Volt 20Amp H Bridge Motor Drive Overview The MD04 is a medium power motor driver, designed to supply power beyond that of any of the low power single chip H-Bridges that exist. Main features are

More information

GE423 Laboratory Assignment 6 Robot Sensors and Wall-Following

GE423 Laboratory Assignment 6 Robot Sensors and Wall-Following GE423 Laboratory Assignment 6 Robot Sensors and Wall-Following Goals for this Lab Assignment: 1. Learn about the sensors available on the robot for environment sensing. 2. Learn about classical wall-following

More information

Community College of Allegheny County Unit 7 Page #1. Analog to Digital

Community College of Allegheny County Unit 7 Page #1. Analog to Digital Community College of Allegheny County Unit 7 Page #1 Analog to Digital "Engineers can't focus just on technology; they need to develop their professional skills-things like presenting yourself, speaking

More information

1 Introduction. 2 Embedded Electronics Primer. 2.1 The Arduino

1 Introduction. 2 Embedded Electronics Primer. 2.1 The Arduino Beginning Embedded Electronics for Botballers Using the Arduino Matthew Thompson Allen D. Nease High School matthewbot@gmail.com 1 Introduction Robotics is a unique and multidisciplinary field, where successful

More information

Experiment 1: Robot Moves in 3ft squared makes sound and

Experiment 1: Robot Moves in 3ft squared makes sound and Experiment 1: Robot Moves in 3ft squared makes sound and turns on an LED at each turn then stop where it started. Edited: 9-7-2015 Purpose: Press a button, make a sound and wait 3 seconds before starting

More information

SCHOOL OF TECHNOLOGY AND PUBLIC MANAGEMENT ENGINEERING TECHNOLOGY DEPARTMENT

SCHOOL OF TECHNOLOGY AND PUBLIC MANAGEMENT ENGINEERING TECHNOLOGY DEPARTMENT SCHOOL OF TECHNOLOGY AND PUBLIC MANAGEMENT ENGINEERING TECHNOLOGY DEPARTMENT Course ENGT 3260 Microcontrollers Summer III 2015 Instructor: Dr. Maged Mikhail Project Report Submitted By: Nicole Kirch 7/10/2015

More information

Lab 12: Timing sequencer (Version 1.3)

Lab 12: Timing sequencer (Version 1.3) Lab 12: Timing sequencer (Version 1.3) WARNING: Use electrical test equipment with care! Always double-check connections before applying power. Look for short circuits, which can quickly destroy expensive

More information

Application Note AN 102: Arduino I2C Interface to K 30 Sensor

Application Note AN 102: Arduino I2C Interface to K 30 Sensor Application Note AN 102: Arduino I2C Interface to K 30 Sensor Introduction The Arduino UNO, MEGA 1280 or MEGA 2560 are ideal microcontrollers for operating SenseAir s K 30 CO2 sensor. The connection to

More information

DC Motor and Servo motor Control with ARM and Arduino. Created by:

DC Motor and Servo motor Control with ARM and Arduino. Created by: DC Motor and Servo motor Control with ARM and Arduino Created by: Andrew Kaler (39345) Tucker Boyd (46434) Mohammed Chowdhury (860822) Tazwar Muttaqi (901700) Mark Murdock (98071) May 4th, 2017 Objective

More information

Demon Pumpkin APPROXIMATE TIME (EXCLUDING PREPARATION WORK): 1 HOUR PREREQUISITES: PART LIST:

Demon Pumpkin APPROXIMATE TIME (EXCLUDING PREPARATION WORK): 1 HOUR PREREQUISITES: PART LIST: Demon Pumpkin This is a lab guide for creating your own simple animatronic pumpkin. This project encourages students and makers to innovate upon the base design to add their own personal touches. APPROXIMATE

More information

Internet of Things Student STEM Project Jackson High School. Lesson 2: Arduino and LED

Internet of Things Student STEM Project Jackson High School. Lesson 2: Arduino and LED Internet of Things Student STEM Project Jackson High School Lesson 2: Arduino and LED Lesson 2: Arduino and LED Time to complete Lesson 60-minute class period Learning objectives Students learn about Arduino

More information

EARTH PEOPLE TECHNOLOGY. EPT-200TMP-TS-U2 Temperature Sensor Docking Board User Manual

EARTH PEOPLE TECHNOLOGY. EPT-200TMP-TS-U2 Temperature Sensor Docking Board User Manual EARTH PEOPLE TECHNOLOGY EPT-200TMP-TS-U2 Temperature Sensor Docking Board User Manual The EPT-200TMP-TS-U2 is a temperature sensor mounted on a docking board. The board is designed to fit onto the Arduino

More information

Arduino

Arduino Arduino Class Kit Contents A Word on Safety Electronics can hurt you Lead in some of the parts Wash up afterwards You can hurt electronics Static-sensitive: don t shuffle your feet & touch Wires only

More information

Gravity: 12-Bit I2C DAC Module SKU: DFR0552

Gravity: 12-Bit I2C DAC Module SKU: DFR0552 Gravity: 12-Bit I2C DAC Module SKU: DFR0552 Introduction DFRobot Gravity 12-Bit I2C DAC is a small and easy-to-use 12-bit digital-to-analog converter with EEPROM. It can accurately convert the digital

More information

Arduino Setup & Flexing the ExBow

Arduino Setup & Flexing the ExBow Arduino Setup & Flexing the ExBow What is Arduino? Before we begin, We must first download the Arduino and Ardublock software. For our Set-up we will be using Arduino. Arduino is an electronics platform.

More information

Lab 12 Laboratory 12 Data Acquisition Required Special Equipment: 12.1 Objectives 12.2 Introduction 12.3 A/D basics

Lab 12 Laboratory 12 Data Acquisition Required Special Equipment: 12.1 Objectives 12.2 Introduction 12.3 A/D basics Laboratory 12 Data Acquisition Required Special Equipment: Computer with LabView Software National Instruments USB 6009 Data Acquisition Card 12.1 Objectives This lab demonstrates the basic principals

More information

Milli Developer Kit Reference Application Published on Silver Spring Networks STAGE (

Milli Developer Kit Reference Application Published on Silver Spring Networks STAGE ( Milli Developer Kit Example Application PART 1 Example CoAP Server Sensor Implementation With The Milli Dev Kit Get the Milli Developer Kit Temperature Sensor Reference Application on GitHub [1] This reference

More information

Arduino Digital Out_QUICK RECAP

Arduino Digital Out_QUICK RECAP Arduino Digital Out_QUICK RECAP BLINK File> Examples>Digital>Blink int ledpin = 13; // LED connected to digital pin 13 // The setup() method runs once, when the sketch starts void setup() // initialize

More information

Servomotor Control with Arduino Integrated Development Environment. Application Notes. Bingyang Wu Mar 27, Introduction

Servomotor Control with Arduino Integrated Development Environment. Application Notes. Bingyang Wu Mar 27, Introduction Servomotor Control with Arduino Integrated Development Environment Application Notes Bingyang Wu Mar 27, 2015 Introduction Arduino is a tool for making computers that can sense and control more of the

More information

Industrial Automation Training Academy. Arduino, LabVIEW & PLC Training Programs Duration: 6 Months (180 ~ 240 Hours)

Industrial Automation Training Academy. Arduino, LabVIEW & PLC Training Programs Duration: 6 Months (180 ~ 240 Hours) nfi Industrial Automation Training Academy Presents Arduino, LabVIEW & PLC Training Programs Duration: 6 Months (180 ~ 240 Hours) For: Electronics & Communication Engineering Electrical Engineering Instrumentation

More information

EEC WINTER Instructor: Xiaoguang Leo" Liu. Application Note. Baseband Design. Duyen Tran ID#: Team DMK

EEC WINTER Instructor: Xiaoguang Leo Liu. Application Note. Baseband Design. Duyen Tran ID#: Team DMK EEC 134 --- WINTER 2016 Instructor: Xiaoguang Leo" Liu Application Note Baseband Design Duyen Tran ID#: 999246920 Team DMK 1 This application note provides the process to design the baseband of the radar

More information

CONSTRUCTION GUIDE Capacitor, Transistor & Motorbike. Robobox. Level VII

CONSTRUCTION GUIDE Capacitor, Transistor & Motorbike. Robobox. Level VII CONSTRUCTION GUIDE Capacitor, Transistor & Motorbike Robobox Level VII Capacitor, Transistor & Motorbike In this box, we will understand in more detail the operation of DC motors, transistors and capacitor.

More information

Adafruit 16-Channel Servo Driver with Arduino

Adafruit 16-Channel Servo Driver with Arduino Adafruit 16-Channel Servo Driver with Arduino Created by Bill Earl Last updated on 2015-09-29 06:19:37 PM EDT Guide Contents Guide Contents Overview Assembly Install the Servo Headers Solder all pins Add

More information

Instrumentation and Microcontrollers Using Automatic Code Generation

Instrumentation and Microcontrollers Using Automatic Code Generation Instrumentation and Microcontrollers Using Automatic Code Generation Using and Applying Microcontrollers for the Rest of Us! Marc E Herniter 2013 Marc E. Herniter, Rose-Hulman Institute of Technology,

More information

smraza Getting Start Guide Contents Arduino IDE (Integrated Development Environment)... 1 Introduction... 1 Install the Arduino Software (IDE)...

smraza Getting Start Guide Contents Arduino IDE (Integrated Development Environment)... 1 Introduction... 1 Install the Arduino Software (IDE)... Getting Start Guide Contents Arduino IDE (Integrated Development Environment)... 1 Introduction... 1 Install the Arduino Software (IDE)...1 Introduction... 1 Step 1: Get an Uno R3 and USB cable... 2 Step

More information

OVEN INDUSTRIES, INC. Model 5C7-362

OVEN INDUSTRIES, INC. Model 5C7-362 OVEN INDUSTRIES, INC. OPERATING MANUAL Model 5C7-362 THERMOELECTRIC MODULE TEMPERATURE CONTROLLER TABLE OF CONTENTS Features... 1 Description... 2 Block Diagram... 3 RS232 Communications Connections...

More information

PLAN DE FORMACIÓN EN LENGUAS EXTRANJERAS IN-57 Technology for ESO: Contents and Strategies

PLAN DE FORMACIÓN EN LENGUAS EXTRANJERAS IN-57 Technology for ESO: Contents and Strategies Lesson Plan: Traffic light with Arduino using code, S4A and Ardublock Course 3rd ESO Technology, Programming and Robotic David Lobo Martínez David Lobo Martínez 1 1. TOPIC Arduino is an open source hardware

More information

Precalculations Individual Portion Introductory Lab: Basic Operation of Common Laboratory Instruments

Precalculations Individual Portion Introductory Lab: Basic Operation of Common Laboratory Instruments Name: Date of lab: Section number: M E 345. Lab 1 Precalculations Individual Portion Introductory Lab: Basic Operation of Common Laboratory Instruments Precalculations Score (for instructor or TA use only):

More information

Using Transistors and Driving Motors

Using Transistors and Driving Motors Chapter 4 Using Transistors and Driving Motors Parts You ll Need for This Chapter: Arduino Uno USB cable 9V battery 9V battery clip 5V L4940V5 linear regulator 22uF electrolytic capacitor.1uf electrolytic

More information

CONSTRUCTION GUIDE IR Alarm. Robobox. Level I

CONSTRUCTION GUIDE IR Alarm. Robobox. Level I CONSTRUCTION GUIDE Robobox Level I This month s montage is an that will allow you to detect any intruder. When a movement is detected, the alarm will turn its LEDs on and buzz to a personalized tune. 1X

More information

Prelab: Introduction and Greenhouse Construction

Prelab: Introduction and Greenhouse Construction Prelab: Introduction and Greenhouse Construction In this lab, you will create a PID control system that will regulate temperature and humidity of a greenhouse-like enclosure. You will learn the concepts

More information

PWM CONTROL USING ARDUINO. Learn to Control DC Motor Speed and LED Brightness

PWM CONTROL USING ARDUINO. Learn to Control DC Motor Speed and LED Brightness PWM CONTROL USING ARDUINO Learn to Control DC Motor Speed and LED Brightness In this article we explain how to do PWM (Pulse Width Modulation) control using arduino. If you are new to electronics, we have

More information