Using the Arduino in an Analog and Digital Electronics ... · PDF fileUsing the Arduino in an...

1
The Course - Physics 525 Lecture/lab course introducing basic electronic circuits (Two- hour lecture/three-hour lab) Lecture covers the basic theory of circuits at the introductory level and discusses the lab assignment of the week. Students complete a set of standard lab assignments and a special project of their own design Lab assignments are described in hand-outs, which give step-by-step instructions and some homework assignments (Most measured data and analysis can be entered directly in blank spaces in the hand-out) Lab reports consist of a completed hand-out, a one-page summary (preferably typed), and the homework Typically 24 students (most work in teams of two) Arduino costs: $4,000 startup (14 SparkFun Inventor’s Kits + 6 netbook computers), $600 annual (additional components) Grading Lab: 60% (10 points/lab, 20 points/special project) Homework: 10% Midterm Exam: 10% Final Exam: 20% Conclusions 1. Using the Arduino instead of flip-flops, counters, seven-segment displays, and other traditional digital lab assignments allows our students to learn more in less time and with less frustration 2. Arduinos greatly expand the scope of special, student-designed projects offering better integration of knowledge gained in the course and higher student satisfaction with the outcome 3. Arduinos are robust and trouble-free: Only one out of 14 has been damaged in two years of use, and it still functions at > 90%. Arduino Lab Assignments Students lack programming experience so each assignment is broken down into 3 steps 1. Arduino controls device 2. Arduino reads sensor 3. Arduino controls device in response to sensor Sketches are provided in handout for steps 1 and 2, students must merge these to complete step 3 Arduino LED Lab Assignment 1. Digital Output Turn LED on/off Control LED flash rate using delay in loop Control LED brightness using PWM 2. Analog Input Read voltage output of potentiometer 3. Analog Input + Digital Output Fade LED using potentiometer input and PWM output Arduino Sound Lab Assignment 1. Digital Output Turn speaker on/off Generate octave scale using delay in loop 2. Analog Input Read voltage of touch-sensitive slider (Soft Pot) 3. Analog Input + Digital Output Create musical instrument with single octave scale using Soft Pot input and speaker output Blank output when Soft Pot not touched (pull-down ) Amplify output using audio or op amp IC Arduino Temperature Lab Assignment 1. Analog Input Read K-type thermocouple using MAX6675 shield 2. Analog Output Use power transistor to increase current that can be controlled by Arduino digital outputs 3. Analog Input + Digital Output Use PID algorithm to regulate temperature of resistor using thermocouple input and PWM output Using the Arduino in an Analog and Digital Electronics Course for Physics Majors Everett Ramer, PhD & Brian D’Urso, PhD University of Pittsburgh, Department of Physics and Astronomy, 100 Allen Hall 3941 O'Hara Street, Pittsburgh, PA 15260 Abstract Two years ago we began using Arduino microcontrollers in the electronics course for second-year Physics majors. Arduinos feature multiple on-board digital and analog inputs and outputs, and are connected to a host computer by a USB cable, which also supplies power to the unit. A free software development environment, including editor and compiler, are used to program the microcontroller using the high-level programming language C. Many easily interfaced sensors and transducers are available, making the Arduino a useful lab tool or an very entertaining toy. The large user group present on the internet is an inexhaustible source of help and ideas. In our course the Arduinos have replaced traditional experiments involving flip-flops, counters, and seven-segment displays. These experiments involve a great deal of error-prone bread boarding that students find frustrating. The Arduino is able to easily implement these operations in software. We also use the Arduinos in end-of-semester projects that challenge students to do something interesting with the knowledge they have accumulated. In previous years these projects were limited to rather simple devices like a siren, lie detector, or FM transmitter. With the Arduino students are able to build devices that incorporate a GPS receiver, send text and email messages, control servo and stepping motors, act as MIDI controllers, and have LCD and LED matrix displays. Arduino based projects are more rewarding and give the students a better appreciation of how their knowledge of electronics will be useful in their future work. Fig. 1 Arduino Fig. 2 Flex sensors on glove control servo motors moving phantom fingers Fig. 4 Snake with LED matrix Week Lecture Lab 1 Circuits Review: R Lab 1: DC Circuits 2 Circuits Review: RC Lab 2: RC Circuits 3 Complex Impedance, Filters Lab 3: AC Circuits 4 Semiconductors, Diodes Lab 4: Diodes 5 BJTs Lab 5: BJTs 6 FETs Lab 6: FETs 7 Op Amps Lab 7: Op Amps 8 Pulses and Digital Logic Lab 8: Pulses & Timing Semester Break 9 Intro to Arduino Lab 9: Arduino LED 10 Midterm Exam Lab 10: Arduino Sound 11 ADC/DAC Lab 11: Arduino Temperature 12 Frequency Domain Special Projects 13 Noise Sources/Management Special Projects 14 Transmission Lines Special Projects Meet the Arduino Fun-to-use electronics prototyping platform Stackable external modules (shields): Ethernet, motor control, mass storage, cellular phone, displays, … Channels: 12 digital input/output (6 with pulse width modulation output, PWM), 6 analog input, and 2 serial Microcontroller programmed directly (sketches) via built-in USB plug (no need to buy separate programmer) Free development environment with C/C++ language Run in stand-alone mode using built-in external power connector or tethered to host computer via USB When host computer is present, Arduino can communicate with software running on the host (e.g. Flash, Processing) Example Arduino Special Projects Fig. 3 Using an accelerometer to play Pong Fig. 5 Theremin with IR sensors & MIDI programmable music instrument shield Schedule

