Connect a Potentiometer:
A potentiometer was connected to power and ground, and the middle wire was connected to Arduino analog input pin 0.
Send Serial Output:
The provided code was uploaded to the Arduino board.
Check Serial Output:
When turning the potentiometer, the range of ASCII values scrolled through in the serial monitor.
Make a Graph:
The provided code was entered into Processing.
Results:
When turning the potentiometer, the graph fluctuated up and down accordingly.
Wednesday, November 18, 2009
Lab8-Motors
Connect Power from Arduino to Breadboard:
Using the conventional red and black wires, the Arduino power and ground pins were connected to both sides of the breadboard.
Add a Potentiometer:
A potentiometer was hooked up to power and ground, and the middle wire was connected to Arduino analog pin 0.
Add a Motor:
Wires were soldered to the 2 contacts of a small motor. One wire was then connected to power, and the other to the center collector pin of a TIP120 transistor. The output leg of an LED was hooked up to the same TIP120 collector pin to prevent "blowback" current from causing a short circuit.
The base pin of the TIP120 was connected to a 1K ohm resistor, which was then connected to Arduino digital pin 9. The emitter pin of the TIP120 was connected to ground. To reduce circuit noise, a 10µF capacitor was placed between the power and ground rails of the breadboard.

Controlling Speed:
The provided code was uploaded to the Arduino board, and the motor spun according to the potentiometer's input value.
Add a Switch:
All components were removed except the power wiring and the motor. An SPST switch was connected to power and a 10K Ohm resistor going to ground. Arduino digital pin 2 was then wired to the node where the resistor and switch are connected.
Add an H-Bridge:
The H-Bridge was connected as follows:
Pin 16 to power
Pin 8 to power
Pin 1 to power
Pins 4, 5, 12, 13 to ground
Pin 2 to Arduino digital pin 3
Pin 7 to Arduino digital pin 7
Pin 3 to motor pin
Pin 6 to other motor pin
Pin 9 to Arduino digital pin 9

Controlling Direction:
The provided code was uploaded to the Arduino board. The switch toggled the direction the motor spun.
Using the conventional red and black wires, the Arduino power and ground pins were connected to both sides of the breadboard.
Add a Potentiometer:
A potentiometer was hooked up to power and ground, and the middle wire was connected to Arduino analog pin 0.
Add a Motor:
Wires were soldered to the 2 contacts of a small motor. One wire was then connected to power, and the other to the center collector pin of a TIP120 transistor. The output leg of an LED was hooked up to the same TIP120 collector pin to prevent "blowback" current from causing a short circuit.
The base pin of the TIP120 was connected to a 1K ohm resistor, which was then connected to Arduino digital pin 9. The emitter pin of the TIP120 was connected to ground. To reduce circuit noise, a 10µF capacitor was placed between the power and ground rails of the breadboard.

Controlling Speed:
The provided code was uploaded to the Arduino board, and the motor spun according to the potentiometer's input value.
Add a Switch:
All components were removed except the power wiring and the motor. An SPST switch was connected to power and a 10K Ohm resistor going to ground. Arduino digital pin 2 was then wired to the node where the resistor and switch are connected.
Add an H-Bridge:
The H-Bridge was connected as follows:
Pin 16 to power
Pin 8 to power
Pin 1 to power
Pins 4, 5, 12, 13 to ground
Pin 2 to Arduino digital pin 3
Pin 7 to Arduino digital pin 7
Pin 3 to motor pin
Pin 6 to other motor pin
Pin 9 to Arduino digital pin 9

