Week 6 Lab

From Robert-Depot
Revision as of 07:36, 5 May 2009 by Rtwomey (talk | contribs) (Controlling the speed AND direction of a motor)

Jump to: navigation, search

from Electronic Technologies for Art

Controlling the speed AND direction of a motor

WHY: Because you can control both speed and direction of a motor at once... everything you need for forward/backward motion.

Use the processing-controlled Dimmer example (PWM) for speed, press buttons for direction.

Cautions: powering off of external power supply (12V instead of USB power 5V).

L293 quadruple half H-Bridge: http://www.st.com/stonline/books/pdf/docs/1328.pdf

Moving a solenoid

WHY: With forceful linear motion, you can lock/unlock doors, pull strings, move arms (levers), push keys, punch buttons, tap foreheads. What Would You Do?

Moving a Servo

WHY: With precise angular motion, you can... hmm... turn knobs, tune radios, steer cars.

In this example, turn a knob to have a motor turn, correspondently.

// potentiometer_servo
// turning the knob turns the servo
// Robert Twomey - roberttwomey.com

#include <Servo.h> 
 
Servo myservo;  // create servo object to control a servo 
               // a maximum of eight servo objects can be created 

int a_in = 0; // analog in pin
int val = 0;  // variable to store analog value

int pos = 0;    // variable to store the servo position 
int delay_time = 15; 
void setup() 
{ 
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object 
} 

void loop() 
{ 
  val=analogRead(a_in); // read value from potentiometer
  pos=map(val, 0, 1023, 0, 180); // map 0-1023 value to 0-180 degrees
  myservo.write(pos); // set servo position
 
  delay(50);
}

Homework

ASSIGNMENT:

Over the course of the next two weeks, we are going to do a mid-term project. Consider it a rehearsal for the final. Your mission: find an object and control it. This could be a toy (see Robosapien example below), a car, a clock (see clock example below), a blender (see blender example below). For this week's homework, you will identify the object you want to control, and write up a preliminary diagram describing how you will control it. A block diagram or flow diagram is a good example: are there inputs coming from sensors, into the microprocessor? If so, put them in the diagram. What are the actuators that are going to produce the output: motors + servos for moving parts, lights for blinking parts (are we bored with this yet), sound, smells. Think expansively! Can you make something bigger than 4x4x4'?

This is going to be a two week project, and a rehearsal for the final. We are going to get our first ideas out of our system with this project, letting you either build on this project or go in a new direction for the final. E-mail me if you are concerned whether or not your idea is feasible. But plan to come to class next week with a written proposal (2 paragraphs), some diagrams, and the thing you want to control.

Next week, in class, we will consider your projects in small groups, and come up with technical implementations (i.e. what circuits/chips/devices do you need) to make your project work. This project will count for part of your final and as homework, approx 25%. Final will remain 35%.


Robosapien example: http://www.arduino.cc/playground/Main/RoboSapienIR

Clock example: http://www.cibomahto.com/2008/03/controlling-a-clock-with-an-arduino/

Blender example: http://www.willitblend.com/