Workshop 3 Resources
We talked about PWM in the previous workshop which we used to fake analog fading of an LED. This time we will use it to control a servo motor. We will have a look at another built in example, again have a look at the 'File>Examples' menu in the Arduino environment, this time choosing the 'Servo>Knob' sketch.
You will again see a link to a tutorial on the Arduino website with a picture of a circuit similar to the following:
Read the tutorial and build the circuit, you may even need to look up your particular model of servo to find out which wire colours correspond to the ones in the image, they are not all the same. Just google the motor model number if it is not clear.
Have a look at the code and you will see the same remapping of the knob input value to something that the servo motor likes, in this case 0 - 180. The 'myservo.write' function is a special function of the servo library (an add on of some pre written code essentially) that we included in our sketch with the '#include <Servo.h>' at the top. There are many pre-existing libraries with specialist functions that can make our lives much easier.
Upload the code and turn the knob to turn the servo motor.
Simple use of a button (a digital input) to turn an LED on
Reading a fader/knob/sensor (analog input) to fade an LED
Control a servo motor using Pulse Width Modulation
Having a look at circuit design using Fritzing
Some tips on soldering
Exploring how to communicate with the computer via serial
A look at Max MSP and how we can speak to it from Arduino
A look at some of the built in video modules of Max and using Arduino to control them
Going the other way and using a Max user interface to control Arduino hardware