DESGN-653-01 Digital Electronics, Spring 2016, CCA

DESGN-653-01 Digital Electronics Thursday 12:00PM 03:00PM SANF 107 (Hybrid Lab)
Design MFA
Spring 2016

Instructor: Michael Shiloh
mshiloh@cca.edu
Office hours: Office hours: Tuesday 3:00PM-3:30PM, Thursday 3:00PM-3:30PM, or by appointment

Jump to current homework assignment

Course Objectives

The purpose of this course is to teach you the practical tools you will need to design and build robust and functional interactive electromechanical devices. This course will cover programming (Processing, Arduino, others), electronics (basic circuits, Arduino, sensors and actuators), and construction techniques. Electronic and programming theory will be covered as necessary to support the practical needs of this class. The goal will be to give you the tools and the confidence to combine basic hardware, software, and mechanical building blocks (such as those taught in this class or those you might garner from the internet) into functional realizations of your ideas.

In addition to the class content will be the following themes:

  • Designing and building for reliability, flexibility, testability, ease of repair and modification, robustness, transportability, etc. I want you to build as much as possible, to learn and to iterate towards these goals
  • Documentation: Obviously it’s important for your own studies, and it’s especially important when dealing with electronics and programming which become opaque very quickly. In addition, we all benefit tremendously from the projects others have shared freely on the internet and in other places, and it’s important to pay forward to this pool. As a side effect, you could receive excellent feedback and perhaps even recognition and fame for work you publish. To this end, everyone is required to have ongoing online documentation. This can be a blog (e.g. WordPress), a wiki, a website, or any other mechanism as long as it  allows feedback and is publicly searchable and accessible, and allows uploading of properly formatted code
  • Collaboration: You are encouraged to collaborate with students in other classes on your projects
  • Problem solving: Failure is not a bad thing, it is an opportunity to learn. To some extent we learn the most from things that didn’t quite as we had hoped. In this class we will learn how to solve problems systematically by understanding the desired behavior, analyzing the observed behavior, formulating theories about why there is a difference, and designing tests that will verify (or not) those theories

As with all classes, I make modifications based on observations and feedback from last semester, as well as ideas I’d like to try out. There is always some experimental component, and feedback is always appreciated. I will ask you more formally via an anonymous survey, but I always welcome your feedback.

Finally, I want to make this class responsive to your needs and interests. Please ask questions, make suggestions, and tell me what you’d like to learn. In particular, some of you have prior experience in some of these areas. To allow you to learn as well, projects will be designed with a “low floor and high ceiling”, that is, beginners will implement projects at a basic level, while those with more experience will be expected to involve increased complexity in their projects.

You are encouraged to be very broad, adventurous, and creative. You should take advantage of the freedom you’re given and craft your explorations to spread your wings and get the most from the experience, resources, and the support that are available at CCA in general and in this course in particular.

Learning Outcomes

  • Know how to conceptualize, design, and build a project involving some or all of sensors, actuators, Arduino, Processing, the internet, and possibly other programming languages
  • Know how to use advanced interfaces such as I2C and SPI to communicate with sensors and actuators that use those
  • Know how to communicate between Arduino and a computer using your own protocol or Firmata, to implement a larger project requiring both Arduino and laptop capabilities
  • Know how to access the internet from your project
  • Know how to chose the right motor for your project, and how to control it
  • Know how to design and construct circuits and software for robustness and ease of maintenance, repair, and modification
  • Know how to tap into an existing device for control by or input to for a larger project
  • Know how to document your project so others can understand, duplicate, and build on your work
  • Know how to research and understand topics beyond what is taught in class
  • Know how to solve problems systematically by understanding the desired behavior,  analyzing the observed behavior, formulating theories about why there is a difference, and designing tests that will verify (or not) those theories

Required Equipment

  • Arduino.cc Uno R3  (Arduino, Adafruit). Must not be a clone or a compatible. Do not order from Amazon or Ebay)
  • Solderless breadboard, full size (also known as 830 tie point)
  • Laptop (Windows, Linux, or Macintosh)

Many vendors grant discounts for educational purposes so ask before you purchase. I encourage you to organize a group purchase to save on shipping fees, but do so immediately so we have the equipment on hand.

 Optional equipment

