DESGN-650-01 Mechatronics, Spring 2016, CCA

DESGN-650-01 Mechatronics T 12:00PM 03:00PM SANF 107 (Hybrid Lab)
Industrial 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/19

  • Where are you
    • programming
    • electronics
    • physics
    • math
  • Intro to or review of Arduino, electronics, and Processing
    • Blink
    • Breadboard
    • AnalogReadSerial
    • AnalogInput (File -> Examples -> Analog -> AnalogInput)

Homework due on week 2 1/26

  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 1/26

  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 2

  1. Build a circuit with a potentiometer, 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 potentiometer 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 2

Theory

  • Schematics
  • What are voltage and current?
  • Resistance and Ohm’s law
  • Resistive vs. non-resistive components
  • Arduino outputs, and what the current limit means
  • Power supply issues

Motors Lab

  • PMDC motor lab

Homework due on week 4 February 9

  • 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 and do the Adafruit Arduino lesson 13: DC Motors

    • Don’t use the motors we used in class. I have reserved smaller motors for you to use. Ask the lab monitor to show you the motors reserved for my class in the portable Lista teaching cabinets. The rest of the components (resistors, transistors, diodes) are in the drawers behind the lab monitor.
    • Document the lesson in your journal
    • Include the schematic
    • Include your code
    • Discuss any problems in your debug log
  • 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
  • Optional: Wikipedia’s Stepper Motor article
  • Make a very rough sketch of a simple whimsical machine you might make with a stepper motor

Week 4 February 9

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
    • Motor tutorial
  • Different types of motors
    • DC motors
    • Hobby servo motors
    • Stepper motors
  • DC motors
    • Require external circuitry to control (transistor), even more to reverse
    • No position control – virtually impossible to get it to stop in a specific position
    • High speed, low torque
  • Gearmotors
    • Just DC motors with gears
    • Why?
      • Typically DC motors spin too fast to be useful (except maybe fans) and have too little torque (what is torque?) to be useful, like a bicycle with only one ridiculously high gear (very fast, but very hard to pedal. Easy to stall.)
      • Gears reduce the speed and increase the torque
  • Hobby servo motors
    • Control circuitry built-in
    • Gears built in
    • Absolute positioning over half a revolution (0-180 degrees)
    • Typically twitches a little when holding a position
  • Stepper motors
    • Like DC motors, control circuit and gears are not included
    • Very precise relative positioning over unlimited revolutions
    • Can hold a position with no movement (built in brake)
  • Hobby servo is the only useful motor that can be controlled directly from Arduino
  • H bridge required to control DC motor and stepper motor

Lab

Homework due on week 5 February 16

  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 16

Week 6 February 23

  • Review last week
    • Communications
      • With and without Firmata
    • Classes and Objects
    • Did you work on anything in class?
    • Any questions?
  • This week
    • Mechanics! (this video )
    • Machinations: Mechanisms  part 1 part 2)
      • Cams and linkages
      • Gears, pulleys, levers
    • Cabaret Mechanical Theatre book

Homework due on week 7  March 1

Build a hand driven drawing machine. Later we will add a motor and software to do something specific. For now it just needs to leave a mark on paper.

Week 7  March 1

  • Demo hand driven drawing machines
  • Robots
  • Othermill
  • Fritzing

Homework due on week 8  March 8

You have a choice of either:

  1. Automate your drawing machine.
    1. You must use some kind of actuator (DC motor, stepper motor, servo motor, etc.) to animate the drawing machine.
    2. The actuator must be controlled by Arduino, and your Arduino program must be triggered by some sort of sensor (e.g. light sensor, switch) which is connected to an Arduino input
    3. Your drawing machine must operate smoothly. You are not allowed to assist the moving parts.
    4. Your drawing machine must be stable and self supporting. You are not allowed to hold it in place or hold the paper for it.
  2. Create a mobile vehicle thing.
    1. It must be able to go forwards and backwards
    2. It must be able to steer left and right. You can use any steering method you wish: differential, rack and pinion, articulated in the middle, or anything else you can think of.
    3. You must be able to demonstrate that the motors turn, e.g. by hooking up a battery (in the case of a DC motor) or Arduino (in the case of a servo or stepper motor), but you don’t need to have the electronics integrated yet (that’s the next step)

