Lab 6 Introduction to Serial and Wireless Communication

Save this PDF as:
 WORD  PNG  TXT  JPG

Size: px
Start display at page:

Download "Lab 6 Introduction to Serial and Wireless Communication"

Transcription

1 University of Pennsylvania Department of Electrical and Systems Engineering ESE 111 Intro to Elec/Comp/Sys Engineering Lab 6 Introduction to Serial and Wireless Communication Introduction: Up to this point, you have only used sensors and pushbuttons to control the input to your Arduino. You will now learn how to receive communication signals or commands on the Arduino from the serial port. You have used Serial.print() to transmit communication signals to the serial monitor. Serial.read() will allow to you send characters from the input line on the serial monitor to the Arduino. First, you will learn how to send commands to the Arduino via the serial port using the keyboard and how to interpret the input. You will use these commands to control the behavior of an LED. Then, you will learn how to use two XBee modules to transmit and receive information wirelessly. XBee is a brand of low-power radio transmitter/receiver, based on the ZigBee digital communication protocol, which uses the serial port to communicate. You will program one Arduino board to transmit one byte per second through an XBee module. The other Arduino will receive the byte through an XBee module configured on the same channel as the transmitter, and it will turn an LED on or off based on the identity of the byte. Next, you will use the XBee modules to remotely control an LED on one Arduino with a photoresistor on another Arduino. Finally, you will transmit accelerometer data wirelessly to control the brightness of an LED using pulse width modulation (PWM). Created by Nick Howarth, EE 13 Last updated by Joe Trovato in Fall 2014 Figure 1: Transmitter and Receiver Modules

2 Goals: - To understand the basics of serial communication. - To learn about ASCII encoding and the different formats of a variable. - To wirelessly control the lighting of an LED using Zigbee. - To understand pulse width modulation (PWM). 1. Introduction to Serial Communication (Adapted excerpt from BE 470, Lab 3; written by Prof. Dan Bogen) Serial.read() is an Arduino function that allows to you send characters from the input line on the serial monitor to the Arduino. It is important to note on the Arduino Leonardo, there are two serial ports. The first one uses the class Serial, this class is used to print to the computers serial monitor. The second class is Serial1; this class is used for XBee communication and will not show up on the serial monitor. Serial and Serial1 contains all of the same function but are called in different ways. For example to read a character you could use Serial.read() or Serial1.read(). The Serial.read() function is used like this: int inputcharacter; inputcharacter = Serial.read(); Serial.read() takes its input from the serial port, the same port that is used for Serial.print(). In this lab you will receive serial input and output from the serial monitor.to initialize the serial port and be able to use these functions, you need to use the Serial.begin(9600) instruction in the setup() function of your Arduino code. Serial.read() is a bit of a pain to use because it only can take in one character at a time. It can t just accept the number 123 and know that it means one-hundred-twenty-three. Instead, you have to take in the 1 character, 2 character, and 3 character, and then let the Arduino know that you want the number Serial.read() will wait until a character is available before returning a value. So if there is nothing there, it will hang until a serial character is available to be read.. This means that it sometimes makes sense to check whether there are characters present (using Serial.available()) before using Serial.read(). Serial.available() returns the number of available serial characters. But if a whole string of characters is being sent to the Arduino, Serial.available() will be > 0 before all the characters get to the Arduino. For this reason, sometimes it makes sense to wait a few milliseconds (maybe 5) after Serial.available() > 0 before reading the characters in so 2

3 that you know that they are all there. Another function related to Serial.read() is Serial.flush(). The serial port has an input buffer, so there may be some characters left over in the buffer that you don t want to read. Serial.flush() empties this buffer so that you can read new characters. The characters are received as numerical codes a number corresponding to each alphanumeric character on the keyboard. Part of the table of codes is shown below. For instance, the letter a is coded by the number 97, and capital A by 65. The 1 character is coded by the number 49, the 2 character by the number 50, and so on. One useful feature of the Arduino language is that the expression X, where X is a single character (i.e., a single character enclosed by single quotes) is equal to the numerical code for that character. For instance a = 95, 1 = 49, etc. This will be useful in Arduino programming, as we will see a little later. These codes are called ASCII codes, ASCII standing for American Standard Code for Information Interchange. A table of ASCII representations can be found at the following link: (you only need to know the Dec (decimal) and Char (character) columns). Prelab Question 1: Please convert the following bytes or strings of bytes to their ASCII equivalent. a b c This part of the lab will attempt to illuminate the different formats a serial byte can be represented as. As you saw in the ASCII table the same data can be represented in many different ways. It is important to always know what format your data is in so you can use it later without needed to decode its format or guess at what the actual data is. Please copy the code below or from the provide text file into an Arduino sketch. void setup(){ Serial.begin(9600); //initializes the serial port void loop(){ int input_char; if( Serial.available() > 0 ){ input_char = Serial.read(); Serial.print(input_char); 3

4 Serial.print('\n'); //print a new line for readability This code prints out the serial data as it is received. Now add the following two lines between Serial.print(input_char) and Serial.print('\n'). Serial.print('\t'); Serial.print((char)input_char); These lines print the input character in the char format as well as the original integer format. See the difference? Spell out your favorite candy and show a TA! As we mentioned earlier, numbers must be built one digit at time. Copy the following code into a new Arduino sketch. Make sure to keep the old sketch open as well. void setup(){ Serial.begin(9600); void loop(){ int inputchar; int inputnumber; inputnumber = 0; if( Serial.available() > 0 ){// build the number as long as there are characters delay(5); while (Serial.available() > 0) { inputchar = Serial.read();// build number from left to right, shifting left by multiplying by 10 inputnumber = inputnumber*10 + (inputchar - '0'); // why inputchar 0? Make sure you understand this! Serial.print(inputNumber); Try entering different numbers into the Serial Monitor. The program should echo the number back to you. Which numbers behave differently than the first program? Think about this difference to prepare for the post lab. Prelab Question 2: a. Why do we write input_char 0 when trying to convert the result of Serial.read() to a number? Hint: Think about the ASCII table and what data type you are reading and what data type you want. 4

5 2. Control of an LED using input from keyboard 1) Write a program that accepts a character input from the serial monitor. The on-board LED connected to pin 13 should turn on if the input is H, and the LED on pin 13 should turn off if the input is L. Otherwise, nothing should happen. Remember that case matters in ASCII encodings. a. Remember to initialize serial communication by putting Serial.begin(9600) in setup(). b. Remember to set pin 13 to an output by adding pinmode(13, OUTPUT)in setup(). c. Copy this code into a text file. You will need it for the next section and the postlab. 2) Write a program that reads in a number from the serial monitor. Use the input number to control the flashing rate of the LED on pin 13; that is, use the input number as the argument in your delay functions. a. Copy this code into a text file. You will need it for section 5 and the post-lab. 3. Remote Control of an LED using XBees In this section, you will wirelessly transmit H and L characters from one Arduino to another Arduino (instead of from keyboard to Arduino), and the receiver will turn on or off an LED accordingly, as in the previous section. This wireless communication is possible using XBees. The XBee modules work by transmitting data in the form of bytes (e.g. ASCII characters) through the serial port. This means that any character that is printed to the serial monitor (from the transmitter) is received on the other module. You can fetch these characters on the receiving end the same way you would if you were just entering characters directly into the serial monitor. Only XBees that are on the same channel will be able to communicate with each other; this is what allows us to have multiple pairs of XBees communicating in one room without interference. Make sure that your XBee modules have the same number written on them. Receiver Module a. Connect the XBee Shield to the Arduino Board as shown in Figure 2 (or Figure 5). 5

