Warning: Constant WP_MEMORY_LIMIT already defined in /home/domains/museduino.org/docs/wp-config.php on line 93
rianne – Page 2 – Museduino

Servo Motor Sweep (PWM Select)

Overview

This tutorial will teach you how to use PWM  Select Jumpers with a Servo Motor.

Components

Arduino
A/B USB cable
Museduino Shield
Museduino Smorgasboard
CAT5 cable
servo motor
screw driver
prototyping wire

Setup

Before we get started, let’s learn about the PWM Select feature on the Main Shield. Locate the header pins (2×3 block) labeled “PWM” between the RJ-45 connecters.

PWM Select feature is a double-pole, double-throw (DPDT) switch. Learn more about DPDT switches here: https://learn.sparkfun.com/tutorials/switch-basics/all

The switches on the main shield are designed to swap pins between two ports. The PWM switch on the left of the main shield can be used to swap Satellite I/O pin 3 on Port A with Satellite I/O pin 5 on B. The PWM switch on the right of the main shield can be used to swap Satellite Pin 3 on Port C with Satellite I/O pin 5 on D.

In order to use the switches, you must use the jumper shunts provided. There are two jumper shunts for each PWM switch (2×3 block) and they both must be placed in an Up or Down position.

Below is a chart to assist with the proper jumper configuration:

Now that you have learned about the PWM Select feature, let’s implement a servo motor on Arduino Pin D5~.

The chart shows that Arduino Pin D5~ is available from Satellite I/O pin 3 on Port C. Since the PWM jumpers can be used to swap Satellite I/O pin 3 on Port C with Satellite I/O pin 5 on D, this means we can swap D5~ and D0. Place the jumper shunts in a “Down” position to make D5~ available from Satellite Pin 5 on Port D.

Next, connect a servo motor motor to Satellite I/O pin 5. We will need to use Power (screw terminal  1), Signal (screw terminal  3), Ground (screw terminal 4) on either a Smorgasboard or External Power Board.

Now connect the Smorgasboard to Port D on the main shield.

Code

Cop code below or download from Github.

Upload the sketch. Make sure your PWM jumpers are in the correct position.

/*
  Museduino | Servo Motors (PWM Select) Tutorial
  Servo Motor repeatedly turns from 0 to 180 degrees, then 180 to 0 degrees.
*/

#include  
 
Servo servo;  // create servo object to control a servo 
              // a maximum of eight servo objects can be created 
 
int pos = 0;    // variable to store the servo position 

//Use PWM Select Jumpers to switch Arduino pin D0 with D5~
int s5D = 5; // Arduino Pin D5~ - Satellite I/O Pin 5 on Port D
 
void setup() 
{ 
  servo.attach(s5D);  // attaches the servo on pin D5~ to the servo object 
} 
 
 
void loop() 
{ 
  for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    servo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
  for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
    servo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  } 
} 

Want to control the servo using a potentiometer?

Button

Overview

This tutorial will teach you how to implement a push button that turns on an LED with two smorgasboards on different ports.

Components

Arduino
A/B USB cable
Museduino Shield
2 Museduino Smorgasboards
2 CAT5 cables
LED
10k resistor
button
screwdriver

Setup

First, follow the setup for the LED Tutorial.

After you’ve completed the setup, locate Digital Pin 4 using the Satellite I/O chart.

The Pin Configuration chart shows that Digital Pin 4 is Satellite I/O pin 4 on Port C. Satellite I/O pin 4 has the following pin configuration:

1 – Power
2 – Signal + Resistor in Series
3 – Direct Signal
4 – Ground

Now hook up a button to Satellite I/O 4. Use Power (screw terminal pin 1), signal (screw terminal pin 3), and a 10k resistor between signal (screw terminal pin 3) and ground (screw terminal pin 4). Use a screwdriver to loosen/tighten the screw terminals.

Now connect the Smorgasboard to Port C on the main shield.

Code