As you develop your projects and interests, you might need to purchase additional components and devices. This is impossible to predict as the range of projects you might approach are indeed infinite. At the low end, you can build amazing projects from discarded electronic devices such as printers at absolutely no cost; at the high end there is no limit; a complicated robotic project could easily start at hundreds of dollars. Some lessons I’ve learned:

  • Projects will cost more than you think they will
  • Projects will take longer than you think they will
  • You will order parts that are wrong or that you simply decide not to use. Be ready to accept this. Consider these items you might trade with other students (or the larger maker community) for parts that you do need, especially when you need that part urgently.
  • You will spend less time and money if you are flexible about your concept. Allow prototype iterations to modify your concept, not just your execution. The reverse is also true: If you strongly want to stick to your concept, be prepared to spend more time and money. The common way of looking at this is to consider that there is a relationship between time, money, and features. You can choose any two of them, and the third will grow (or shrink) to accommodate.

Topics

  • Introduction (or re-introduction) to Arduino and Processing
  • Electronic theory: understanding current limitations
    • How much current does an LED consume, and how to limit it
    • How much current does a motor consume, and how to control it from Arduino
  • Introduction to dataflow programming languages such as Max/MSP or PureData
  • Construction techniques
  • Debugging and asking for help
  • Electronic circuits: soldering, printed circuit boards (PCBs); CAD software (Fritzing)
  • Intermediate programming concepts: Arduino/Processing communication, classes, arrays, state machines, etc.
  • Firmata on the inside
  • Networking via Ethernet or WiFi
    • web interface
    • RESTful API
    • Node.js
  • Other wireless options
  • Connecting to the internet with services such as IFTTT or Temboo
  • Intermediate hardware topics: other interfaces, filtering noisy data, motor controllers, etc.
  • Servo loops
  • Extending or combining Arduino with other circuits: multiplexers, shift registers, etc.
  • Telemetry data: Gathering information and storing on local SD card or on remote computer
  • Survey of other similar embedded options: Raspberry Pi, Beagle Board, Edison, Galileo
  • Advanced options
  • Motors: servo, PM, stepper, H-bridge
  • Gears, pulleys, levers
  • Power considerations and distribution

Week 1 1/21

  • Where are you
    • programming
    • electronics
    • physics
    • math
  • Intro to or review of Arduino, electronics, and Processing

Homework due on week 2 1/28

  1. Order your Arduino and solderless breadboard before class so that they arrive by week 3.
  2. Create your online presence and email me the URL
  3. Reproduce what we did in class, and document any issues in your debug log. You can reference this document.
    1. If you didn’t have your laptop in class, you will need to install the Arduino software (IDE). This guide should answer any questions: MacOSX WIndows
    2. Experiments to reproduce:
      1. Upload the Blink example, and make sure the LED on the Arduino blinks.
      2. Change the delay values, and verify that the blinking rate changes
      3. Add an external LED to pin 13 using a solderless breadboard. Use a 1 K ohm resistor. Verify that this external LED blinks
      4. Move the wire connecting your external LED to your Arduino to a different pin, which of course stops it from blinking. Now modify your program so that the external LED blinks. Include your program and a brief diagram of your setup in your online journal.
      5. Now modify your program so both LEDs blink. You may blink in any pattern that you wish. Again include your program and a brief diagram of your setup in your online journal.
      6. Build the ciruit with the photoresistor, or light dependent resistor. Use a 10 K ohm resistor. Verify that AnalogReadSerial works as expected. As always, include your program and a brief diagram of your setup in your online journal.
      7. Using the same circuit, upload File -> Examples -> Analog -> AnalogInput. Describe what should be happening and verify that this is indeed happening. As always, include your program and a brief diagram of your setup in your online journal.
    3. Try the next step in  this tutorial, titled “analogWrite(): Controlling speed or brightness“which we did not do in class. See if you can figure out what’s going on and describe it to the best of your ability. You may wish to refer to this tutorial, which will explain many of the new concepts. You are encouraged to research further if you wish in order to understand what is happening.
    4. I prefer your debug log to be online, but if you wish you may use a notebook or other means.
    5. As you do these exercise, it is likely that things won’t work perfectly the first time. This is not bad! Things rarely work the first time for me and for all my friends in this field. The important thing is to carefully analyze what you expected to happen and what in fact happened, to formulate a theory about what may be the cause for the discrepancy, and then to formulate an experiment to test whether your theory is true or not. Example:
      1. Observed behavior: LED doesn’t blink when I run the blink program
      2. Theory: LED might be installed backwards
      3. Test: Reverse the LED. If the theory is correct, the LED should start blinking.
      4. Result: After reversing the LED it still didn’t blink, so the problem must be elsewhere. (Note that it’s still possible that the LED is backwards)
  4. Email me if you have any questions
  5. Bring in your debug log (whether it’s paper,  a file, or part of your online journal)
  6. Remember to bring your laptop to class every week

