Final project
 Project management
 Computer-aided design
 Computer-controlled cutting
 Electronics production
 3D scanning and printing
 Electronics design
 Molding and casting
 Embedded programming
 Computer-controlled machining
 Input devices
 Composites
 Interface and application programming
 Output devices
 Networking and communications
 Mechanical design, machine design
 Applications and implications
 Invention, intellectual property, and income
 Project development
 Final project presentations
 About me
 
   Output devices
   

Assignment  
Add an output device to a microcontroller board and program it to do something.

For this week assignment I have been working with servo motors.
I have milled the hello servo board in the modela and solder the components.


Then I have programed the board with the FabISP and Neil`s C programs hello.servo.44.c and hello.servo.44.2.c to see if all is working fine.

- One servo:


- Two servos:


After than I decided to make a small project with:
- a Fabuino
- a piezo film (input device)
- a servo motor (output device)
- arduino IDE

I want to make a reactive target to train with an air gun.
Usually a reactive target drops when you hit it one time.
Instead of this I want to program the number of hits necessary to drop it.
The piezo film detects the hits so when you reach the desire number of hits, the servo motor allows the target to drop.


Here is the code:

Arduino code:

/*
blanco reactivo con numero variable de impactos
reactive target drops when you hit it "x" times

created 23 april 2013
by EpifanioLCueva

This example code is in the public domain.

*/


#include <Servo.h>

Servo miServo; // inicializamos un servo

// variables
int sensorPin = A0; // el pin del servo
int contadorSensor = 0; // contador de impactos
int estadoSensor = 0; // estado del sensor

void setup() {

Serial.begin(115200); // empezamos la comunicacion con el puerto en serie
miServo.attach(2); // pin del servo
miServo.write(90); // ponemos el brazo del pin a 90º

}

void loop() {

estadoSensor = analogRead(sensorPin); // leemos el estado del sensor
if (estadoSensor > 12) // vemos si hay impacto. Aqui podemos ajustar la sensibilidad
{
contadorSensor ++; // aumentamos el contador
Serial.print("impacto numero");
Serial.print(contadorSensor);
Serial.println();

if (contadorSensor == 4) { // vemos si hemos llegado al numero de impactos necesarios para abatir el blanco

miServo.write(180); // giramos el servo para que caiga el blanco
contadorSensor = 0; //ponemos contador a cero
}
delay(200);
}
else {
Serial.println(estadoSensor); // mandamos estado sensor a puerto serie
delay(200);
}

}

contadoryservofilmfinal.ino

 


Although I made the program work I have not enough time to integrate the electronics in the target.


 

 
   
   
Epifanio L. Cueva © 2013