Category Archives: COURSE MATERIALS

Project: Phase 2

Now it’s time to share your project! You’ll do that in class and on the blog.

In class

On December 11, 10a – 1p, you’ll present your final project in 108 Wurster (NOT our usual room, though it also has a nice projector, speakers, and space to pin up).  You will have 12 minutes for your presentation and 15 minutes for questions.

In your presentation, please include:

  • Your project title
  • The problem your project responds to
  • Why your project is the solution
  • How your project solves that problem

You should spend only a couple minutes on the first 3 bullet points, but this intro is very important. If you don’t grab the audience and interest them in the why of your project, no one will care what you did. Do not skip this. (Here’s a smart TED talk on that subject — worth the 18 minutes of your time.)

After the intro, the bulk of your presentation should describe how your project works. You may present your project as your group wishes, but you must include the following two items:

  1. A concept diagram (revised accordingly from Phase 1)
  2. A short video of your Arduino project in action

In your presentation, you may also choose to do a live demo with your Arduino project. Even if you do a live demo, it is still important to show the video because (a) the small Arduino projects are often difficult for everyone to see and (b) live demos may not work (Murphy’s Law).

Your audience will be the class, Professor Mozingo, Professor Kyle Steinfeld (Architecture), and Andrea Gaffney (Gehl Studio/LAEP Lecturer). I don’t have confirmation yet, but Professor Paulos and Professor Nicholas de Monchaux may also stop by.

On the blog

By noon on Dec 15, please have one member from your group post your concept diagram and video. (Please don’t be late.)

You may post any additional text or materials that your group wishes to include, so that you can proudly share the link with your friends and/or future employers.

Follow the instructions you used for posting your tutorial, with one change: please check the Projects box in the Categories menu.

wordpress_categories_projects

Thank you all for a wonderful semester. I’m so proud of you!

Project: Phase 1, How-To

You are going to write a tutorial for this blog on how to do one, little piece of your project. By writing the tutorial, you’ll not only get to know that piece well, you’ll also give back to the Arduino community.

1. With the support of your group, choose one aspect of your project to focus on. Be specific. For example, it’s better to learn how to make a force-sensitive paver (a project need that one group discussed in class), than how to generally use a force sensor.

2. Figure out how to make the code and the circuitry work. Find existing tutorials and fiddle around. If you get stuck, turn to your group members.

The Arduino Playground has links to many, many tutorials. There are also many on Instructables — some are easier to understand than others. What makes for a good tutorial?

3. Write your own tutorial. It must include a parts list, a circuit diagram, code, and any other information you need to make the tutorial as clear as possible (e.g., images, or a brief video).

As you write, think of your fellow classmates: would they understand how to follow your tutorial? Read the Arduino Style Guide for tips on writing tutorials.

4. Post your tutorial on this blog.

  • Find the email with your user name and password (I sent it to you on 10/27 and should have the subject “[HACKERSCAPES] Your username and password”). You have permission to write and edit posts. You can also delete your unpublished posts.  If you need to delete a published post, let me know. (FYI – You can’t view your classmate’s posts that are in draft, and they can’t see yours.)
  • Use the link in the email to log in.
  • Once you’re logged in, click the link on the left side bar for Posts and choose “Add New.”
  • Give your post a clear title.
  • Categorize your post by checking the Tutorials box on the right of the screen.

wordpress_categories

  • To include any images in your tutorial, use the “Add Media” button, located underneath the title of the post.
  • Make your code nice and readable. To to this, you have to wrap the code in an html tag for pre-formatted text, called a pre tag. First, choose the Text tab (see image below).

wordpress_texteditor

  • Once you’re on the Text editor side, copy and paste in your Arduino code into WordPress. On the line before the code starts write: <pre lang=”arduino”>. On the line after the code ends, write: </pre>. If you do this on the Visual editor side, the tags won’t work.
  • Before you publish your draft, you can Preview it to make sure everything looks right. This is a good chance to check that your pre tags are working as planned and look for typos.
  • When you’re ready, hit Publish.
  • Feel free to correct any little things after you publish. If you ever make any more significant updates, it’s good to add a note (like I did at the bottom of Lab 3).

Project: Phase 1, Presentation