Transcript of Using the Arduino in an Analog and Digital Electronics ... · PDF fileUsing the Arduino in an...

Page 1: Using the Arduino in an Analog and Digital Electronics ... · PDF fileUsing the Arduino in an Analog and Digital Electronics Course for Physics Majors ... including editor and compiler,

The Course - Physics 525• Lecture/lab course introducing basic electronic circuits (Two-

hour lecture/three-hour lab)

• Lecture covers the basic theory of circuits at the introductory level and discusses the lab assignment of the week.

• Students complete a set of standard lab assignments and a special project of their own design

• Lab assignments are described in hand-outs, which give step-by-step instructions and some homework assignments (Most measured data and analysis can be entered directly in blank spaces in the hand-out)

• Lab reports consist of a completed hand-out, a one-page summary (preferably typed), and the homework

• Typically 24 students (most work in teams of two)

• Arduino costs: $4,000 startup (14 SparkFun Inventor’s Kits + 6 netbook computers), $600 annual (additional components)

Grading

• Lab: 60% (10 points/lab, 20 points/special project)

• Homework: 10%

• Midterm Exam: 10%

• Final Exam: 20%

Conclusions1. Using the Arduino instead of flip-flops, counters, seven-segment

displays, and other traditional digital lab assignments allows our students to learn more in less time and with less frustration

2. Arduinos greatly expand the scope of special, student-designed projects offering better integration of knowledge gained in the course and higher student satisfaction with the outcome

3. Arduinos are robust and trouble-free: Only one out of 14 has been damaged in two years of use, and it still functions at > 90%.

Arduino Lab AssignmentsStudents lack programming experience so each assignment is broken down into 3 steps

1. Arduino controls device2. Arduino reads sensor3. Arduino controls device in response to sensor

Sketches are provided in handout for steps 1 and 2, students must merge these to complete step 3

Arduino LED Lab Assignment

1. Digital Output• Turn LED on/off• Control LED flash rate using delay in loop• Control LED brightness using PWM

2. Analog Input• Read voltage output of potentiometer

3. Analog Input + Digital Output• Fade LED using potentiometer input and PWM output

Arduino Sound Lab Assignment1. Digital Output