Controlling Direction:
The provided code was uploaded to the Arduino board. The switch toggled the direction the motor spun.
Lab7-Programming 2
ClintBeharry-Shape: http://leftrightoutput.com/sva/physicalcomputing/prog2/1Shape/
ClintBeharry-Swatches: http://leftrightoutput.com/sva/physicalcomputing/prog2/2Swatches/
ClintBeharry-Character: http://leftrightoutput.com/sva/physicalcomputing/prog2/3Character/
ClintBeharry-Animation: http://leftrightoutput.com/sva/physicalcomputing/prog2/4Animation/
ClintBeharry-SquareLights: http://leftrightoutput.com/sva/physicalcomputing/prog2/5SquareLights/
ClintBeharry-ColorSwapper: http://leftrightoutput.com/sva/physicalcomputing/prog2/6ColorSwapper/
ClintBeharry-Racetrack: http://leftrightoutput.com/sva/physicalcomputing/prog2/7Racetrack/
ClintBeharry-Bounce: http://leftrightoutput.com/sva/physicalcomputing/prog2/8Bounce/
ClintBeharry-Snowman: http://leftrightoutput.com/sva/physicalcomputing/prog2/9Snowman/
ClintBeharry-MyFunction: http://leftrightoutput.com/sva/physicalcomputing/prog2/10MyFunction/
ClintBeharry-SharedFunction: http://leftrightoutput.com/sva/physicalcomputing/prog2/11SharedFunction/
ClintBeharry-AnimatedWorld: Same as MyFunction (explained in comments in MyFunction)
ClintBeharry-Swatches: http://leftrightoutput.com/sva/physicalcomputing/prog2/2Swatches/
ClintBeharry-Character: http://leftrightoutput.com/sva/physicalcomputing/prog2/3Character/
ClintBeharry-Animation: http://leftrightoutput.com/sva/physicalcomputing/prog2/4Animation/
ClintBeharry-SquareLights: http://leftrightoutput.com/sva/physicalcomputing/prog2/5SquareLights/
ClintBeharry-ColorSwapper: http://leftrightoutput.com/sva/physicalcomputing/prog2/6ColorSwapper/
ClintBeharry-Racetrack: http://leftrightoutput.com/sva/physicalcomputing/prog2/7Racetrack/
ClintBeharry-Bounce: http://leftrightoutput.com/sva/physicalcomputing/prog2/8Bounce/
ClintBeharry-Snowman: http://leftrightoutput.com/sva/physicalcomputing/prog2/9Snowman/
ClintBeharry-MyFunction: http://leftrightoutput.com/sva/physicalcomputing/prog2/10MyFunction/
ClintBeharry-SharedFunction: http://leftrightoutput.com/sva/physicalcomputing/prog2/11SharedFunction/
ClintBeharry-AnimatedWorld: Same as MyFunction (explained in comments in MyFunction)
Lab6-Analog Output
Connect Power from Arduino to Breadboard:
Using the conventional red and black wires, the Arduino power and ground pins were connected to both sides of the breadboard.
Servo and Sensor:
A potentiometer was connected to the Arduino input pin 0. The servo motor was connected to power and ground, and the 3rd wire (orange) was connected to the Arduino digital pin 9.

Programming:
The provided coded was loaded to the Arduino board. The servo motor mapped from 0 to (almost) 180 degrees, as the potentiometer value shifted from 0 to 1023.
Speaker Setup:
The servo motor was removed from the circuit. A speaker was connected to ground, and the other end was connected to a resistor, which in turn was connected to the Arduino digital pin 8.

Tone Library:
The Tone library was downloaded from the Arduino website and installed into the Arduino libraries folder. The provided code was then loaded to the Arduino board, and the speaker tone output responded to the potentiometer input.
Create Something Unique:
Using the servo motor attached to a lever (chopstick), a target sign was attached to the end of the lever to oscillate back and forth. The target sign had a small hole in the center for a photoresistor.
The photoresistor value was read as input into the Arduino code, and if the light value was high enough the servo motor was activated to move along its oscillation. A NERF gun was outfitted with a flashlight scope to shine a light where the gun was aimed. With these components in place, an impossible target system was created. Once the gun was aimed at the target, the target would move away.
Video: http://www.youtube.com/watch?v=1jFErmvWepQ
Using the conventional red and black wires, the Arduino power and ground pins were connected to both sides of the breadboard.
Servo and Sensor:
A potentiometer was connected to the Arduino input pin 0. The servo motor was connected to power and ground, and the 3rd wire (orange) was connected to the Arduino digital pin 9.

Programming:
The provided coded was loaded to the Arduino board. The servo motor mapped from 0 to (almost) 180 degrees, as the potentiometer value shifted from 0 to 1023.
Speaker Setup:
The servo motor was removed from the circuit. A speaker was connected to ground, and the other end was connected to a resistor, which in turn was connected to the Arduino digital pin 8.

Tone Library:
The Tone library was downloaded from the Arduino website and installed into the Arduino libraries folder. The provided code was then loaded to the Arduino board, and the speaker tone output responded to the potentiometer input.
Create Something Unique:
Using the servo motor attached to a lever (chopstick), a target sign was attached to the end of the lever to oscillate back and forth. The target sign had a small hole in the center for a photoresistor.
The photoresistor value was read as input into the Arduino code, and if the light value was high enough the servo motor was activated to move along its oscillation. A NERF gun was outfitted with a flashlight scope to shine a light where the gun was aimed. With these components in place, an impossible target system was created. Once the gun was aimed at the target, the target would move away.
Video: http://www.youtube.com/watch?v=1jFErmvWepQ
Subscribe to:
Comments (Atom)