You will present your project in class on November 7.  Your presentation will be 10 minutes long, in addition to 5-10 minutes of questions/discussion. You can use whatever supporting materials you would like to use: PowerPoint, boards, the white board, etc.

In your presentation you should:

1. State the larger urban problem/challenge that your project responds to.

2. State why your project addresses this challenge.

3. Explain how your project works.

  • Present a concept diagram of your project. What are your inputs (sensed data)? What are your outputs (responses to the sensed data)?
  • Present a more detailed parts diagram of your project. What hardware will you need? If there are points in the diagram where you’re not decided on the hardware, create a list of choices. For all hardware, include costs.

4. Discuss any additional design or technical questions your team is wrestling with.

Lab 6: Processing

In this lab, you are going to work on Processing, then Arduino, and then Processing and Arduino together. Through the lab, you’ll expand your use of capacitive sensors, practice serial communication, and learn more about Processing’s capabilities.

Processing

1. Complete this short Processing Overview.

2. Poke through the tutorials on processing.org. Look for ones that interest you. (If you’re like me, this will probably make you think — “Oh! So this is how so-and-so made that graphic.”)

Arduino

3. If you didn’t finish the Tiny Piano exercise in class, download my code from bSpace under Resources > Lab 6 Code and look it over.

There’s a few choices I made in my code that may be different from your code. For example, I created the function detectCapSense. It’s not really necessary —  I just wanted to keep loop() as clean as possible.  Also, I chose to store the sensor values in an array. You could store them as integers. It’s just personal style.

I used this code as the starting point for arduino_capsense_controller.ino, which you’ll use in this lab.

4. I made you a game. The code is also available on  bSpace under Resources > Lab 6 Code. Please download it, and then set up your Arduino for capacitive sensing, if it’s not already (the same setup you had in class).

5. Upload arduino_capsense_controller.ino onto your Arduino. Run it. Check your serial monitor to make sure that your capacitive sensors are working. When you’re done, close your serial monitor.

Processing + Arduino

6. Now connect Arduino to Processing. To make sure the connection is working correctly, use the exact same sketch that you used in Lab 4 when you printed “Hello World” with Arduino, and then accessed that “Hello World” with Processing.  I called this sketch processing_readstring.pde on bSpace.

Run processing_readstring.pde. You should see the same numbers that you saw before on your Arduino serial monitor streaming across the Processing serial monitor.

In the image below you see 0,0. If I were touching one of the sensors, there would be a number in the right or left position. For example, 0,60.

processing_capsense_2sensors

If it’s not working, make sure that you are connected to the correct serial port (this will more than likely be the same one you used in Lab 4).  My sketch uses portName = Serial.list()[1] because that is the appropriate port for my computer — update it to work with yours.

7. Now you know that your sensors are working and you are connected to Processing.

Keep your Arduino code going, but stop the previous Processing sketch.  Now run processing_capsense_game.pde. Don’t forget to update the port number — look for portName = Serial.list()[1] .

Use your sensors to control the ball.  So exciting!

8. Actually, this game is lame. Please make it better.

  • Add two more sensors, so you can move the ball up and left, in addition to down and right. (Note that you don’t need alligator clips — you can just touch the end of the wire directly or use a paper clip without plastic coating.)
  • Make 4 additional improvements to the Processing side of the game. You pick what they are.

To see how it’s possible to expand the Processing interface quite a bit, you might derive some inspiration from the example of making your own game of Pong available here.  This is not exactly pretty, since it’s a replica of a 1970s arcade game, but even so, Pong is popular.

Here’s a fancier example of Pong in action:

In general, there are many, many Processing tutorials available online. There is also example code included with the Processing IDE under File > Examples. These examples are pretty fun. They’re also almost entirely self-contained, so you just need to open one, hit Run, and then watch it do its thing.

9. Please upload to bSpace:

  • A paragraph or two explaining what changes you made to the game. (4 points)
  • Your updated Arduino and Processing code. (8 points)
  • A video showing your revised game in action. (8 points)

In Class: Capacitive Touch Sensing

In this exercise, you are going to install an Arduino library, and then use it for capacitive (touch) sensing. First you will create two sensors, and then you will add a buzzer to your Arduino to make a tiny piano.

0. If you have the Arduino IDE open, close it.

