Tutorial.TiltSensor History

Hide minor edits - Show changes to markup

June 01, 2010, at 09:56 PM by Equipo Traduccion -
Changed lines 15-16 from:

Codigo

to:

Código

June 01, 2010, at 09:56 PM by Equipo Traduccion -
Changed lines 1-10 from:

Tilt Sensor

The tilt sensor is a component that can detect the tilting of an object. However it is only the equivalent to a pushbutton activated through a different physical mechanism. This type of sensor is the environmental-friendly version of a mercury-switch. It contains a metallic ball inside that will commute the two pins of the device from on to off and viceversa if the sensor reaches a certain angle.

The code example is exactly as the one we would use for a pushbutton but substituting this one with the tilt sensor. We use a pull-up resistor (thus use active-low to activate the pins) and connect the sensor to a digital input pin that we will read when needed.

The prototyping board has been populated with a 1K resitor to make the pull-up and the sensor itself. We have chosen the tilt sensor from Assemtech, which datasheet can be found here. The hardware was mounted and photographed by Anders Gran, the software comes from the basic Arduino examples.

Circuit

to:

Sensor de inclinación

El sensor de inclinación es un componente que puede detectar la inclinación de un objeto. Sin embargo, tan sólo se trata del equivalente a un pulsador activado a través de un mecanismo físico diferente. Este tipo de sensor es la versión ecológica de un interruptor de mercurio. Contiene una bola metálica en su interior que conmuta los dos pines del dispositivo de encendido a apagado y viceversa si el sensor alcanza un cierto ángulo.

El ejemplo de código es exactamente el mismo que el que se usaría para un pulsador, sustituyendo al pulsador por el sensor de inclinación. Usamos una resistencia pull-up (de ahí el uso activo-bajo para activar los pines) y conectamos el sensor a un pin de entrada digital que vamos a leer cuando sea necesario.

La placa de prototipo ha sido provista de una resistencia de 1K para hacer el "pull-up", y de un sensor de inclinación. Hemos elegido el sensor de inclinación de Assemtech, cuya hoja de características (datasheet) puede encontrarse aquí. El hardware fue montado y fotografiado por Anders Gran, el software proviene de los ejemplos básicos de Arduino.

Circuito

Changed lines 13-17 from:

Picture of a protoboard supporting the tilt sensor, by Anders Gran

Code

Use the Digital > Button example to read the tilt-sensor, but you'll need to make sure that the inputPin variable in the code matches the digital pin you're using on the Arduino board.

to:

Imagen de un sensor de inclinación montado sobre una placa de prototipos, por Anders Gran

Codigo

Utiliza el ejemplo Digital > Button para leer el sensor de inclinación, pero ten en cuenta que necesitarás asegurarte de que la variable "inputPin" en el código coincide con el pin digital que estás utilizando en la placa Arduino.

June 12, 2007, at 03:53 PM by David A. Mellis -
Changed line 17 from:

Use the 'Digital > Button example to read the tilt-sensor, but you'll need to make sure that the inputPin variable in the code matches the digital pin you're using on the Arduino board.

to:

Use the Digital > Button example to read the tilt-sensor, but you'll need to make sure that the inputPin variable in the code matches the digital pin you're using on the Arduino board.

June 12, 2007, at 03:53 PM by David A. Mellis -
Added lines 9-10:

Circuit

Changed lines 15-44 from:
 
/* Tilt Sensor
 * -----------
 *
 * Detects if the sensor has been tilted or not and
 * lights up the LED if so. Note that due to the
 * use of active low inputs (through a pull-up resistor)
 * the input is at low when the sensor is active.
 *
 * (cleft) David Cuartielles for DojoCorp and K3
 * @author: D. Cuartielles
 *
 */

int ledPin = 13;
int inPin = 7; 
int value = 0;

void setup() 
{
  pinMode(ledPin, OUTPUT);              // initializes digital pin 13 as output
  pinMode(inPin, INPUT);                // initializes digital pin 7 as input
}

void loop() 
{
  value = digitalRead(inPin);   // reads the value at a digital input 
  digitalWrite(ledPin, value);           
}

to:

Code

Use the 'Digital > Button example to read the tilt-sensor, but you'll need to make sure that the inputPin variable in the code matches the digital pin you're using on the Arduino board.

December 01, 2006, at 11:57 AM by David Cuartielles -
Changed lines 7-8 from:

The prototyping board has been populated with a 1K resitor to make the pull-up and the sensor itself. We have chosen the tilt sensor from Assemtech, which datasheet can be found here. The hardware was mounted and photographed by Anders Gran, the software comes from the basic Arduino examples.

to:

The prototyping board has been populated with a 1K resitor to make the pull-up and the sensor itself. We have chosen the tilt sensor from Assemtech, which datasheet can be found here. The hardware was mounted and photographed by Anders Gran, the software comes from the basic Arduino examples.

Changed lines 11-12 from:

Picture of a protoboard supporting the tilt sensor, by Anders Gran

to:

Picture of a protoboard supporting the tilt sensor, by Anders Gran

January 04, 2006, at 01:27 PM by 193.222.246.39 -
Added lines 1-42:

Tilt Sensor

The tilt sensor is a component that can detect the tilting of an object. However it is only the equivalent to a pushbutton activated through a different physical mechanism. This type of sensor is the environmental-friendly version of a mercury-switch. It contains a metallic ball inside that will commute the two pins of the device from on to off and viceversa if the sensor reaches a certain angle.

The code example is exactly as the one we would use for a pushbutton but substituting this one with the tilt sensor. We use a pull-up resistor (thus use active-low to activate the pins) and connect the sensor to a digital input pin that we will read when needed.

The prototyping board has been populated with a 1K resitor to make the pull-up and the sensor itself. We have chosen the tilt sensor from Assemtech, which datasheet can be found here. The hardware was mounted and photographed by Anders Gran, the software comes from the basic Arduino examples.

http://static.flickr.com/30/65458903_d9a89442a9.jpg

Picture of a protoboard supporting the tilt sensor, by Anders Gran

 
/* Tilt Sensor
 * -----------
 *
 * Detects if the sensor has been tilted or not and
 * lights up the LED if so. Note that due to the
 * use of active low inputs (through a pull-up resistor)
 * the input is at low when the sensor is active.
 *
 * (cleft) David Cuartielles for DojoCorp and K3
 * @author: D. Cuartielles
 *
 */

int ledPin = 13;
int inPin = 7; 
int value = 0;

void setup() 
{
  pinMode(ledPin, OUTPUT);              // initializes digital pin 13 as output
  pinMode(inPin, INPUT);                // initializes digital pin 7 as input
}

void loop() 
{
  value = digitalRead(inPin);   // reads the value at a digital input 
  digitalWrite(ledPin, value);           
}

Share