Copy code below or download from Github. Once the sketch has been successfully uploaded, push the button to turn on the led.


/*
  Museduino | Button Tutorial
  Button turns on LED when pushed
*/
 
// Digital Pin 6 on Satellite Pin 5 via Port A
int s5A = 6;
// Digital Pin 4 on Satellite Pin 4 via Port C
int s4C = 4;

// variables
int buttonState = 0; // variable for reading the button status

// the setup routine runs once:
void setup() {                
  // initialize the led pin as an output
  pinMode(s5A, OUTPUT); 
  // initialize the button pin as an input
  pinMode(s4C, INPUT);  
    
}

// the loop routine runs over and over again forever:
void loop() {
  
  // read the state of the button value:
  buttonState = digitalRead(s4C);
  
  // check if the button is pushed
  // if it is, the buttonState is LOW:
  if (buttonState == LOW) {
    // turn LED on:
    digitalWrite(s5A, HIGH);
  }
  else {
      // turn LED off:
      digitalWrite(s5A, LOW);
  }
  
}

Want to use Servo Motors with Museduino?

LED

Overview

This tutorial will teach you how to wire up an LED with the Smorgasboard.

Components

Arduino
A/B USB cable
Museduino Shield
Museduino Smorgasboard
CAT5 cable
LED
screw driver

Setup

The main Museduino Shield’s header pins align with the Arduino headers. The shield should be stacked on top of the Arduino like below:

Next, let’s determine the I/O available on port A of the Museduino shield. Use the pinout chart to find Arduino Digital pin 6.

After reviewing, you will find that Digital pin 6 is Satellite Pin 5 on Port A.

Satellite boards have a solder mask to label Satellite I/O pins. You can find Satellite I/O 5 by locating the circled number 5.

Each Satellite I/O has a 4 pin configuration. Review the pin configuration chart:

This tutorial uses a Smorgasboard Satellite. Satellite I/O 5 has the following pin configuration (from the left of the screw terminal block):

1 – Power

2 – Signal pin with resistor in series

3 – Direct signal pin

4 – Ground

Museduino boards were designed for robust rapid-prototyping. By including a resistor in series in the pin configuration, this minimizes the need for additional parts, breadboards or soldering.

Simply, connect the positive side (anode) of the LED to the screw terminal pin 2 (signal + resistor in series) and the negative side of the led (cathode) to screw terminal pin 4 (ground). You will need a screwdriver to tighten/loosen the screw terminals.

Then, connect the Smorgasboard satellite to Port A on the Museduino Shield via CAT5 cable.

Code

Copy code below or download from Github.

Upload the sketch to your microcontroller. You should have a blinking LED.


/*
  Museduino | LED Tutorial
  Turns on LED for one second, then off for one second, repeatedly.
*/
 
// Digital Pin 6 on Satellite Pin 5 via Port A
int s5A = 6;

// the setup routine runs once:
void setup() {                
  // initialize the digital pin as an output
  pinMode(s5A, OUTPUT);     
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(s5A, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(s5A, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
}

Want to add a button?

Puppet Theater

Our puppet theater sample project (created for Hands of Enchantment Puppeteers in Albuquerque, NM) uses the Bluetooth LE Shield in order to control the color of the neopixel strips with the Adafruit Bluefruit LE Connect iphone/android app. The final version uses Museduino 2.0,  with 2 30-neopixel strips and 2 external power satellite boards.

Pneumatic Tubes

Our pneumatic tube system is built as two stations that can send and receive messages on either end. Originally, each station housed their own arduino, but were autonomous systems, existing together but not communicating directly.

The original version was built for the Santa Fe children’s museum in NM.

Since then, we have redesigned our pneumatic tubes prototype with the Museduino. Now we can use one Arduino for both stations. When a station sends a message, the lightbulb on the receiving end gets a light pulse, and when the other side receives the message, the sending side pulses. It’s a more real system, and despite the fact that its a complete anachronism, the joy of sending pneumatic messages feels current to us!