1. Download the CapSense Library (called CapacitiveSensor04.zip) and save it somewhere that you can find it again. Unzip it. Open up the subfolder called “libraries.”

2. Inside libraries, you will see the CapacitiveSensor folder. Copy this folder into your Arduino Library folder. For me, the Arduino Library folder is located at My Documents > Arduino > Libraries. Yours should be similar.

3. Launch the Arduino IDE. Now you should see the CapacitiveSensor library under your list of available libraries.

capsense_library_contributed

4. Take a minute to appreciate that you just installed your first library. There are gazillions of libraries out there. Now you have significantly more coding power than you did before.

5. Now go to File > Examples > CapacitiveSensor > CapacitiveSensorSketch. This is the sketch that you’ll be using.

6. Go back to take a look at the CapacitiveSensing page. Note that you can read about all of the methods that are included in the library, the variables that you need to send them, and the variables that they return. (Side note: methods are a lot like functions — you can use these words interchangeably with most everyone except coding purists.)

7.  CapacitiveSensorSketch creates 3 sensors. You are just going to make 2 sensors. Comment out every line that refers to cs_4_2. Also, since cs_4_2 is used to calculated total1, so you should also comment out any line that refers to total1.

8. Set up your board using pins 4, 6 and 8.  Be sure to include a 10K ohm resistor on each sensor. Also, ground your board.

There is no single correct way to do this, but this is how I set it up (the resistors are between the positive rail and the green wires):

cap_sense_setup

9. Upload your CapacitiveSensorSketch.  Open the serial monitor. Click on the sensors, see what happens.

10. Try replacing the ends of the sensors (dimes in the example above) with something else that’s more or less conductive. How does it work? Do your values change?

11. Now, think about incorporating an output into your Arduino sketch so you can respond to a sensed touch. How would you make the piezo buzzer sound a single note when the left sensor is pressed?

12. After you have the left sensor worked out, add another note when the right sensor is pressed.

13. Add a third note for when both are pressed at the same time.

14. Manipulate the delay times and the buzz duration so the notes are as smooth as possible.

15. Now you have a tiny piano! Think about how you might add more keys.

Project Overview

In your classes, studios and daily lives, you encounter problems and challenges in the urban and suburban environment. Your project will respond to one of these problems or challenges by creating an electronic (e.g., Arduino) intervention in the public realm. This intervention will include both sensing and response.

You will work in teams of 3-4 people. Ideally, your team will have common interests, but diverse skills. The perfect team would include one person with a strong design vision, one person who likes to code, and one person who is interested in the circuitry. In reality, everyone has some of each of these characteristics, but consider all of these needs as you build your team. We will finalize teams in class on October 17.

Scaling up to work in the public realm will require some leaps. So far, you have primarily worked on small, desktop-sized projects. To gradually go larger, you will complete your final project in two phases. On the syllabus, this is called Project 1 and Project 2.

Following is a brief sketch of the remaining assignments in the class. I will post more on each assignment as the due date nears.

Phase 1

In the first phase, you will develop your project concept, and then dive into the details to ensure your concept is feasible.

  • You will create an elevator pitch for your project. What is a problem that you see in the urban environment? How does your project address this problem?
  • You will diagram your project. Where will the project be located? What are you sensing? How are you responding? Include a preliminary equipment list with costs.
  • Divide up your project. Think of the different connections and questions that need to be answered in order to build your project. Each person in your team will work on one piece of the overall design. (For example: how can you drive and power four servos simultaneously? how can you collect data from an anemometer?)
  • Each person in your team will write a blog post on this site (I will give you permissions to publish here as the time draws nearer). It will be a tutorial on how to execute your piece of the project. It will include a circuit diagram, code, and any other information you need to make your tutorial as clear as possible (e.g., text, images, or a brief video).
  • Your team will present your project concept to the class. Professor Louise Mozingo will join us. You will talk to us about the design and technical questions your team is wresting with. We will give you constructive feedback on how to advance your project.

 

Phase 2

Some people will find that, after exploring the details, their concept is not working. That is OK. At this point, everyone should take a step back and think about how their project should evolve, based on your new technical knowledge and design considerations.  You may choose to do a major project revision.