• Turn speaker on/off• Generate octave scale using delay in loop

2. Analog Input• Read voltage of touch-sensitive slider (Soft Pot)

3. Analog Input + Digital Output• Create musical instrument with single octave scale using

Soft Pot input and speaker output• Blank output when Soft Pot not touched (pull-down Ω)• Amplify output using audio or op amp IC

Arduino Temperature Lab Assignment

1. Analog Input• Read K-type thermocouple using MAX6675 shield

2. Analog Output• Use power transistor to increase current that can be

controlled by Arduino digital outputs3. Analog Input + Digital Output

• Use PID algorithm to regulate temperature of resistor using thermocouple input and PWM output

Using the Arduino in an Analog and Digital Electronics Course for Physics Majors

Everett Ramer, PhD & Brian D’Urso, PhD University of Pittsburgh, Department of Physics and Astronomy, 100 Allen Hall 3941 O'Hara Street, Pittsburgh, PA 15260

AbstractTwo years ago we began using Arduino microcontrollers in theelectronics course for second-year Physics majors. Arduinosfeature multiple on-board digital and analog inputs and outputs,and are connected to a host computer by a USB cable, whichalso supplies power to the unit. A free software developmentenvironment, including editor and compiler, are used toprogram the microcontroller using the high-level programminglanguage C. Many easily interfaced sensors and transducersare available, making the Arduino a useful lab tool or an veryentertaining toy. The large user group present on the internet isan inexhaustible source of help and ideas.

In our course the Arduinos have replaced traditionalexperiments involving flip-flops, counters, and seven-segmentdisplays. These experiments involve a great deal of error-pronebread boarding that students find frustrating. The Arduino isable to easily implement these operations in software. We alsouse the Arduinos in end-of-semester projects that challengestudents to do something interesting with the knowledge theyhave accumulated. In previous years these projects werelimited to rather simple devices like a siren, lie detector, or FMtransmitter. With the Arduino students are able to build devicesthat incorporate a GPS receiver, send text and emailmessages, control servo and stepping motors, act as MIDIcontrollers, and have LCD and LED matrix displays. Arduinobased projects are more rewarding and give the students abetter appreciation of how their knowledge of electronics will beuseful in their future work.

Fig. 1 ArduinoFig. 2 Flex sensors on glove control servo motors moving phantom fingers

Fig. 4 Snake with LED matrix

Week Lecture Lab

1 Circuits Review: R Lab 1: DC Circuits

2 Circuits Review: RC Lab 2: RC Circuits

3 Complex Impedance, Filters Lab 3: AC Circuits

4 Semiconductors, Diodes Lab 4: Diodes

5 BJTs Lab 5: BJTs

6 FETs Lab 6: FETs

7 Op Amps Lab 7: Op Amps

8 Pulses and Digital Logic Lab 8: Pulses & Timing

Semester Break

9 Intro to Arduino Lab 9: Arduino LED

10 Midterm Exam Lab 10: Arduino Sound

11 ADC/DAC Lab 11: Arduino Temperature

12 Frequency Domain Special Projects

13 Noise Sources/Management Special Projects

14 Transmission Lines Special Projects

Meet the Arduino• Fun-to-use electronics prototyping platform

• Stackable external modules (shields): Ethernet, motor control, mass storage, cellular phone, displays, …

• Channels: 12 digital input/output (6 with pulse width modulation output, PWM), 6 analog input, and 2 serial

• Microcontroller programmed directly (sketches) via built-in USB plug (no need to buy separate programmer)

• Free development environment with C/C++ language

• Run in stand-alone mode using built-in external power connector or tethered to host computer via USB

• When host computer is present, Arduino can communicate with software running on the host (e.g. Flash, Processing)

Example Arduino Special Projects

Fig. 3 Using an accelerometer to play Pong

Fig. 5 Theremin with IR sensors & MIDI programmable music instrument shield

Schedule