Week 2 January 28

  1. Critique of online presence
    1. Rubric
      1. did you email me the link?
      2. Steps iv-vii program and sketch
      3. debug log
    2. Pasting Code: must preserve indentation e.g.:
      void setup() {
        // use a for loop to initialize each pin as an output:
        for (int thisPin = 2; thisPin < 8; thisPin++) {
          pinMode(thisPin, OUTPUT);
        }
      }
      
  2. Review and more Arduino: Conditionals and loops
    1. Conditionals  and see Comparison Operators on the Arduino Reference home page.
      1. Use LDR circuit and sketch from last week, make LED come on if light level is above some threshold
      2. Replace LDR with a potentiometer, e.g. AnalogReadSerial tutorial
      3. Add three LEDs: the first comes on if (and only if) the light is below a low threshold (e.g. 200), the second comes on if (and only if) the light is above the low threshold AND below
    2. Conditionals and analogWrite()
      1. File -> Examples -> Basic -> Fade
    3. for() loops (reference, tutorial)
    4. For loops and analogWrite()
      1. File -> Examples -> Analog -> Fading
  3. Switches and digitalRead()
    1. Rebuild  AnalogReadSerial tutorial, using  LDR instead of potentiometer. Schematic and diagram are here.
    2. Replace LDR with switch.
    3. Observe results

Homework due on Week 3 February 4

  1. Build a circuit with an LDR, a switch, and five LEDs.
    1. Read all the tutorials and other pages I referenced in todays lesson
    2. Write the program  to blink the LEDs in a simple Cylon/Larson/Knight-rider pattern. Make the LDR control the speed of the pattern, and make the switch change to a different pattern (any pattern).
    3. Document problems in your debug log. You may skip the trivial problems but I expect you to have at least a few non-trivial issues. Analyze and discuss.
    4. As always, document your project in your online journal. Programs should be properly indented (use COMMAND T in Arduino to fix indentation before you copy, and mark the space as “preformatted” in your journal before you paste the program in place.)
    5. Try to draw a schematic (either by hand, using Fritzing, or any other means)
    6. Include a short video demonstrating speed changes and the two different patterns
  2. Read about digital multimeters, for example at SparkFun or Adafruit

Week 3 February 4

  • Homework review
  • Working in groups, try to understand how you each approached the homework assignment
  • Download and install processing.org
  • Introduction to Processing
  • Arduino Graph tutorial
  • Arduino dimmer tutorial

In class assignment

  • Start with the Graph tutorial but modify it so that when you push the button, a rectangle changes from red to blue

Homework due on Week 4 February 11

  • Watch the following parts of the course Interactive Data Visualization with Processing by Barton Poulson on Lynda.com:
    • All of the Introduction
    • All of Basics of Processing
    • All of Basics of Drawing
    • All of Interaction
    • All of Grouping Code
  • Read SparkFun’s How to use a Multimeter
  • Read Adafruit’s Multimeter tutorial
  • Borrow a multimeter from the Hybrid Lab, and record the following in your online journal. Read carefully:
    • Measure and record the resistance of a resistor from the drawer labeled 10 Ohm.
    • Measure and record the resistance of a resistor from the drawer labeled 1K Ohm.
    • Measure and record the resistance of a resistor from the drawer labeled 10K Ohm.
    • Measure and record the voltages of a AAA, AA, C, and D battery from the drawer labeled “Good Batteries” or “Potentially Good Batteries”.
  • Read the Adafruit Arduino lesson 13: DC Motors
  • Read the SparkFun Motor overview
  • Read the Adafruit Arduino lesson 14: Servo motors
  • Read Adafruit’s All About Stepper Motors
  • Read the Adafruit Stepper Motor lesson

Week 4 February 11

Announcement: I will be away next week at a conference. I have arranged for a substitute teacher so class will meet as usual. The class is not optional and the substitute will take attendance so please attend.

  • Homework review
    • Multimeters
  • Background theory
    • What are voltage and current?
    • What is the relationship between voltage and current? (Resistance and Ohm’s law)
    • Arduino outputs, and what the current limit means
  • Lab
  • Time permitting
    • Discussion of other types of motors