This revised project is the project you will execute for the rest of the semester. As you move through execution, iteratively consider:

  • How will we manage costs (i.e., complete the project within budget)?
  • How will we power the project?
  • How will we protect/enclose the project?

On December 11 (10a – 1p), you will present the problem your project responds to, what your project does, and how you do it. Your audience will be the class, Professor Mozingo, Professor Kyle Steinfeld (Architecture), and Andrea Gaffney (Gehl Studio/LAEP Lecturer). Depending on your concept, the project may be at full scale, or may be a model. Regardless, it will be a prototype of an urban solution.

Lab 5: More on circuits

In this lab, you’re going to learn more about circuits. First, you’re going to use a relay — an electrical switch — that allows you to turn on and off parts of your circuit. Then, you’re going to practice calculating resistance. Finally, you’re going to diagram your circuit.

1. Complete Circuit 11, Relays, in your Vilros Ultimate Starter Guide.  If your relay doesn’t work, check all your wires. Trace the circuitry and think about how the current is flowing. Look at the axon drawing to see how the relay should be oriented. If that still doesn’t work, flip the orientation of the diode (for me, I needed the dark side of the diode on the right).

2. Make your circuit a little more exciting. On one side of the switch, run 2 LEDs in series. One the other side, run 2 LEDs in parallel. When each side is activated, write to your serial monitor: “Parallel On” or “Series On.”

3. What resistors do you need for your circuit, according to Ohm’s Law?  You’ll need to calculate this separately for each side of the switch. Show me your math. Make sure your circuit uses the most appropriate resistors. (4 points)

4. Take a short video of your circuit in action. Be sure to show the wiring well enough that I can actually see one side is wired in series and one in parallel. Also, be sure to show the serial monitor. In your video, feel free to talk and point to things.  (8 points)

5. Draw a circuit diagram for your new circuit. Label everything, just as it’s done in the circuit diagram in your starter guide. (6 points)

Note that there are several different ways to go about drawing a circuit. This software, Fritzing, seems to be popular in the Arduino community. There are many other options available — just search around. You can even use a pen and paper (and a scanner). Whatever you use, make sure your circuit is clear.

6. Read about the why your resistors are colored as they are.

7. Read about how to destroy an Arduino. This link is a little strange because it’s an advertisement for an Arduino spin-off called a “Ruggeduino” that can supposedly withstand all the things you can do to kill your Arduino. But, it’s also a clear list. (If you think your circuit diagram was complicated, check out the ones they show on this page.)

8. If you’d like to read more about the basics, check out this primer on voltage, current and resistance at Sparkfun. It also includes links to tutorials on electricity and circuitry.

9. Or, check out this one on Adafruit. Start here and then keep clicking through to read “Revisiting Resistors,” “Revisiting Volts,” and “What to Adjust?”.

10. As always, post your assignment on bSpace.

Lab 4: Communicating

In this lab, you’ll explore serial communication by talking with Processing, the programming language and development environment that provided the original inspiration for the Arduino IDE. Processing is a very useful partner for Arduino — you’ll use it again in a few weeks.

1. Download Processing. If you need to look up any of the commands you’re using in Processing, check the Library and Reference sections.

2. Do this tutorial from Sparkfun. Please type in each line of code yourself, rather than copying and pasting the code. Doing so will help you understand the code much more deeply. It will also make you aware of your typos, which will help you learn to write less buggy code.

A few things to watch out for in this tutorial:

The first chunk of Processing code that begins with “String portName = …” should be inside of the setup() function, which is not said very clearly.

When setting your port, try [0] for Macs, as the tutorial suggests. For Windows, try [1].  You’ll know you’re accessing the wrong port if you get an error. Once you figure out which number to use, use the same number every time you need to access the port in the code (at one point in the sample code, the value inexplicably changes to [4] — you should not do that).

Be sure to load your Arduino sketch, and then run your Processing sketch. If you run Processing first, you’ll get an error that says your serial port is busy.

For the lucky ones, connecting Processing to your serial port will be a breeze. For those of you with grouchy computers, this might be a pain. The issue is that a serial port cannot be accessed by two programs simultaneously. If you’re being told that the serial port is busy, even though you’re sure you uploaded Arduino first and then ran Processing second, it likely means that whatever program was last using the serial port did not properly close the port, locking you out. To fix this, you’ll have to reboot your computer. (Or use a program like Terminal or PuTTY, but rebooting is probably simpler if you’re not already familiar with those programs.) Also, be aware that if you’re using serial communication somewhere else (e.g., some other device plugged into your computer), that other device can occupy your serial port.