Week 8  March 8

  • Demonstrate machines
  • Othermill (this time for real!)
  • Blink without delay, and Michael Margolis’ Time and TimeAlarm libararies

555ThereminSingleSided_schem

Fritzing and Othermill to make  a PCB

Follow instructions here

Homework due on week 9  March 15

  • Progress! One of the following:
    • If you did not finish your drawing machine, you may do so for next week. This will be our last week with the drawing machines.
    • If you made the mobile vehicle last week, your mission this week is to motorize the steering and automate the control. You must program your vehicle so that it goes forward for 5 seconds, turns left for 3 seconds, goes reverse for 5 seconds, and turns right for 3 seconds. You may not touch it during this time.
    • If you are not working on the drawing machine, and you did not make the mobile vehicle last week, then this is your first week with the mobile vehicle project. Your assignment is the mobile vehicle project from last week.
  • Read the Adafruit guide to Excellent Soldering
  • Finish your PCB layout in Fritzing, mill your board in the Othermill, and solder in the correct components
  • Review the Arduino for() loop tutorial
  • Read the Arduino Array tutorial
  • Read the Arduino Smoothing tutorial
  • Read the Arduino Calibration tutorial

Week 9  March 15

Homework due on week 11  March 29

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 29

  • Project idea presentations (2 minute presentation, 5 minute critique)
  • Construction techniques
    • Demonstrations
  • Voltage drops
    • Review voltage, current, resistance
    • Difference between perfect conductors and real world conductors
    • In addition, inductance and Capacitance
    • What causes voltage drops
      • Low frequency due to loads changing
      • High frequency due to motors, relays
  • Power supplies
    • Switched mode (SMPS) vs. linear
    • Regulated vs. unregulated

Homework due on week 12  April 5

Work on your projects!

  1. Prototype your mechanism, if you have a mechanism. If you don’t have all the parts yet, figure out how you can verify your design with what you have. Use cardboard, foam core, craft sticks – whatever is necessary and available.
  2. Order everything you think you’ll need! Don’t wait until your shopping list is perfect. That will be too late. You have to order parts now to start reducing uncertainties. There will be a risk that some parts will not be right and that you won’t end up using them. Hopefully they will not be too expensive, or hopefully you’ll be able to sell them to someone else. I warned you about this at the beginning of the semester!
  3. Start writing your program. Start by writing the comments, explaining what you want to happen.
  4. Specifics:
    1. Bonny: Research sound to light using Arduino. Yours isn’t using light, but the first part (sound to…) will be the same. I think we have most of the parts you need.
    2. Sam: Research accelerometers (should be pretty easy) and shocking device. Order shocking device
    3. Ethan: Prototype the mechanism!
    4. Zac: Build drumming mechanism!
    5. Yin:
      1. Prototype the hand following part (IR LED and phototransistors). Make sure it works. Use Serial.println() in lieu of motors.
      2. Prototype walking mechanism.
    6. Blaze:
      1. Prototype your three sensors
      2. How is the PIR sensor going to track motion? It can tell you whether a motion occurred in its field of vision, but it can’t tell you where the motion occurred. Perhaps talk to Yin regarding sensing where a hand is.
      3. A sound detector is a microphone. We have those.
    7. Kwan:
      1. Redraw your design based on my feedback in class: solenoids instead of servo motors, sensitive switch and solenoid for pop bumper
      2. Build a prototype paddle using a solenoid from the lab
      3. Build a prototype pop bumper
    8. Victor: Order parts, build low fidelity prototype, test your sensors and your code
    9. Khalid: Get parts, build prototype, get code working (I couldn’t open your project proposal so I don’t have the specific details in front of me.)

Week 12  April 5

  • Project status report
  • Individual work time

Week 13  April 12

  • Project status report
  • New topics related to your work
    • Isolation
      • Transistors
      • Relays
      • Optoisolators or optocouplers
  • Individual work time

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

Tuesday Week 14 4/19 – 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

Tuesday Week 15 4/26 – 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.

Tuesday 5/3 – 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/26

  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/26
    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/26

  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
    4. Make an appointment for Monday 5/2 or 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. 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 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 *