Homework due on Week 5 February 18

  1. Read this Introduction to functions in Processing by Casey Reas and Ben Fry
    1. Take a stab at exercise 1 and post your work to your blog.
  2. Read this Introduction to Object Oriented Programming by Daniel Shiffman
  3. Download and install Processing

Week 5 February 18

Week 6 February 25

  • Report back: What did you do last week?
    • Communications
    • Functions
    • Classes
    • Other feedback?
  • Review classes
  • In-class exercise:
    1. Write a class which will draw a stationary rectangle that fades continuously between black and white. You can do this in any way you want. If you are unsure where to start, I suggest the following steps:
      1. Modify Example 1 from the simple Processing class example we reviewed in class:
        1. Draw a rectangle instead of a circle
        2. Make the rectangle stationary instead of moving
        3. Make the color of the rectangle fade continuously between black and white
      2. Modify your work from step A above to use a class, according to Example 2 from the simple Processing class example we reviewed in class.

Homework due on Week 7 March 3

Document all of your work on your journal:

  1. Finish the in-class exercises
  2. Modify Example 4 from the simple Processing class example we reviewed in class to create an array of 10 of your  rectangles
  3. Describe at least 3 problems you encountered, including details of how you solved them, in your debug log.

Week 7 March 3

  • Review homework
  • 555 Theremin
  • Fritzing/Othermill

Homework due on Week 8 March 10

Document all of your work on your journal:

  1. Create a schematic of the 555 Theremin we made in class using Fritzing
  2. Create a Printed Circuit Board layout (PCB view) in Fritzing for your 555 Theremin
  3. Remember that:
    1. All components must be on the top of the board
    2. All traces must be on the bottom of the board
    3. All components must be through hole (THT)
  4. Export your schematic and PCB layout as an image (JPG or PNG) and put it in your journal

Week 8 March 10

Announcement

  1. I have an unavoidable meeting at 2:00pm
  2. We are out of 1/64″ endmills!
  3. I will do midterm grades tomorrow

Agenda for today

  1. How to use an analog multiplexer to expand the number of analog sensors you can attach to your Arduino
    1. Sparkfun 74HC4052 description
    2. 74HC4052 utorial for serial signals
    3. 74HC4052 datasheet
    4. Your turn: Build a circuit on your solderless breadboard using the 74HC4052 to select one of 4 analog sensors to feed into one Arduino analog input. You can use potentiometers or whatever is easiest for you.
  2. Arduino shields are ways to add functionality to an Arduino. See
    1. Sparkfun article on shields
    2. List of “all” Arduino shields
    3. You can also make your own shield using our Othermill!

Homework due on Week 9 March 17

  1. Use Fritzing to design your own shield with a multiplexer. Ignore the shift register (74595) in the lower part of the schematic.
    1. Some important things to remember:
      1. Arduino connectors show up automatically because you included the Arduino
      2. Select outline, and select Arduino Shield
      3. Try to put all the traces on the bottom, but if you must put traces on the top, use vias and select the larger hole size
    2. More detailed instructions are here
    3. A good video tutorial by Fritzing is here

Week 9 March 17

  • Review shields you’ve done
  • Mill one of them
  • Briefly describe shift register to expand output
  • Soldering demo

Homework due on Week 11 March 31

Write a proposal for your final project in your journal.

  1. Your final project must be fairly complex with regards to the topics we’ve covered in this class. You don’t need to use everything we’ve learned, but your project must not be trivial either.
  2. However, spending lots of time on something that is not relevant to this class, for example, building a really complex enclosure, does not satisfy item 1 above.
  3. Your project must require researching new material, relevant to this class, that was not covered in class. You may research more deeply something we discussed, or explore brand new material.
  4. You must justify your project critically. Why is this relevant? Why is it interesting? Why should this be made?
  5. Your project may be used for another class as well, if you wish
  6. Identify everything you think might cause difficulty or delays.
  7. You will be required to show progress ever week. Create a draft timeline indicate what progress you hope to make every week
  8. Create a bill of materials, showing what items need to be purchased, laser cut, 3Dprinted, borrowed, or stolen.
  9. If you are unsure about any of these requirements it is your responsibility to reach out to me or another resource for clarification. You may send me work in progress for my feedback.

Week 11 March 31

  • Project idea presentations

Homework due on Week 12 April 7

Make progress on your projects!

Week 13 April 14

