Home Chapter 17 Maxuino/Arduino tilt, limit switches. magnetic reed

Site Search

GTranslate

Chinese (Simplified) French German Italian Portuguese Russian Spanish
Maxuino/Arduino tilt, limit switches. magnetic reed

Switches are good sensors and are generally understood by most people encountering your invention. They are however a bit cold. You can purchase robust switches with lights and springs built into them from pinball parts suppliers, which can add a bit of color or fun to the system though, remember the notion of the interface and how cultural materials can have culturally associated excess baggage.

You may not want your work to be associated with a pinball machine but you also may. The contemporary artist Jason Ditmars uses pinball switches in his work many of which play off the aesthetic of pinball machines.

In the image below  you see switches that are robust and have lights on the interior so they glow. This can be advantageous in attracting fingers or hands in a dark room and add a bit of zing to the project.

 

Illuminated push button switches

 

Pushbutton switches can be normally open (NO) or normally closed (NC) and are generally spring loaded so that they will be deactivated after they are pushed. A good source for switches is Digikey at: http://www.digikey.com

 

push button switches

Here is some code on how to use a switch in Maxuino (Arduino controlled by Max Msp and Jitter). Notice the click for more information below does not work in this JOOMLA image though you can search the Arduino website for the switch schematic.

Max MSP Jitter code with Maxuino and Arduino

Limit switches are important spring mounted switches that are used as stop devices in motor applications. For instance, if motor travels too far, than the limit switch can cut power to the motor and can be used to send a signal to the microprocessor. They can also be used to create bump switches for mobile robots.

 

Limit Switch

 

A good source for limit switches is http://www.jameco.com

Tilt sensors are sensors with liquid mercury or couple pieces of metal inside a wire cage, which when moved allow contact to be made between two or more wires. These sensors are not good for high AC voltages however good for DC sensing. They are simple and very easy to use. Tilt sensor tends of be a bit noisy and may need to be debounced with the DEBOUNCE command on the BS2.

 

Debouncing is the process of allowing your microprocessor to understand a noisy signal coming from a sensor. When electrical contacts are made with some simple switches there are a few moments when the signal is neither high or low and somewhere in between with perhaps spiky moments of high and low. The debounce command in the Pbasic code allows the BS3

 

The Fredericks Company at http://www.frederickscom.com is a good source for a variety of tilt sensors. Spectron is also a good source at http://www.spectronsensors.com/.

 

 

Mercury switches

 

 

/*

Tilt Sensor Sketch:

 

LED connected to the ledPin will stay

on until the tilt sensor is turned

sideways or upside down.

*/

 

int ledPin = 8;

int tiltSensePin = A5;

 

void setup()

{

pinMode(ledPin,OUTPUT);// set ledPin to output mode

}

 

void loop()

{

// read in voltage to 10 bit ADC value: 0 to 1023

int tiltSense = analogRead(tiltSensePin);

 

 

if(tiltSense > 512)  // at least 1/2 of Vcc: no tilt

digitalWrite(ledPin,HIGH);// turn on LED

 

else

digitalWrite(ledPin,LOW);// turn off LED

 

}

Reed switches are small bits of metal very close together which when a powerful magnet comes into proximity to them causes the metal gap to close and makes a connection. They are very sensitive and work best with powerful rare earth magnets to activate them, such as the ones used in Chapter 12 to activate the Hall effect sensor. A good source of reed switches is http://www.meder.com

 

Reed magnetic switches

Black Rotary Encoder Modules brick sensor KY-040 for Arduino
Keyes 040 Encoder