When you’re done, spend a little time reflecting on how you could incorporate sensor data into your sketch, in lieu of “Hello, world!”

3. Submit a video of your final project, when both sides are “shaking hands” (14 points).

4. In your Arduino code you saw a while loop. What is a while loop and how does it differ from a for loop? Thinking back on past sketches, when did you use a for loop? (2 points)

5. In the final code, when you click the mouse, the light turns on. When you click again, the light turns off. How does this differ from your first mouse-clicking/light-blinking sketch? Where do you see this difference manifest in the code? (4 points)

6. Please submit your video and answers to the questions on bSpace under Lab 4.

Lab 3: Motors

In this lab, you will work with motors.  First, you will practice using servo and DC motors. Then, you will make one of your motors respond to a sensed stimulus. Lastly, you will learn more about powering motors.

1. Complete Circuit 8 in your Vilros Ultimate Starter Kit Guide, “A Single Servo.” Alter the pattern of the motor from the default provided in the code. Take a short (<15 sec) video of your motor working. (3 points)

2. Complete Circuit 10, “Spinning a Motor.” Alter the pattern of the motor from the default provided in the code. Take a short (<15 sec) video of your motor working. (3 points)

3. Combine one of the sensors from Lab 2 with either motor. Make your motor turn in response to the sensor. Temporarily attach some sort of physical object to your motor, so the motor is actually moving something.

4. Write a short paragraph describing what your project does. Why did you choose to use the motor that you chose? Read about different motors. (2 points)

5. Submit your code. Be sure to include comments describing what each piece of the code does. (4 points)

6. Submit a short (<30 sec) video of the project. (2 points)

7. What is a transistor? Why did you use it for the DC motor? (2 points)

8. Search the internet a more powerful motor. Submit a link to this motor. What is the suggested voltage for your bigger motor? (2 points)

9. To power the bigger motor you chose, do you need a motor shield? What is a motor shield? (2 points)

10. Submit your questions + videos on bSpace under Assignments > Lab 3.

**Updated October 16, 2014 to correct typos/errors.

Lab 2: Sensors

In this lab you will work with four different sensors. You will sense touch (two different ways), then light intensity, then temperature. After, you’ll look around on the internet for other types of sensors — what sensors are you most interested in?

1. Follow the exercise for Circuit 2, Potentiometer, in your Vilros Ultimate Starter Kit Guide.

2. In a few sentences, describe how the potentiometer works. Why is the light intensity changing as you turn the knob? (2 points)

3. This is the first time you’ve used an Analog In pin. In a few sentences, describe the difference between the digital and analog pins. (2 points)

4. Follow the exercise for Circuit 5, Push Button.

5. In a few sentences, describe how the buttons work.  Why does the light go off when you depress both buttons? (2 points)

6. Take a quick (< 15 sec video) of Circuit 5, showing what happens as you push the buttons. (2 points)

7. Follow the exercise for Circuit 6, Photo Resistor.

8. In a couple sentences, describe how the photo resistor works. Is it more similar to the potentiometer or push buttons? (1 point)

9. Take a photograph of your completed Circuit 6. (2 points)

10. Follow the exercise for Circuit 7, Temperature.

11. Take a photo or screen grab of your serial monitor showing temperature readings. (2 points)

12. What is a serial monitor? (1 point)

13. Search the internet for more Arduino sensors. You may want to start by scrolling through this page. Find 2 sensors that you would be interested in using.

14. For each sensor, submit (6 points):

    • The name of the sensor
    • A link to where you can buy the sensor
    • A link to some sample code/tutorial that helps you figure out how to use the sensor.
    • What does the sensor do? (2-3 sentences)
    • In looking at the sample code, do you understand what’s going on? If you bought the sensor, what would you need to learn in order to get it going? (1 paragraph)

Note: finding sample code will take some digging around. You may want to start saving links to code that you find helpful. I use Evernote for this sort of stuff.

15. Post answers to the questions + videos on bSpace under Assignments > Lab 2. Be sure to hit the submit button.