Remember to document your process as this is a large part of your final grade. Organize all the entries related to your final project so I can read them sequentially and that I can tell they are part of your final project and not previous assignments.

Schedule: Year zero reviews are in two weeks. That means that by next week in class your project needs to be mostly done. That means that this week in class your project should be very well underway, with most things tested and very little risk remaining

  • Project progress status
  • New material as needed for projects

Homework Schedule for next 3 weeks

Announcement: There is an extra office hour on Monday, April 18, from 4 – 5:30 PM in the Hybrid Lab

Thursday 4/21 – Your project needs to be completely functional, with everything tested and no risks remaining. It can still be in a prototype fashion e.g. spread out on the table, no enclosure, solderless breadboard

Thursday 4/28 – Project finished, functional, and in enclosure.
* No solderless breadboard – any electronic components must be soldered e.g. to a perforated breadboard, Arduino prototyping shield, or a PCB that you made on the OtherMill.
* I do not want to see a single wire jumper (example) anywhere in your project. Follow the rules I laid out Electronic Project Construction Teqhniques
* Do not solder any modules to your project. Use the appropriate mating connector.

Thursday 5/5 – Year Zero reviews. Documentation of process due. Organize all the entries related to your final project so I can read them sequentially and that I can tell they are part of your final project and not previous assignments.

Saturday 5/7 – I would like you all to show your projects at the Interface show which takes place at 7 PM at the Oliver Art Center on the Oakland campus. Setup will be during the day on Saturday, and possibly earlier.

  • Remember to test each piece in isolation. Don’t finish your project and test everything all at once.
  • Don’t ask me “does this look right?” or tell me “this doesn’t work”. Rather, test it, and perform the same analysis we’ve always done. Document this in your journal, as the process is part of your grade
    • What did you want to happen
    • What did you observe that happened
    • Make a guess to explain why what you observed is different from what you wanted (hypothesis).
    • Design an experiment to test your hypothesis
    • If the experiment proves your hypothesis was right, figure out what to change to get the results you want
    • If the experiment proves your hypothesis was wrong, think up a new hypothesis
    • If you are stuck at any stage you can ask me for suggestions, but you have to show me (documented in your journal) that you have tried to figure it out and what you have done.

Homework for Week 15 4/28

  1. There will be extra office hours on Monday and Wednesday next week:
    Monday 4/25 noon – 2 PM
    Wednesday 4/27 11 AM – 1 PM
  2. As I mentioned in class, you will choose only three projects to present at your Year Zero review. Thus I see 4 options for you to finish your project for me to grade:
    1. During class 4/28
    2. During your final review, if you choose this project as one of your three
    3. During the end of semester Interface show on Saturday 5/7, if you plan to show your work there
    4. If none of these options work for you, email me to arrange an alternate time.
  3. Evaluations must be done next week. If you do them before class, then you can use class time to work on your projects, but if you haven’t done them before class starts, then you will have to do them before you can work on your projects.

Week 15 4/28

  1. What to do about empty email
  2. What have you learned in this class?
  3. Evaluations
  4. Maker Faire (May 21 & 22)
  5. When do you want to present your project for grading?
    1. Today
    2. Next week during your review
    3. At the end of semester Interface show on Saturday 5/7
  6. Work time

Final homework

  1. If you have not completed the online class evaluation please do so right away. If you don’t know how to or if the link you received isn’t working please contact hcastrillon@cca.edu
  2. If you would like to display any of your work at Maker Faire, or if you would like to volunteer at the CCA booth, please contact agraham@cca.edu. This is a super awesome event and will be a huge amount of fun plus will give you great ideas, inspiration, and connections. I strongly encourage you to participate.
  3. If you would like to display any of your work at the the end of semester Interface show on Saturday 5/7 please email me and copy bhaynes@cca.edu so that we can coordinate installations
  4. If you wish me to review your work next week during your Year Zero Final Review, please email me so that I know
  5. If you wish to make an appointment with me for a review I am available on Monday 5/2 and Tuesday 5/3. Use this Doodle poll to select a time: http://doodle.com/poll/xhi9g2b5xedk8s2c. If you have any difficulty let me know as I’ve never set up a Doodle poll before and I may have made mistakes.
  6. I will be grading your journals on May 8. Please have your journals completed by noon. Later updates may not be graded.

Links to student journals

Print Friendly
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Leave a Reply

Your email address will not be published. Required fields are marked *