6 Figure 5: Arduino with XBee Shield b. Upload the receiver code to the Arduino Upload the following code to the Transmitter Module. This code should accept a character input from the serial monitor. The on-board LED connected to pin 13 should turn on if the input is H, and the LED on pin 13 should turn off if the input is L. The only difference between this code and the code from the previous part is that the XBees use the Serial1 class to communicate, while the USB serial port used the Serial class. Transmitter Module c. Upload the following code to the Transmitter Arduino module void setup(){ Serial1.begin(9600); // initialize serial communication void loop(){ Serial1.print( L ) ; delay(1000); Serial1.print( H ) ; delay(1000); d. Observe the flashing LED The LED on the receiver module should blink on and off based on the serial data transmitted from the transmitter module. 6

7 4. Remote control of an LED using a photoresistor circuit and XBees This part requires you to construct a circuit on both the receiving and transmitting Arduino boards. However, there is no room to fit a breadboard on the Arduino since it is occupied by the XBee shield. For this reason, we have constructed extension shields that can hold a breadboard shield, XBee shield, and LCD screen all on one shield. The only limitation is that each component occupies a number of digital I/O pins; consequently, only two components can be used at a time. In this part of the lab, you will use the extension shield to hold the XBee shield and the breadboard shield. Connect your shields as shown in Figure 7. Transmitter Receiver Figure 7: Configuration of Arduino Shields on Extension Shield Transmitter Module a. Construct the circuit given by the schematic in Figure 8. Choose any analog pin (0-5). Figure 8: Transmitter voltage divider circuit 7

8 b. Upload the following code: int analogpin = ***; // change *** to the pin number you're reading from int value; void setup(){ Serial.begin(9600); // initialize serial communication Serial1.begin(9600); pinmode(analogpin, INPUT); void loop(){ value = analogread(analogpin); if(value >= 150){ // you may need to modify this argument Serial1.print( L ); delay(500); if(value < 150){ // you may need to modify this argument Serial1.print( D ); delay(500); Receiver Module c. Construct the circuit given by the schematic in Figure 9. Figure 9 - Receiver LED circuit d. Copy the following code into the Arduino IDE window. 8

9 const int ledpin = 12; // the pin that the LED is attached to int incomingbyte; // a variable to read incoming serial data into void setup() { Serial1.begin(9600); // initialize serial communication pinmode(ledpin, OUTPUT); // initialize the LED pin as an output void loop() { // your code here e. Finish writing the code above such that the LED turns on when the photocell on the transmitter is covered and is off otherwise. Demonstrate to a TA that your system works! 5. Remote control of an LED using an accelerometer and XBees For many applications of wireless communication, it is desirable to transmit a continuous, analog signal, such as data from an accelerometer or electromyograph (EMG). However, the XBee can only transmit and receive data in packets, where each packet is one byte, and one byte contains 8 bits (0 or 1) of information. (Note that in the previous part we were transmitting characters [designated by single quotes ], which only store one byte of information.) So how do we break up an analog signal (imagine a sine wave) into bytes? Well, we can sample the signal at regular time intervals to obtain the integer values that make up the signal. An integer stores 2 bytes of information, so it cannot be sent in this form through the serial port. Instead, integers are printed one byte at a time using ASCII characters corresponding to each digit. For example, if we were to transmit the number 4316 through the serial port, it would transmit the ASCII representations of 4, 3, 1, and 6 in series. These bytes can then be regrouped into an int on the receiving end, thus reconstructing the original integer. In this section, you will transmit integer values from an accelerometer and reconstruct them on the receiver. You will then use this data to control the brightness of an LED on the receiver. This is done using a technique pulse width modulation (PWM). For an good explanation of PWM, read the following reference page: - 9

10 An easy way to implement PWM is by using the Arduino s analogwrite() function. - Note that this function only works on digital pins 3, 5, 6, 9, 10, 11, and 13 (and has no connection to analogread() or the analog pins). By using the map() function from Lab 4, we can map the accelerometer values to a range of 0 to 255 (the range accepted by analogwrite()). Transmitter Module a. Connect an accelerometer to your transmitter module. b. Complete the following code so that the transmitter sends the y-axis value to the receiver every 250 seconds. Set the Arduino in USB mode and upload your code. const int groundpin = 18; const int powerpin = 19; const int ypin = 16; // analog input pin4 -- ground (GND) // analog input pin5 -- voltage (Vcc) // analog input pin2 -- y-axis pin int yvalue; void setup() { Serial1.begin(9600); pinmode(ypin, INPUT); pinmode(groundpin, OUTPUT); pinmode(powerpin, OUTPUT); digitalwrite(groundpin, LOW); // make analog pin (4) equivalent to GND (ground) digitalwrite(powerpin, HIGH); // make analog pin (5) equivalent to Vcc (voltage source) void loop(){ // your code here c. Set the Transmitter Arduino in XBee mode by connecting the jumpers. d. Using the output on the serial monitor, determine the minimum and maximum y-axis values. 10

11 Receiver Module e. Construct the circuit given by the schematic in Figure 10. Figure 10: Receiver LED circuit f. Set the Arduino in USB Programming mode (remove jumpers) and copy the following code into the Arduino IDE window. int ymin = ***; int ymax = ***; // Replace with measured minimum yvalue // Replace with measured maximum yvalue int yval; // incoming y-axis value void setup() { Serial1.begin(9600) ; void loop() { // insert code to reconstruct yval pwm = map(yval, ymin, ymax, 0, 255); analogwrite(9, pwm); g. Replace *** with the values that you found in part d. Finish writing the code to reconstruct the transmitted value from the accelerometer. Hint: look at Fragment #2 on page 4). h. Upload the finished code to the Arduino. i. Tilt the accelerometer on the transmitter and observe the LED brightness on the receiver. Demonstrate to a TA that your system works! 11

12 6. Post-Lab Questions: 1. What does casting an int received from Serial.read() to a char do? In other words explain why we print (char)input_char instead of just input_char. 2. Why do you think numbers cannot be built all at once? Why can letters be read in with only one byte but numbers often have problems. 3. In Part 3, you created a system to blink the Arduino s LED on and off every second. Rewrite the transmitter function to toggle the LED when the user input any character. You do not have to compile and upload this code. We just want to see the logic. 4. If analogwrite() was not available how would implement a function to produce a Pulse Width Mudulation (PWM) signal. A step by step algorithm or pseudo code will be accepted. EXTRA CREDIT: actually write it! 7. Thinking Further Biomedical Application With technology rapidly evolving, it is becoming possible for medical professionals to remotely observe and treat patients. This new form of medicine, called telemedicine, allows people in need of medical surveillance to move around comfortably at home while their physiological signals, such as heart rate, brain and muscle activity, etc., are wirelessly transmitted to a computer and sent to a medical center to be analyzed. Imagine a digital communication system consisting of two XBee modules (one transmitter and one receiver), two Arduinos, and a biomedical sensor such as an electrocardiograph (ECG), which records electrical currents associated with heart muscle activity (shown in Figure 9). The signal from the ECG is directly connected to the transmitter, which then wirelessly transmits the signal to the receiver. The data can then be transferred from the receiver onto a computer and sent to a medical center via an internet connection. With your group, briefly discuss the following: - What are some factors that might interfere with the quality of the transmitted signal? - Do you think that this could be an effective system for remote patient monitoring? - Could a similar type of system be used by a doctor to remotely treat a patient? 12

13 Figure 8 - Electrocardiograph (http://www.instrumentalanalysis.com/en/projects/fv_fum.php) 13

Arduino Lesson 5. The Serial Monitor

Arduino Lesson 5. The Serial Monitor Arduino Lesson 5. The Serial Monitor Created by Simon Monk Last updated on 2013-06-22 08:00:27 PM EDT Guide Contents Guide Contents Overview The Serial Monitor Arduino Code Other Things to Do 2 3 4 7 10

More information

Microcontroller Programming Beginning with Arduino. Charlie Mooney

Microcontroller Programming Beginning with Arduino. Charlie Mooney Microcontroller Programming Beginning with Arduino Charlie Mooney Microcontrollers Tiny, self contained computers in an IC Often contain peripherals Different packages availible Vast array of size and

More information

8.1 Goal of this assignment Results Primer Assignment... 62

8.1 Goal of this assignment Results Primer Assignment... 62 CHAPTER 8 Lab 8: Arduino Contents 8.1 Goal of this assignment........................... 61 8.2 Results.................................... 61 8.3 Primer.................................... 62 8.4 Assignment..................................

More information

Lab 5 Introduction to Data Acquisition and Processing

Lab 5 Introduction to Data Acquisition and Processing Introduction: University of Pennsylvania Department of Electrical and Systems Engineering ESE 111 Intro to Elec/Comp/Sys Engineering Lab 5 Introduction to Data Acquisition and Processing In previous labs,

More information

Electronics 4: The Arduino Microcontroller - Programming Basics, I/O

Electronics 4: The Arduino Microcontroller - Programming Basics, I/O BIOE 123 Module 5 Electronics 4: The Arduino Microcontroller - Programming Basics, I/O Lecture (30 min) Date Learning Goals Become familiar with using Arduino microcontroller Learn how to define variables

More information

PROGRAMMING WITH ARDUINO - 1

PROGRAMMING WITH ARDUINO - 1 PROGRAMMING WITH ARDUINO - 1 IESL RoboGames 2014 University of Moratuwa Department of Computer Science & Engineering Table of Contents Introduction... 2 Arduino Development Board... 2 How to Setup Arduino

More information

Arduino and PLC Communication

Arduino and PLC Communication Arduino and PLC Communication Designed and written by: Jason Eddrief 1 Table of Contents System Introduction... 3 Communication Protocol... 5 Arduino... 6 Sending Data:... 6 Receiving Data:... 7 Communicating:...

More information

by Jody Culkin resources that can be used, redistributed or rewritten free of charge. often software or hardware.

by Jody Culkin resources that can be used, redistributed or rewritten free of charge. often software or hardware. what is an arduino? it s an open source electronics prototyping platform. by Jody Culkin what does that mean? open source resources that can be used, redistributed or rewritten free of charge. often software

More information

Basic Pulse Width Modulation

Basic Pulse Width Modulation EAS 199 Fall 211 Basic Pulse Width Modulation Gerald Recktenwald v: September 16, 211 gerry@me.pdx.edu 1 Basic PWM Properties Pulse Width Modulation or PWM is a technique for supplying electrical power

More information

Project 1: Introduction to Arduino and LED Blink (Sketch Version) Description:

Project 1: Introduction to Arduino and LED Blink (Sketch Version) Description: Project 1: Introduction to Arduino and LED Blink (Sketch Version) Description: The Arduino is a microprocessor. A Microprocessor is a compact programmable computing device with memory, processing, input,

More information

Lab 5 Introduction to Data Acquisition and Processing

Lab 5 Introduction to Data Acquisition and Processing Introduction: University of Pennsylvania Department of Electrical and Systems Engineering ESE 111 Intro to Elec/Comp/Sys Engineering Lab 5 Introduction to Data Acquisition and Processing In previous labs,

More information

Chapter 6: Asynchronous Serial Communication

Chapter 6: Asynchronous Serial Communication Asynchronous Serial Communication Page 215 Chapter 6: Asynchronous Serial Communication The previous chapter introduced synchronous serial communication, which relies on a separate clock signal to synchronize

More information

Theory and Practice of Tangible User Interfaces. Thursday Week 2: Digital Input and Output. week. Digital Input and Output. RGB LEDs fade with PWM

Theory and Practice of Tangible User Interfaces. Thursday Week 2: Digital Input and Output. week. Digital Input and Output. RGB LEDs fade with PWM week 02 Digital Input and Output RGB LEDs fade with PWM 1 Microcontrollers Output Transducers actuators (e.g., motors, buzzers) Arduino Input Transducers sensors (e.g., switches, levers, sliders, etc.)

More information

Lecture 6 Introduction to the ATmega328 and Ardunio CSE P567

Lecture 6 Introduction to the ATmega328 and Ardunio CSE P567 Lecture 6 Introduction to the ATmega328 and Ardunio CSE P567 Outline Lecture 6 ATmega architecture and instruction set I/O pins Arduino C++ language Lecture 7 Controlling Time Interrupts and Timers Lecture

More information

Arduino Programming for Accelerometer

Arduino Programming for Accelerometer Arduino Programming for Accelerometer Rohan Panda ECE 480 Design Team 2 11/12/2015 Abstract : This application notes describes the Arduino programming process for accelerometer. The procedure describes

More information

Controlling The Real World With Computers ::. Control And Embedded Systems.::

Controlling The Real World With Computers ::. Control And Embedded Systems.:: Controlling The Real World With Computers ::. Control And Embedded Systems.:: Table Of Contents Previous: Reading a Schematic & Basic Electronics Next: Data lines, bits, nibbles, bytes, words, binary and

More information

Arduino Lesson 1. Blink

Arduino Lesson 1. Blink Arduino Lesson 1. Blink Created by Simon Monk Last updated on 2015-01-15 09:45:38 PM EST Guide Contents Guide Contents Overview Parts Part Qty The 'L' LED Loading the 'Blink' Example Saving a Copy of 'Blink'

More information

Simple Serial MaxMSP Arduino

Simple Serial MaxMSP Arduino Simple Serial MaxMSP Arduino int inbyte = 0; // incoming serial byte pinmode(13, OUTPUT); // connect an LED here inbyte = Serial.read(); if (inbyte == 97) digitalwrite(13, HIGH); // letter 'a' turns LED

More information

Arduino Lesson 13. DC Motors. Created by Simon Monk

Arduino Lesson 13. DC Motors. Created by Simon Monk Arduino Lesson 13. DC Motors Created by Simon Monk Guide Contents Guide Contents Overview Parts Part Qty Breadboard Layout Arduino Code Transistors Other Things to Do 2 3 4 4 4 6 7 9 11 Adafruit Industries

More information

Arduino Workshop 04 Arduino!" Processing Integration

Arduino Workshop 04 Arduino! Processing Integration AD32600 Physical Computing Prof. Fabian Winkler Fall 2014 Arduino Workshop 04 Arduino!" Processing Integration This workshop is about the integration of Arduino and Processing, building on examples of

More information

Connecting Arduino to Processing a

Connecting Arduino to Processing a Connecting Arduino to Processing a learn.sparkfun.com tutorial Available online at: http://sfe.io/t69 Contents Introduction From Arduino......to Processing From Processing......to Arduino Shaking Hands

More information

IR Communication a learn.sparkfun.com tutorial

IR Communication a learn.sparkfun.com tutorial IR Communication a learn.sparkfun.com tutorial Available online at: http://sfe.io/t33 Contents Getting Started IR Communication Basics Hardware Setup Receiving IR Example Transmitting IR Example Resources

More information

Summer Outreach Programs 2015

Summer Outreach Programs 2015 http://www.cs.csub.edu/~is-green/ Phone: (661) 654-6005 Fax: (661) 654-6960 Email: isgreen@cs.csubak.edu California State University Bakersfield Department of Computer & Electrical Engineering & Computer

More information

MECH 423 Mechatronic Product Design Spring 2016 Lab #2: MSP430 Microprocessor Programming

MECH 423 Mechatronic Product Design Spring 2016 Lab #2: MSP430 Microprocessor Programming MECH 423 Mechatronic Product Design Spring 2016 Lab #2: MSP430 Microprocessor Programming Objectives This lab consists in a set of exercises designed to teach you the basics of microprocessor programming

More information

Arduino Lesson 16. Stepper Motors

Arduino Lesson 16. Stepper Motors Arduino Lesson 16. Stepper Motors Created by Simon Monk Last updated on 2013-11-22 07:45:14 AM EST Guide Contents Guide Contents Overview Parts Part Qty Breadboard Layout Arduino Code Stepper Motors Other

More information

1 Overview. 2 Basic Program Structure. 2.1 Required and Optional Parts of Sketch

1 Overview. 2 Basic Program Structure. 2.1 Required and Optional Parts of Sketch Living with the Lab What s this void loop thing? Fall 2011 Gerald Recktenwald v: October 7, 2011 gerry@me.pdx.edu 1 Overview This document aims to explain two kinds of loops: the loop function that is

More information

H-Bridge Motor Control

H-Bridge Motor Control University of Pennsylvania Department of Electrical and Systems Engineering ESE 206: Electrical Circuits and Systems II Lab H-Bridge Motor Control Objective: The objectives of this lab are: 1. To construct

More information

Linksprite Arduino Motorshield. Introduction

Linksprite Arduino Motorshield. Introduction Linksprite Arduino Motorshield Introduction The Motor Shield is a perfect platform for robotics and mechanical applications. It enables the Arduino to drive two brushed DC motors or one 4-wire two-phase

More information

Surveillance System Using Wireless Sensor Networks

Surveillance System Using Wireless Sensor Networks Surveillance System Using Wireless Sensor Networks Dan Nguyen, Leo Chang Computer Engineering, Santa Clara University Santa Clara, California, USA dantnguyen84@gmail.com chihshun@gmail.com Abstract The

More information

Arduino project. Arduino board. Serial transmission

Arduino project. Arduino board. Serial transmission Arduino project Arduino is an open-source physical computing platform based on a simple microcontroller board, and a development environment for writing software for the board. Open source means that the

More information

Lab 1 Introduction to Circuits and MATLAB

Lab 1 Introduction to Circuits and MATLAB University of Pennsylvania Department of Electrical and Systems Engineering ESE 111 Intro to ESE Lab 1 Introduction to Circuits and MATLAB Introduction: In this lab, you will learn how to build very basic

More information

Arduino Programming Part 2

Arduino Programming Part 2 Arduino Programming Part 2 EAS 199A Lecture 6 Fall 2011 Overview Variable types int float Loops for loops while loops (another day) 2 Arduino web site Assigning and Using Variables http://arduino.cc/en/reference/homepage

More information

MeshBee Open Source ZigBee RF Module CookBook

MeshBee Open Source ZigBee RF Module CookBook MeshBee Open Source ZigBee RF Module CookBook 2014 Seeed Technology Inc. www.seeedstudio.com 1 Doc Version Date Author Remark v0.1 2014/05/07 Created 2 Table of contents Table of contents Chapter 1: Getting

More information

Web Site: www.parallax.com Forums: forums.parallax.com Sales: sales@parallax.com Technical: support@parallax.com

Web Site: www.parallax.com Forums: forums.parallax.com Sales: sales@parallax.com Technical: support@parallax.com Web Site: www.parallax.com Forums: forums.parallax.com Sales: sales@parallax.com Technical: support@parallax.com Office: (916) 624-8333 Fax: (916) 624-8003 Sales: (888) 512-1024 Tech Support: (888) 997-8267

More information

Data Acquisition Module with I2C interface «I2C-FLEXEL» User s Guide

Data Acquisition Module with I2C interface «I2C-FLEXEL» User s Guide Data Acquisition Module with I2C interface «I2C-FLEXEL» User s Guide Sensors LCD Real Time Clock/ Calendar DC Motors Buzzer LED dimming Relay control I2C-FLEXEL PS2 Keyboards Servo Motors IR Remote Control

More information

Arduino Programming Part 1

Arduino Programming Part 1 Arduino Programming Part 1 EAS 199A, Fall 2010, Lecture 5 Gerald Recktenwald Portland State University gerry@me.pdx.edu Overview Discuss details, now that you had a taste Arduino Environment Basic code

More information

Advanced Programming Concepts SparkFun Electronics Summer Semester

Advanced Programming Concepts SparkFun Electronics Summer Semester Arrays If variables can be thought of as buckets that hold a single piece of information, then arrays can be thought of as a collection of buckets, or a big bucket with a lot of little buckets inside.

More information

Purdue School of Engineering and Technology, IUPUI Electrical Engineering Technology, ECET307 Bonus Lab, Implementing Matlab to Arduino Dev Board

Purdue School of Engineering and Technology, IUPUI Electrical Engineering Technology, ECET307 Bonus Lab, Implementing Matlab to Arduino Dev Board ECET 307, Bonus Lab Purdue School of Engineering and Technology, IUPUI Electrical Engineering Technology, ECET307 Bonus Lab, Implementing Matlab to Arduino Dev Board Objective: Learn how to compile and

More information

Computer Architectures

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

More information

OPTI 380B Intermediate Optics Laboratory

OPTI 380B Intermediate Optics Laboratory OPTI 380B Intermediate Optics Laboratory Lab 9 Microcontroller / Data Acquisition Project I Objectives: This lab is an introduction to the world of microcontrollers. In particular, we will explore the

More information

Arduino Programming Language

Arduino Programming Language Introduction to Haptics Arduino Programming Language (optional material for beginning programmers) Allison M. Okamura Stanford University Programming Guidance Potential resources: Online courses (e.g.,

More information

Module: Wall-Following using Arduino

Module: Wall-Following using Arduino Module: Wall-Following using Arduino Now that you have a working wall-following vehicle enjoy a moment of satisfaction and then think how you might change the design to include more functionality. Maybe

More information

Ultrasonic Distance Measurement Module

Ultrasonic Distance Measurement Module Ultrasonic Distance Measurement Module General Description Distance measurement sensor is a low cost full functionality solution for distance measurement applications. The module is based on the measurement

More information

Single channel data transceiver module WIZ2-434

Single channel data transceiver module WIZ2-434 Single channel data transceiver module WIZ2-434 Available models: WIZ2-434-RS: data input by RS232 (±12V) logic, 9-15V supply WIZ2-434-RSB: same as above, but in a plastic shell. The WIZ2-434-x modules

More information

Using Xbee 802.15.4 in Serial Communication

Using Xbee 802.15.4 in Serial Communication Using Xbee 802.15.4 in Serial Communication Jason Grimes April 2, 2010 Abstract Instances where wireless serial communication is required to connect devices, Xbee RF modules are effective in linking Universal

More information

Multiplexer Setup. Dan Zilinskas ECE 480 Team 8 Motion Capture For Runners

Multiplexer Setup. Dan Zilinskas ECE 480 Team 8 Motion Capture For Runners Multiplexer Setup Dan Zilinskas ECE 480 Team 8 Motion Capture For Runners Contents Introduction...3 Objective...3 Multiplexer Schematic and Information...4 IMU and Arduino...4 Getting Started (Initial

More information

Lesson 4: Animation. Goals

Lesson 4: Animation. Goals Introduction: In this session you are going to use custom built tools in Arduino to help you turn images or animation into code that automatically uploads to your DIY Gamer. It is a fun and easy way to

More information

Magic 8 Ball. Student's name & ID (1): Partner's name & ID (2): Your Section number & TA's name

Magic 8 Ball. Student's name & ID (1): Partner's name & ID (2): Your Section number & TA's name MPS Magic 8 Ball Lab Exercise Magic 8 Ball Student's name & ID (1): Partner's name & ID (2): Your Section number & TA's name Notes: You must work on this assignment with your partner. Hand in a printer

More information

Eric Mitchell April 2, 2012 Application Note: Control of a 180 Servo Motor with Arduino UNO Development Board

Eric Mitchell April 2, 2012 Application Note: Control of a 180 Servo Motor with Arduino UNO Development Board Eric Mitchell April 2, 2012 Application Note: Control of a 180 Servo Motor with Arduino UNO Development Board Abstract This application note is a tutorial of how to use an Arduino UNO microcontroller to

More information

Remote control circuitry via mobile phones and SMS

Remote control circuitry via mobile phones and SMS Remote control circuitry via mobile phones and SMS Gunther Zielosko 1. Introduction In application note No. 56 ( BASIC-Tiger sends text messages, in which we described a BASIC-Tiger sending text messages

More information

Arduino Shield Manual

Arduino Shield Manual Arduino Shield Manual Version 1.4 www.dfrobot.com Copyright 2010 by DFRobot.com Table of Contents Arduino I/O Expansion Shield... 4 Introduction... 4 Diagram... 4 Sample Code... 4 Arduino Motor Shield...

More information

Microcontroller Based Low Cost Portable PC Mouse and Keyboard Tester

Microcontroller Based Low Cost Portable PC Mouse and Keyboard Tester Leonardo Journal of Sciences ISSN 1583-0233 Issue 20, January-June 2012 p. 31-36 Microcontroller Based Low Cost Portable PC Mouse and Keyboard Tester Ganesh Sunil NHIVEKAR *, and Ravidra Ramchandra MUDHOLKAR

More information

Lab Experiment 1: The LPC 2148 Education Board

Lab Experiment 1: The LPC 2148 Education Board Lab Experiment 1: The LPC 2148 Education Board 1 Introduction The aim of this course ECE 425L is to help you understand and utilize the functionalities of ARM7TDMI LPC2148 microcontroller. To do that,

More information

Building a Basic Communication Network using XBee DigiMesh. Keywords: XBee, Networking, Zigbee, Digimesh, Mesh, Python, Smart Home

Building a Basic Communication Network using XBee DigiMesh. Keywords: XBee, Networking, Zigbee, Digimesh, Mesh, Python, Smart Home Building a Basic Communication Network using XBee DigiMesh Jennifer Byford April 5, 2013 Keywords: XBee, Networking, Zigbee, Digimesh, Mesh, Python, Smart Home Abstract: Using Digi International s in-house

More information

DEPARTMENT OF ELECTRONICS ENGINEERING

DEPARTMENT OF ELECTRONICS ENGINEERING UNIVERSITY OF MUMBAI A PROJECT REPORT ON Home Security Alarm System Using Arduino SUBMITTED BY- Suman Pandit Shakyanand Kamble Vinit Vasudevan (13103A0011) (13103A0012) (13103A0018) UNDER THE GUIDANCE

More information

Arduino Wifi shield And reciever. 5V adapter. Connecting wifi module on shield: Make sure the wifi unit is connected the following way on the shield:

Arduino Wifi shield And reciever. 5V adapter. Connecting wifi module on shield: Make sure the wifi unit is connected the following way on the shield: the following parts are needed to test the unit: Arduino UNO R3 Arduino Wifi shield And reciever 5V adapter Connecting wifi module on shield: Make sure the wifi unit is connected the following way on the

More information

Introduction to Arduino

Introduction to Arduino Introduction to Arduino // Basic Arduino reference sheet: Installation: Arduino: http://www.arduino.cc/en/guide/homepage Fritzing: http://fritzing.org/download/ Support: Arduino: http://www.arduino.cc,

More information

Lecture 7: Programming for the Arduino

Lecture 7: Programming for the Arduino Lecture 7: Programming for the Arduino - The hardware - The programming environment - Binary world, from Assembler to C - - Programming C for the Arduino: more - Programming style Lect7-Page1 The hardware

More information

Arduino Leonardo ETH. Overview

Arduino Leonardo ETH. Overview Arduino Leonardo ETH Page 1 of 10 Arduino Leonardo ETH Overview The Leonardo ETH is a microcontroller board based on the ATmega32U4 (datasheet (http://download.arduino.org/products/leonardoeth/atmel-7766-8-bit-avr-atmega16u4-32u4_datasheet.pdf))

More information

Waspmote. Quickstart Guide

Waspmote. Quickstart Guide Waspmote Quickstart Guide Index Document version: v4.3-11/2014 Libelium Comunicaciones Distribuidas S.L. INDEX 1. Introduction... 3 2. General and safety information... 4 3. Waspmote s Hardware Setup...

More information

Arduino Shield Manual

Arduino Shield Manual Arduino Shield Manual Version 1.5 www.dfrobot.com Copyright 2010 by DFRobot.com Table of Contents Table of Contents... 2 Arduino I/O Expansion Shield... 4 Introduction... 4 Diagram... 4 Sample Code...

More information

EARTH PEOPLE TECHNOLOGY SERIAL GRAPH TOOL FOR THE ARDUINO UNO USER MANUAL

EARTH PEOPLE TECHNOLOGY SERIAL GRAPH TOOL FOR THE ARDUINO UNO USER MANUAL EARTH PEOPLE TECHNOLOGY SERIAL GRAPH TOOL FOR THE ARDUINO UNO USER MANUAL The Serial Graph Tool for the Arduino Uno provides a simple interface for graphing data to the PC from the Uno. It can graph up

More information

LEDs and Sensors: Analog to Digital

LEDs and Sensors: Analog to Digital LEDs and Sensors: Analog to Digital In the last lesson, we used switches to create input for the Arduino, and, via the microcontroller, the inputs controlled our LEDs when playing Simon. In this lesson,

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

MP3 Trigger v2 User Guide

MP3 Trigger v2 User Guide Overview The MP3 Trigger v2 is a versatile, low-cost, low-power embedded audio unit that plays MP3 tracks directly from a FAT16-formatted microsd flash card to a stereo line-level 1/8 output jack, supporting

More information

Transmission of Analog Audio Signal through Wireless Medium Using Radio Frequency

Transmission of Analog Audio Signal through Wireless Medium Using Radio Frequency EE318 Electronic Design Lab Project Report, E.E. Dept., IIT Bombay, April 2007 Transmission of Analog Audio Signal through Wireless Medium Using Radio Frequency Group Number: D12 Nikhil Pande (04d07026)

More information

Arduino DUE + DAC MCP4922 (SPI)

Arduino DUE + DAC MCP4922 (SPI) Arduino DUE + DAC MCP4922 (SPI) v101 In this document it will described how to connect and let a Digital/Analog convert work with an Arduino DUE. The big difference between and Arduino DUE and other Arduinos

More information

Home Security System for Automatic Doors

Home Security System for Automatic Doors ABDUL S. RATTU Home Security System for Automatic Doors Capstone Design Project Final Report Spring 2013 School of Engineering The State University of New Jersey, USA May 1st, 2013 ECE 468 Advisor: Prof.

More information

Digital to Analog Conversion Using Pulse Width Modulation

Digital to Analog Conversion Using Pulse Width Modulation Digital to Analog Conversion Using Pulse Width Modulation Samer El-Haj-Mahmoud Electronics Engineering Technology Program Texas A&M University Instructor s Portion Summary The purpose of this lab is to

More information

Small DC 3V-6V Hobby Motor 2000RPM

Small DC 3V-6V Hobby Motor 2000RPM Small DC 3V-6V Hobby Motor 2000RPM If the DC motors seem to 'cut out' or 'skip', solder a ceramic or disc 1uF capacitor between the motor tabs (on the motor itself!) as it helps to reduce noise and interference

More information

1602 LCD adopts standard 14 pins(no backlight) or 16pins(with backlight) interface, Instruction of each pin interface is as follows:

1602 LCD adopts standard 14 pins(no backlight) or 16pins(with backlight) interface, Instruction of each pin interface is as follows: LCD 1602 Shield Description: Arduino LCD 1602 adopts 2 lines with 16 characters LCD, with contrast regulating knob, backlight optional switch, and with 4 directional push-buttons, 1 choice button and1

More information

Arduino Lab 1 - The Voltage Divider

Arduino Lab 1 - The Voltage Divider Arduino Lab 1 - The Voltage Divider 1. Introduction In this lab, we will endanger a cute animal, create a portal to another dimension, and invent a new genre of music. Along the way, we will learn about

More information

Arduino Motor Shield (L298) Manual

Arduino Motor Shield (L298) Manual Arduino Motor Shield (L298) Manual This DFRobot L298 DC motor driver shield uses LG high power H-bridge driver Chip L298P, which is able to drive DC motor, two-phase or four phase stepper motor with a

More information

Arduino Starter Kit Tutorial

Arduino Starter Kit Tutorial Arduino Starter Kit Tutorial Developed by M5 Department of Electrical and Computer Engineering UMass Amherst March 2010 UMassAmherstM5.org Arduino Kit 1x Arduino Duemilanove 1x USB Cable 1X Red Breadboard

More information

DESIGNING A PC OSCILLOSCOPE USING FREEDUINO

DESIGNING A PC OSCILLOSCOPE USING FREEDUINO DESIGNING A PC OSCILLOSCOPE USING FREEDUINO Ritika, Preeti Kumari, Prem Ranjan Dubey Birla Institute of Technology, Mesra, Students of Department of Electronics and Communication Date: 22 nd May, 2013

More information

Arduino Lesson 14. Servo Motors

Arduino Lesson 14. Servo Motors Arduino Lesson 14. Servo Motors Created by Simon Monk Last updated on 2013-06-11 08:16:06 PM EDT Guide Contents Guide Contents Overview Parts Part Qty The Breadboard Layout for 'Sweep' If the Servo Misbehaves

More information

Part Number Description Packages available

Part Number Description Packages available Features 3 digital I/O Serial Data output Connects directly to RF Modules Easy Enc / Dec Pairing Function Minimal External Components Required Performs all encoding/decoding of data for Reliable Operation.

More information

Programming the Arduino

Programming the Arduino Summer University 2015: Programming the Arduino Alexander Neidhardt (FESG) neidhardt@fs.wettzell.de SU-Arduino-Prog-Page1 Programming the Arduino - The hardware - The programming environment - Binary world,

More information

Your Multimeter. The Arduino Uno 10/1/2012. Using Your Arduino, Breadboard and Multimeter. EAS 199A Fall 2012. Work in teams of two!

Your Multimeter. The Arduino Uno 10/1/2012. Using Your Arduino, Breadboard and Multimeter. EAS 199A Fall 2012. Work in teams of two! Using Your Arduino, Breadboard and Multimeter Work in teams of two! EAS 199A Fall 2012 pincer clips good for working with breadboard wiring (push these onto probes) Your Multimeter probes leads Turn knob

More information

Wireless Security Camera with the Arduino Yun

Wireless Security Camera with the Arduino Yun Wireless Security Camera with the Arduino Yun Created by Marc-Olivier Schwartz Last updated on 2014-08-13 08:30:11 AM EDT Guide Contents Guide Contents Introduction Connections Setting up your Temboo &

More information

KX3 Band Decoder/Encoder Theory Of Operations

KX3 Band Decoder/Encoder Theory Of Operations KX3 Band Decoder/Encoder Theory Of Operations Introduction The KX3 Band Decoder/Encoder (KX3 BD/E) is a self contained device that samples data from the KX3 serial port (ACC1), listens for band information

More information

RDF1. RF Receiver Decoder. Features. Applications. Description. Ordering Information. Part Number Description Packages available

RDF1. RF Receiver Decoder. Features. Applications. Description. Ordering Information. Part Number Description Packages available RDF1 RF Receiver Decoder Features Complete FM Receiver and Decoder. Small Form Factor Range up to 200 Metres* Easy Learn Transmitter Feature. Learns 40 transmitter Switches 4 Digital and 1 Serial Data

More information

Basic DC Motor Circuits. Living with the Lab Gerald Recktenwald Portland State University gerry@pdx.edu

Basic DC Motor Circuits. Living with the Lab Gerald Recktenwald Portland State University gerry@pdx.edu Basic DC Motor Circuits Living with the Lab Gerald Recktenwald Portland State University gerry@pdx.edu DC Motor Learning Objectives Explain the role of a snubber diode Describe how PWM controls DC motor

More information

Basic DC Motor Circuits

Basic DC Motor Circuits Basic DC Motor Circuits Living with the Lab Gerald Recktenwald Portland State University gerry@pdx.edu DC Motor Learning Objectives Explain the role of a snubber diode Describe how PWM controls DC motor

More information

TUTORIAL FOR INITIALIZING BLUETOOTH COMMUNICATION BETWEEN ANDROID AND ARDUINO

TUTORIAL FOR INITIALIZING BLUETOOTH COMMUNICATION BETWEEN ANDROID AND ARDUINO TUTORIAL FOR INITIALIZING BLUETOOTH COMMUNICATION BETWEEN ANDROID AND ARDUINO some pre requirements by :-Lohit Jain *First of all download arduino software from www.arduino.cc *download software serial

More information

1. Learn about the 555 timer integrated circuit and applications 2. Apply the 555 timer to build an infrared (IR) transmitter and receiver

1. Learn about the 555 timer integrated circuit and applications 2. Apply the 555 timer to build an infrared (IR) transmitter and receiver Electronics Exercise 2: The 555 Timer and its Applications Mechatronics Instructional Laboratory Woodruff School of Mechanical Engineering Georgia Institute of Technology Lab Director: I. Charles Ume,

More information

Single channel data transceiver module WIZ2-434

Single channel data transceiver module WIZ2-434 Single channel data transceiver module WIZ2-434 Available models: WIZ2-434-RS: data input by RS232 (±12V) logic, 9-15V supply WIZ2-434-RSB: same as above, but in a plastic shell. The WIZ1-434-x modules

More information

Arduino Electronics Introduction

Arduino Electronics Introduction Welcome! This tutorial is designed to teach you the basics of making your own electronic circuits using the Arduino microcontroller, the blue thing on the right. You will learn how to safely connect different

More information

BLUETOOTH SERIAL PORT PROFILE. iwrap APPLICATION NOTE

BLUETOOTH SERIAL PORT PROFILE. iwrap APPLICATION NOTE BLUETOOTH SERIAL PORT PROFILE iwrap APPLICATION NOTE Thursday, 19 April 2012 Version 1.2 Copyright 2000-2012 Bluegiga Technologies All rights reserved. Bluegiga Technologies assumes no responsibility for

More information

Intro to Intel Galileo - IoT Apps GERARDO CARMONA

Intro to Intel Galileo - IoT Apps GERARDO CARMONA Intro to Intel Galileo - IoT Apps GERARDO CARMONA IRVING LLAMAS Welcome! Campus Party Guadalajara 2015 Introduction In this course we will focus on how to get started with the Intel Galileo Gen 2 development

More information

Experiments: Labview and RS232

Experiments: Labview and RS232 Experiments: Labview and RS232 September 2013 Dušan Ponikvar Faculty of Mathematics and Physics Jadranska 19, Ljubljana, Slovenia There are many standards describing the connection between a PC and a microcontroller

More information

Wireless Communication With Arduino

Wireless Communication With Arduino Wireless Communication With Arduino Using the RN-XV to communicate over WiFi Seth Hardy shardy@asymptotic.ca Last Updated: Nov 2012 Overview Radio: Roving Networks RN-XV XBee replacement : fits in the

More information

Document title: LEGO Power Functions RC. Init: GMu. Version: Date: Version 1.20

Document title: LEGO Power Functions RC. Init: GMu. Version: Date: Version 1.20 Version 1 Introduction The purpose of this document is to describe the RC protocol supported by the LEGO Power Functions RC Receiver. Attention! Please feel free to use any information from this document

More information

www.dragino.com Yun Shield Quick Start Guide VERSION: 1.0 Version Description Date 1.0 Release 2014-Jul-08 Yun Shield Quick Start Guide 1 / 14

www.dragino.com Yun Shield Quick Start Guide VERSION: 1.0 Version Description Date 1.0 Release 2014-Jul-08 Yun Shield Quick Start Guide 1 / 14 Yun Shield Quick Start Guide VERSION: 1.0 Version Description Date 1.0 Release 2014-Jul-08 Yun Shield Quick Start Guide 1 / 14 Index: 1 Introduction... 3 1.1 About this quick start guide... 3 1.2 What

More information

Modbus and ION Technology

Modbus and ION Technology 70072-0104-14 TECHNICAL 06/2009 Modbus and ION Technology Modicon Modbus is a communications protocol widely used in process control industries such as manufacturing. PowerLogic ION meters are compatible

More information

ZX-NUNCHUK (#8000339)

ZX-NUNCHUK (#8000339) ZX-NUNCHUK documentation 1 ZX-NUNCHUK (#8000339) Wii-Nunchuk interface board 1. Features l Interface with Wii Nunchuk remote control directly. Modification the remote control is not required. l Two-wire

More information

PERIPHERAL INTERFACE CONTROLLERS. There are many different Peripheral Interface Controllers: examples include the PIC16F873 and the PIC16F876 and the

PERIPHERAL INTERFACE CONTROLLERS. There are many different Peripheral Interface Controllers: examples include the PIC16F873 and the PIC16F876 and the PERIPHERAL INTERFACE CONTROLLERS There are many different Peripheral Interface Controllers: examples include the PIC16F873 and the PIC16F876 and the PIC16F877. The PIC16F873 and PIC16F876 have the same

More information

Technische Universität München

Technische Universität München Lecture 7: Programming for the Arduino - The hardware - The programming environment - Binary world, from Assembler to C - Programming C for the Arduino: Basics - Programming C for the Arduino: more - Programming

More information

FiveBOT003 Omni 3 Wheel Drive Robotic Platform. Installation. Quick Start Guide

FiveBOT003 Omni 3 Wheel Drive Robotic Platform. Installation. Quick Start Guide FiveBOT003 Omni 3 Wheel Drive Robotic Platform Installation Quick Start Guide User Manual V1.2 Table of Contents 1. FB003 Robotic Platform Overview. 2 2. FB003 Omni 3WD Parts List... 3 3. FB003 Electronic

More information

GPIO with ATmega328 (Arduino board)

GPIO with ATmega328 (Arduino board) GPIO with ATmega328 (Arduino board) This is pin configuration for the ATmega328 in PDIP28 package, which is used in Arduino Uno. The I/O pins are organized to ports. Ports are named port B, port C, etc.

More information