Вы находитесь на странице: 1из 39

Lector de temperaturas en grados Fahrenheit y centgrados, con display LCD, es un aplicacin bastante simple e

interesante.
Verdaderamente la plataforma Arduino es muy verstil, y adems fcil de comprender. Durante muchos aos estuve
interesado en los microprocesadores y micro controladores, 8085, Pic, Paralax, Basic Stamp, AVR y otros pero los
encontraba muy montonos, pero cuando me tope con Arduino, me sorprend, las aplicaciones que se le pueden dar
son inmensas y los componentes que se pueden encontrar para esta plataforma, son sper interesantes, los GPS
permiten la creacin de equipos de vuelo parcialmente autnomos, con tan solo indicar las coordenadas, es un
proyecto que ms tarde mostrare, con los quadcopter..
Tambin la robtica esta increble con los Hexpodos, este ser otro proyecto que mostrare ms adelante, y las
aplicaciones en CNC (Fresadoras), en fin son temas que mas adelante tocaremos.
Indicador de temperatura LCD

Aqui tienen el sketch para arduino


/*
Temperature Indicator F/C with LM35 sensor.
apcexpert.blogspot.com
apcexpert.wordpress.com
*/
// LCD library code:
#include <LiquidCrystal.h>
// The numbers of the interface pins
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
// Variables
float TempC;
float TempF;
int TempPin = 1;
void setup(){
// LCD's line position of columns and rows:
lcd.begin(16, 2);
lcd.print(" Temp Indicator");
lcd.setCursor(0, 1);
lcd.print("Temp");
}
void loop(){
TempC = analogRead(TempPin);
//read the value from the sensor
TempC = (5.0 * TempC * 100.0)/1024.0; //convertion the analog data to temperature
TempF = ((TempC*9)/5) + 32;
//convertion celcius to farenheit
// print result to lcd display
lcd.setCursor(11, 1);
lcd.print(TempC,1);
lcd.print("C");

lcd.setCursor(5, 1);
lcd.print(TempF,1);
lcd.print("F");
delay(1000);
}
Hasta la proxima.
Reacciones:
a la/s sbado, julio 28, 2012 No hay comentarios.:
Arduino IR Remote Control - Controlar 4 relays con un control remoto Infrerojo
Enviar esto por correo electrnicoBlogThis!Compartir en TwitterCompartir en FacebookCompartir en Pinterest
Hoy les traigo un proyecto de como controlar un panel de 4 relays utilizando in control remoto infrarojo ( IR remote
control ). se requiere tener la libreria del sensor infrerojo. Nota importante en esta libreria requiere una pequea
modificacion, solo cuando utilizas las verciones nuevas del programa de Arduino 1.0 y 1.0.1 en las anteriores no
tendras problemas.
La modificacion consiste en remplazar #include <WProgram.h>
por #include <Arduino.h> en el archivo IRRemoteInt.h.
Si tienen algun problema me abisan, con gusto los ayudare.
Enlace: IR Reomote library
Conecciones electricas:
Pin 13 canal 1
pin 12 canal 2
pin 11 canal 3
pin 10 canal 4
pin 7 seal del sensor infrarojo

Estoy utilizando el Control remoto modelo YK-001, lo pueden conseguir en ebay.com, en la imagen podrn ver los
cdigos de cada tecla, los necesitaran para su proyecto.

Con el siguiente sketch de Arduino podrn localizar los cdigos de otros controles, los cdigos los podrn ver en el
serial monitor, por si desean utilizar otro diferente:
//apcexpert.blogspot.com
// IR Remote Control Code Finder
#include <IRremote.h>
int RECV_PIN = 7; //define input pin on Arduino
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value );
irrecv.resume(); // Receive the next value
}
}

Para finalizar, el Sketch de Arduino con el cual podremos controlar los cuatro relay como se ve en la imagen superior;
// apcexpert.blogspot.com
#include <IRremote.h>
int RECV_PIN = 7;
int Relay1_PIN = 13;
int Relay2_PIN = 12;
int Relay3_PIN = 11;
int Relay4_PIN = 10;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
pinMode(Relay1_PIN, OUTPUT);
pinMode(Relay2_PIN, OUTPUT);
pinMode(Relay3_PIN, OUTPUT);
pinMode(Relay4_PIN, OUTPUT);
pinMode(6, OUTPUT);
irrecv.enableIRIn(); // Start the receiver
}
int on = 1;
void loop() {
if (irrecv.decode(&results)) {
if (results.value == 16724175) { // YK-001 button 1
{
on = !on;
digitalWrite(Relay1_PIN, on ? HIGH : LOW);
}
}
{
if (results.value == 16718055) { // YK-001 button 2
{
on = !on;
digitalWrite(Relay2_PIN, on ? HIGH : LOW);
}
}
{
if (results.value == 16743045) { // YK-001 button 3
{
on = !on;
digitalWrite(Relay3_PIN, on ? HIGH : LOW);
}
}
{
if (results.value == 16716015) { // YK-001 button
{
on = !on;
digitalWrite(Relay4_PIN, on ? HIGH : LOW);
}
}
irrecv.resume(); // Receive the next value
}
}}}}
Espero que no tengan problemas, pero de tenerlos pueden comunicarse y con gusto los ayudare en lo posible. Hasta la
prxima.
Reacciones:
a la/s sbado, julio 28, 2012 No hay comentarios.:
Vnculos a esta publicacin
viernes, 13 de julio de 2012
ArduinoComponentes para control de potencia
Enviar esto por correo electrnicoBlogThis!Compartir en TwitterCompartir en FacebookCompartir en Pinterest
Estos son algunos componentes que se podran utilizar con los proyectos de Arduino, mostrare algunos circuitos
bsicos para tener ideas de cmo aplicarlos.

1 Los transistores la imagen muestra cmo utilizarlos, el transistor debe seleccionarse segn el voltaje y la
corriente de operacin, el especificado en la imagen es el TIP122 este transistor puede ser operado a un mximo de
100voltios y la corriente mxima de operacin es de 5 amperios, recuerde que es el mximo, recomiendo utilizarlo al
70% de su capacidad, tambin aplicar los disipadores de calor.

Especificaciones del Tip122 ( Datasheet ) http://www.fairchildsemi.com/ds/TI/TIP120.pdf


2- Transistores MOSFET- Aunque luce similar al transistor, este no tiene que ver con la corriente que transcurre por
su base, es solo el voltaje aplicado le Gate o compuerta de control (similar a la base del transistor), La ventaja con los
mosfet es que podemos utilizar motores o cargas con mayor potencia ya que estos pueden manejar corrientes desde
10 hasta 100 amperios, estos son modelos muy comunes tambin encontraran de mayores capacidades pero son ms
costosos y no tan accesibles. mostrare algunas imgenes para sus aplicaciones sencillas.

3- Los Solid State Relay( Relevadores en estado slido) Esta alternativa lucir mucho mas profesional si realizan
un proyecto comercial o industrial, se utilizan en circuitos de corriente alterna, podran remplazar los arrancadores

magnticos de motores, sin la necesidad de tener que remplazar contactos como en los controladores magnticos que
se utilizan en las industrias.
Pueden ser controlados con voltajes de 3 hasta 24Voltios DC, son muy verstiles, requieren disipadores de calor y si
tienen ventilacin ser mucho mejor.

Para motores trifasicos

como pueden ver hay diversas formas de contralar cargas desde Arduino. hasta la prxima.
Reacciones:
a la/s viernes, julio 13, 2012 1 comentario:
Vnculos a esta publicacin
Etiquetas: Arduino, Arduino y Relays
martes, 10 de julio de 2012
Controlar 8 relays con Visual Basic y Arduino
Enviar esto por correo electrnicoBlogThis!Compartir en TwitterCompartir en FacebookCompartir en Pinterest
Podrn ver como hacer que se puedan controlar 8 relays desde visual Basic 2010, tan solo con un solo botn podrs
activar y desactivar. Tambin podrn observar como los indicadores cambiaran de color verde a rojo cuando el relay
este activado, Podrn comparar con la publicacin anterior y podrn notar los cambios realizados en el Sketch de
arduino y tambin en Visual Basic.
No solo podrn controlar relays, pueden apilarlo en diferentes proyectos como prender motores, lmparas, entre otras
cosas. Espero les guste.

Podran utilisar diferentes paneles de relays :

Aqu les dejo el Sketch de Arduino


//apcexpert.blogspot.com
//Con este programa controlaras 8 relays con pulsar un boton para actibar y
//al pursarlo nuevamente se desactiva.
char inData[20]; // Allocate some space for the string
char inChar=-1; // Where to store the character read
byte index = 0; // Index into array; where to store the character
void setup() {
Serial.begin(9600);
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
pinMode(9, OUTPUT);
pinMode(8, OUTPUT);

pinMode(7, OUTPUT);
pinMode(6, OUTPUT);
}
char PinOut(char* This) {
while (Serial.available() > 0) // Don't read unless
// there you know there is data
{
if(index < 19) // One less than the size of the array
{
inChar = Serial.read(); // Read a character
inData[index] = inChar; // Store it
index++; // Increment where to write next
inData[index] = '\0'; // Null terminate the string
}
}
if (strcmp(inData,This) == 0) {
for (int i=0;i<19;i++) {
inData[i]=0;
}
index=0;
return(0);
}
else {
return(1);
}
}
void loop()
{
if (PinOut("13 on")==0) { digitalWrite(13, HIGH);}
if (PinOut("13 off")==0) {digitalWrite(13, LOW);}
if (PinOut("12 on")==0) { digitalWrite(12, HIGH);}
if (PinOut("12 off")==0) {digitalWrite(12, LOW);}
if (PinOut("11 on")==0) { digitalWrite(11, HIGH);}
if (PinOut("11 off")==0) {digitalWrite(11, LOW);}
if (PinOut("10 on")==0) { digitalWrite(10, HIGH);}
if (PinOut("10 off")==0) {digitalWrite(10, LOW);}
if (PinOut("9 on")==0) { digitalWrite(9, HIGH);}
if (PinOut("9 off")==0) {digitalWrite(9, LOW);}
if (PinOut("8 on")==0) { digitalWrite(8, HIGH);}
if (PinOut("8 off")==0) {digitalWrite(8, LOW);}
if (PinOut("7 on")==0) { digitalWrite(7, HIGH);}
if (PinOut("7 off")==0) {digitalWrite(7, LOW);}
if (PinOut("6 on")==0) { digitalWrite(6, HIGH);}
if (PinOut("6 off")==0) {digitalWrite(6, LOW);}
}
Visual Basic 2010
Imports System.IO
Imports System.IO.Ports
Imports System.Threading
Public Class Form1
' Shared _continue As Boolean
' Shared _serialPort As SerialPort
Dim pinout13 As Boolean = True
Dim pinout12 As Boolean = True
Dim pin11 As Boolean = True
Dim pinout10 As Boolean = True
Dim pinout9 As Boolean = True
Dim pinout8 As Boolean = True
Dim pinout7 As Boolean = True
Dim pinout6 As Boolean = True
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
SerialPort1.Close()

SerialPort1.PortName = "com4" 'Cambiar el numero de Puerto "COM"


SerialPort1.BaudRate = 9600
SerialPort1.DataBits = 8
SerialPort1.Parity = Parity.None
SerialPort1.StopBits = StopBits.One
SerialPort1.Handshake = Handshake.None
SerialPort1.Encoding = System.Text.Encoding.Default
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button1.Click
SerialPort1.Open()
If pinout13 = True Then
SerialPort1.Write("13 on")
RectangleShape1.BackColor = Color.Red
Else
SerialPort1.Write("13 off")
RectangleShape1.BackColor = Color.Lime
End If
pinout13 = Not (pinout13)
SerialPort1.Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button2.Click
SerialPort1.Open()
If pinout12 = True Then
SerialPort1.Write("12 on")
RectangleShape2.BackColor = Color.Red
Else
SerialPort1.Write("12 off")
RectangleShape2.BackColor = Color.Lime
End If
pinout12 = Not (pinout12)
SerialPort1.Close()
End Sub
Private Sub RectangleShape1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
RectangleShape1.Click, RectangleShape8.Click
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button3.Click
SerialPort1.Open()
If pin11 = True Then
SerialPort1.Write("11 on")
RectangleShape3.BackColor = Color.Red
Else
SerialPort1.Write("11 off")
RectangleShape3.BackColor = Color.Lime
End If
pin11 = Not (pin11)
SerialPort1.Close()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button4.Click
SerialPort1.Open()
If pinout10 = True Then
SerialPort1.Write("10 on")
RectangleShape4.BackColor = Color.Red
Else
SerialPort1.Write("10 off")
RectangleShape4.BackColor = Color.Lime
End If
pinout10 = Not (pinout10)
SerialPort1.Close()
End Sub
Private Sub RectangleShape3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
RectangleShape3.Click, RectangleShape6.Click
End Sub

Private Sub RectangleShape4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles


RectangleShape4.Click, RectangleShape5.Click
End Sub
Private Sub RectangleShape2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
RectangleShape2.Click, RectangleShape7.Click
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button8.Click
SerialPort1.Open()
If pinout6 = True Then
SerialPort1.Write("6 on")
RectangleShape8.BackColor = Color.Red
Else
SerialPort1.Write("6 off")
RectangleShape8.BackColor = Color.Lime
End If
pinout6 = Not (pinout6)
SerialPort1.Close()
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button5.Click
SerialPort1.Open()
If pinout9 = True Then
SerialPort1.Write("9 on")
RectangleShape5.BackColor = Color.Red
Else
SerialPort1.Write("9 off")
RectangleShape5.BackColor = Color.Lime
End If
pinout9 = Not (pinout9)
SerialPort1.Close()
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button6.Click
SerialPort1.Open()
If pinout8 = True Then
SerialPort1.Write("8 on")
RectangleShape6.BackColor = Color.Red
Else
SerialPort1.Write("8 off")
RectangleShape6.BackColor = Color.Lime
End If
pinout8 = Not (pinout8)
SerialPort1.Close()
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button7.Click
SerialPort1.Open()
If pinout7 = True Then
SerialPort1.Write("7 on")
RectangleShape7.BackColor = Color.Red
Else
SerialPort1.Write("7 off")
RectangleShape7.BackColor = Color.Lime
End If
pinout7 = Not (pinout7)
SerialPort1.Close()
End Sub
End Class
Hasta la proxima.
Reacciones:
a la/s martes, julio 10, 2012 1 comentario:
Vnculos a esta publicacin
Etiquetas: Arduino, Arduino y Relays, Arduino y Visual Basic
lunes, 9 de julio de 2012
Arduino y Visual Basic 2010Controlar relay con un solo boton
Enviar esto por correo electrnicoBlogThis!Compartir en TwitterCompartir en FacebookCompartir en Pinterest

En esta publicacin controlaremos 4 relays utilizando un programa creado en Visual Basic 2010, mediante la
comunicacin del puerto USB nos conectaremos al Arduino UNO, y este a subes activara o desactivara los relay.
Lo prepare por una peticin en los comentarios y aqu esta la respuesta.
Primero el ejemplo ser con 4 Relays y en la prxima publicacin ser con 8 relays para que puedan ver los cambios
realizados y sirva de ejemplo para todos. Espero les guste.

El circuito utilizado ser el mismo de la publicacin anterior:


Controlando 4 relays con Arduino y Visual Basic 2010
Conecciones electricas:
Pin 13 canal 1
pin 12 canal 2
pin 11 canal 3
pin 10 canal 4

A continuacin el Sketch de Arduino UNO

//apcexpert.blogspot.com
//Con este programa controlaras 4 relays con pulsar un botn para activar y
//al pulsarlo nuevamente se desactiva.
char inData[20]; // Allocate some space for the string
char inChar=-1; // Where to store the character read
byte index = 0; // Index into array; where to store the character
void setup() {
Serial.begin(9600);
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
}
char PinOut(char* This) {
while (Serial.available() > 0) // Don't read unless
// there you know there is data
{
if(index < 19) // One less than the size of the array
{
inChar = Serial.read(); // Read a character
inData[index] = inChar; // Store it
index++; // Increment where to write next
inData[index] = '\0'; // Null terminate the string
}
}
if (strcmp(inData,This) == 0) {
for (int i=0;i<19;i++) {
inData[i]=0;
}
index=0;
return(0);
}
else {
return(1);
}
}
void loop()
{
if (PinOut("13 on")==0) { digitalWrite(13, HIGH);}
if (PinOut("13 off")==0) {digitalWrite(13, LOW);}

if (PinOut("12 on")==0) { digitalWrite(12, HIGH);}


if (PinOut("12 off")==0) {digitalWrite(12, LOW);}
if (PinOut("11 on")==0) { digitalWrite(11, HIGH);}
if (PinOut("11 off")==0) {digitalWrite(11, LOW);}
if (PinOut("10 on")==0) { digitalWrite(10, HIGH);}
if (PinOut("10 off")==0) {digitalWrite(10, LOW);}
}
Continuamos con el codigo fuente de Visual Basic 2010
Imports System.IO
Imports System.IO.Ports
Imports System.Threading
Public Class Form1
' Shared _continue As Boolean
' Shared _serialPort As SerialPort
Dim pinout13 As Boolean = True
Dim pinout12 As Boolean = True
Dim pin11 As Boolean = True
Dim pinout10 As Boolean = True
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
SerialPort1.Close()
SerialPort1.PortName = "com4" 'Cambiar el numero de Puerto "COM"
SerialPort1.BaudRate = 9600
SerialPort1.DataBits = 8
SerialPort1.Parity = Parity.None
SerialPort1.StopBits = StopBits.One
SerialPort1.Handshake = Handshake.None
SerialPort1.Encoding = System.Text.Encoding.Default
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button1.Click
SerialPort1.Open()
If pinout13 = True Then
SerialPort1.Write("13 on")
RectangleShape1.BackColor = Color.Red
Else
SerialPort1.Write("13 off")
RectangleShape1.BackColor = Color.Lime
End If
pinout13 = Not (pinout13)
SerialPort1.Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button2.Click
SerialPort1.Open()
If pinout12 = True Then
SerialPort1.Write("12 on")
RectangleShape2.BackColor = Color.Red
Else
SerialPort1.Write("12 off")
RectangleShape2.BackColor = Color.Lime
End If
pinout12 = Not (pinout12)
SerialPort1.Close()
End Sub
Private Sub RectangleShape1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
RectangleShape1.Click
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button3.Click
SerialPort1.Open()

If pin11 = True Then


SerialPort1.Write("11 on")
RectangleShape3.BackColor = Color.Red
Else
SerialPort1.Write("11 off")
RectangleShape3.BackColor = Color.Lime
End If
pin11 = Not (pin11)
SerialPort1.Close()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button4.Click
SerialPort1.Open()
If pinout10 = True Then
SerialPort1.Write("10 on")
RectangleShape4.BackColor = Color.Red
Else
SerialPort1.Write("10 off")
RectangleShape4.BackColor = Color.Lime
End If
pinout10 = Not (pinout10)
SerialPort1.Close()
End Sub
Private Sub RectangleShape3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
RectangleShape3.Click
End Sub
Private Sub RectangleShape4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
RectangleShape4.Click
End Sub
Private Sub RectangleShape2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
RectangleShape2.Click
End Sub
End Class
Suerte con el proyecto. Gracias

Reacciones:
a la/s lunes, julio 09, 2012 9 comentarios:
Etiquetas: Arduino, Arduino y Relays, Arduino y Visual Basic
domingo, 8 de julio de 2012
Visual Basic 2010 y Arduino Servo control con LCD display.
Enviar esto por correo electrnicoBlogThis!Compartir en TwitterCompartir en FacebookCompartir en Pinterest
En el post anterior presente como controlar un servo utilizando un Slider en Visual BASIC 2010, ahora les traigo una
actualizacin para mejorar su apariencia y aadir nuevas funciones. Espero les guste, para que les funcione idntico
tienen que instalar un tipo de letra digital si no la tienen los dgitos no lucirn iguales, lo encontraran en el mismo
sitio que este archivo. ( 11569_DIGITAL.ttf )

Enlace a la publicacin anterior:


Arduino Visual Basic 2010 Servo control con LCD display
Arduino Sketch
_______________________________________________________________________
// apcexpert.wordpress.com
// servo control con LCD display position
#include <Servo.h>
#include <LiquidCrystal.h>
Servo myservo;
int servoPosition = 1;
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
void setup() {
lcd.begin(16, 2);
lcd.print("Servo Position:");
myservo.attach(13);
Serial.begin(9600);
}
void loop() {
static int val = 0;
lcd.setCursor(0, 1);
if(Serial.available()) {
char ch = Serial.read();
switch(ch) {
case '0'...'9':
val = val * 10 + ch - '0';
break;

case 's':
myservo.write(val);
lcd.print((float)val);
val = 0;
break;
}
}
}
_____________________________________________________________

Aqu les dejo el cdigo fuente para que puedan comparar las diferencias:
Public Class ServoController
Private serialPort As New IO.Ports.SerialPort
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
With serialPort
.PortName = COM3
.BaudRate = 9600
.Parity = IO.Ports.Parity.None
.DataBits = 8
.StopBits = IO.Ports.StopBits.One
End With
serialPort.Open()
serialPort.Write(0s)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
TrackBar1.Scroll
serialPort.Write(TrackBar1.Value & 0s)
ProgressBar1.Value = (TrackBar1.Value * 10)
TextBox1.Text = TrackBar1.Value * 10 & ( )
End Sub
Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
TextBox1.TextChanged
End Sub
Private Sub ProgressBar1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
ProgressBar1.Click
End Sub
End Class
APC Expert Files
(ServoController2)

Reacciones:
a la/s domingo, julio 08, 2012 No hay comentarios.:
Etiquetas: Arduino y Visual Basic
Lectura de valores en el puerto analogo de arduino
Enviar esto por correo electrnicoBlogThis!Compartir en TwitterCompartir en FacebookCompartir en Pinterest
En este proyecto podremos visualizar como trabaja el puerto anlogo, es sencillo pero al comprenderlo podemos
aplicarlo a muchas ideas como, Voltmetro, control de temperaturas para unidades de acondicionadores de aire,
controladores de carga para bancos de bateras de sistemas solares o elicos (molinos de viento), en fin son
muchsimas las aplicaciones que podemos darle al Arduino utilizando los puertos anlogos.

Los componentes los podemos ver en la imagen. Publicare tres Sketch para poder comprender como funciona el
puerto anlogo.
El primer Sketch podremos ver como al variar la posicin del pot la lectura en el puerto anlogo (pin 0) se reflejara
en la velocidad con que el led prende y apaga. La variacin ser en milisegundos.
/*
Pot sketch
blink an LED at a rate set by the position of a potentiometer
*/
const int potPin = 0; // select the input pin for the potentiometer
const int ledPin = 13; // select the pin for the LED
int val = 0; // variable to store the value coming from the sensor
void setup()
{
pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT
}
void loop() {
val = analogRead(potPin); // read the voltage on the pot
digitalWrite(ledPin, HIGH); // turn the ledPin on
delay(val); // blink rate set by pot value (in milliseconds)
digitalWrite(ledPin, LOW); // turn the ledPin off
delay(val); // turn led off for same period as it was turned on
}
En el segundo Sketch podremos observar como Arduino interpreta la variacin de voltaje en el puerto anlogo (pin0)
y nos la mostrara en el Serial Monitor del programa Arduino como lo podrn ver en la imagen.
Podremos notar que cuando en el pin sea 0 Voltios el serial les mostrara 0 y cuando sea 5 Voltios entonces el serial les
mostrara 1023, Los valores sern entre 0 Hasta 1023.

/*
AnalogReadSerial
Reads an analog input on pin 0, prints the result to the serial monitor.
Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.
This example code is in the public domain.
*/
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// print out the value you read:
Serial.println(sensorValue);
delay(1); // delay in between reads for stability
}
En el siguiente Sketch combinare los dos Sketch anteriores haciendo unas modificaciones al segundo para
incorporarlo al primero, para que sirva de ejemplo.
/*
Pot sketch
blink an LED at a rate set by the position of a potentiometer
*/
const int potPin = 0; // select the input pin for the potentiometer
const int ledPin = 13; // select the pin for the LED
int val = 0; // variable to store the value coming from the sensor
void setup()
{
pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
void loop() {
val = analogRead(potPin); // read the voltage on the pot
digitalWrite(ledPin, HIGH); // turn the ledPin on
delay(val); // blink rate set by pot value (in milliseconds)

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


delay(val); // turn led off for same period as it was turned on
// read the input on analog pin 0:
int val = analogRead(potPin);
// print out the value you read:
Serial.println(val);
delay(1); // delay in between reads for stability
}
Esta parte es importante comprenderla porque ser la base para otros proyectos que mostrare, como obtener lecturas
remotas, pero ser mas adelante. Espero les sirva para practicar, luego mostrare como hacer el voltmetro y el control
de temperatura, para la prxima.
Reacciones:
a la/s domingo, julio 08, 2012 No hay comentarios.:
Vnculos a esta publicacin
Etiquetas: Arduino
Laboratorio Virtual con Arduino
Enviar esto por correo electrnicoBlogThis!Compartir en TwitterCompartir en FacebookCompartir en Pinterest

ArduLab es un entorno de trabajo que permite interactuar con una placa Arduino (Diecimila o Duemilanove) para
crear un labaratorio virtual. Mediante ArduLab podemos realizar una serie de actividades y experimentos orientados
principalmente al aprendizaje de conceptos sencillos relacionados con la tecnologa (principalmente electrnica y
robtica).
ArduLab no es un entorno de programacin, es un Laboratorio Virtual de Experimentacin que permite al usuario,
aprender, probar y conocer como paso previo a la programaci de sistemas, con sensores y actuadores, basados en
Arduino. Mas informacion en: http://complubot.educa.madrid.org/inicio.php?seccion=principal

1 Instalacin
Primeros pasos
ArduLab 004
ArduLab 004 para Windows XP SP3 y Windows 7 (rar), o en formato zip(29/05/2011).
Fichero fuente del Firmware versin 004 con soporte para el IDE Arduino 1.0(27/02/2012).
Reacciones:
a la/s domingo, julio 08, 2012 No hay comentarios.:
Etiquetas: ArduLab
Arduino Visual Basic 2010 Servo control con LCD display
Enviar esto por correo electrnicoBlogThis!Compartir en TwitterCompartir en FacebookCompartir en Pinterest

Arduino servo control. En este proyecto se utiliza un servo que estar controlado por una PC atabes de una aplicacin
creada en VB2010, Donde un Slider controlara la posicin del servo y ser desplegada en un LCD display.
Los servos vienen con dos cdigos de colores:
1) Amarillo = seal Rojo = Voltaje+ Marrn = Tierra
2) Blanco = seal Rojo = Voltaje+ Negro = Tierra
Conexin del servo, Seal = pin13
Conexiones del
LiquidCrystal lcd(8,9,4,5,6,7);
Arduino servo control Sketch
// apcexpert.wordpress.com
// servo control con LCD display position
#include <Servo.h>
#include <LiquidCrystal.h>
Servo myservo;
int servoPosition = 1;
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
void setup() {
lcd.begin(16, 2);
lcd.print("Servo Position:");
myservo.attach(13);
Serial.begin(9600);
}
void loop() {
static int val = 0;
lcd.setCursor(0, 1);
if(Serial.available()) {
char ch = Serial.read();
switch(ch) {
case '0'...'9':
val = val * 10 + ch - '0';
break;
case 's':
myservo.write(val);
lcd.print((float)val);
val = 0;
break;
}

}
}
Codigo fuente Visual Basic 2010 (ServoController1)

Public Class ServoController


Private serialPort As New IO.Ports.SerialPort
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
With serialPort
.PortName = COM3
.BaudRate = 9600
.Parity = IO.Ports.Parity.None
.DataBits = 8
.StopBits = IO.Ports.StopBits.One
End With
serialPort.Open()
serialPort.Write(0s)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
TrackBar1.Scroll
serialPort.Write(TrackBar1.Value & 0s)
End Sub
End Class
APC Expert Files
(ServoController1)

Reacciones:
a la/s domingo, julio 08, 2012 No hay comentarios.:
Etiquetas: Arduino LCD Keypad Shield
Controlando 4 relays con Arduino y Visual Basic 2010
Enviar esto por correo electrnicoBlogThis!Compartir en TwitterCompartir en FacebookCompartir en Pinterest
Para este proyecto se requiere un panel con 4 relays para poder controlar equipos de mayor potencia como motores
compresores o simplemente para iluminacin de una residencia u un almacn, Las aplicaciones son variadas.
Este control relay board lo pueden conseguirse en ebay.com, no tiene que ser igual al ilustrado, vienen de 2, 4, 8
relays y ms. Lo seleccionaran de acuerdo a su proyecto.
Abajo encontraras el sketch de Arduino y el cdigo fuente de VB2010, tambin dejare el lugar para bajar el archivo
(Arduino4ChRelayControl) VB2010.
Espero les funcione bien y recuerden seleccionar el puerto de comunicacin USB cuando corran la aplicacin en sus
PC yo utilizo el Com3, Suerte con el proyecto. Hasta la prxima.
Conecciones electricas:
Pin 13 canal 1

pin 12 canal 2
pin 11 canal 3
pin 10 canal 4

Arduino Sketch
// By: apcexpert.blogspot.com
int RL4 = 13; // the number of the Relay pin
int RL3 = 12;
int RL2 = 11;
int RL1 = 10;

void setup() {
Serial.begin(9600); // set serial speed
pinMode(RL4, OUTPUT); // set Relay as output
digitalWrite(RL4, LOW); //turn off Relay
pinMode(RL3, OUTPUT);
digitalWrite(RL3, LOW);
pinMode(RL2, OUTPUT);
digitalWrite(RL2, LOW);
pinMode(RL1, OUTPUT);
digitalWrite(RL1, LOW);

}
void loop(){
while (Serial.available() == 0); // do nothing if nothing sent
int val = Serial.read() - '0'; // deduct ascii value of '0' to find numeric value of sent number
if (val == 4) { // test for command 1 then turn on Relay
Serial.println("Relay 4 on");
digitalWrite(RL4, HIGH); // turn on Relay
}
if (val == 3) {
Serial.println("Relay 3 on");
digitalWrite(RL3, HIGH);
}
if (val == 2) {
Serial.println("Relay 2 on");
digitalWrite(RL2, HIGH);
}
if (val == 1) {
Serial.println("Relay 1 on");
digitalWrite(RL1, HIGH);
}
else if (val == 8) // test for command 0 then turn off LED
{
Serial.println("Relay 4 OFF");
digitalWrite(RL4, LOW); // turn off LED
}
else if (val == 7)
{
Serial.println("Relay 3 OFF");
digitalWrite(RL3, LOW);
}
else if (val == 6)
{
Serial.println("Relay 2 OFF");
digitalWrite(RL2, LOW);
}
else if (val == 5)
{
Serial.println("Relay 1 OFF");

digitalWrite(RL1, LOW);
}

else // if not one of above command, do nothing


{
//val = val;
}
Serial.println(val);
Serial.flush(); // clear serial port
}
(Arduino4ChRelayControl) Visual Basic 2010

Imports System.IO
Imports System.IO.Ports
Imports System.Threading
Public Class Form1
Shared _continue As Boolean
Shared _serialPort As SerialPort
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
SerialPort1.PortName = (com3) change com port to match your Arduino portSerialPort1.Close()
SerialPort1.BaudRate = 9600
SerialPort1.DataBits = 8
SerialPort1.Parity = Parity.None
SerialPort1.StopBits = StopBits.One
SerialPort1.Handshake = Handshake.None
SerialPort1.Encoding = System.Text.Encoding.Default very important!
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
SerialPort1.Open()
SerialPort1.Write(1)
SerialPort1.Close()
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click


SerialPort1.Open()
SerialPort1.Write(2)
SerialPort1.Close()
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
SerialPort1.Open()
SerialPort1.Write(3)
SerialPort1.Close()
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
SerialPort1.Open()
SerialPort1.Write(4)
SerialPort1.Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
SerialPort1.Open()
SerialPort1.Write(5)
SerialPort1.Close()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
SerialPort1.Open()
SerialPort1.Write(6)
SerialPort1.Close()
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
SerialPort1.Open()
SerialPort1.Write(7)
SerialPort1.Close()
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
SerialPort1.Open()
SerialPort1.Write(8)
SerialPort1.Close()
End Sub
End Class
APC Expert Files
(Arduino4ChRelayControl)

Reacciones:
a la/s domingo, julio 08, 2012 2 comentarios:
Etiquetas: Arduino y Visual Basic
Nueva version para arduinoArduino1.0.1
Enviar esto por correo electrnicoBlogThis!Compartir en TwitterCompartir en FacebookCompartir en Pinterest
Lo podrn conseguir en la pagina oficial en ingles Download the Arduino Software ya que en la pagina en espaol
no est actualizada o lo pueden bajar directamente aqu.
Download
Arduino 1.0.1 (release notes), hosted by Google Code:
Windows
Mac OS X
Linux: 32 bit, 64 bit

Pueden elegir esta versin que ya esta actualizada para utilizar el sensor Ultrasnico HC-SR04 y el Motor Control
Shield, si lo desean pinchen el icono del SKY DRIVE.
Esta versin la estar actualizando cada vez que incluya nuevos componentes de programacin, como Bluetooth,
GPS, entre otras cosas.
Arduino1.0.1ACP Updated

Reacciones:
a la/s domingo, julio 08, 2012 No hay comentarios.:
Vnculos a esta publicacin
Etiquetas: Instalar Arduino
Como instalar Arduino a unaPC con Windows7
Enviar esto por correo electrnicoBlogThis!Compartir en TwitterCompartir en FacebookCompartir en Pinterest
Para poder programar nuestro Arduino tenemos que configurar nuestra computadora y en este caso ser con Windows
7. Le mostrare los pasos y tambin el enlace a la pagina oficial de Arduino, en la seccin de instalacin.
Primero deben tener instalado el programa de Arduino, la versin mas actualizada en este momento es la del sitio en
ingles (http://arduino.cc/en/Main/Software) y la explicacin la encontraran en el sitio en espaol
(http://arduino.cc/es/Guide/Windows).
Comenzare con la instalacin:

Deben tener a mano su Arduino UNO y su cable USB, lo conectaran al puerto de su computadora, la maquina
reconocer el panel Arduino , podrn verificar en el Device Managerde sus computadoras, cuando lo localicen, debe
verse similar a la siguiente imagen.

Como podrn notar el icono del Arduino tiene una indicacin de color amarillo, esto representa algn problema o
error al instalar. Picaremos sobre Arduino Uno con el ratn y presionamos el botn derecho, nos mostrara una
ventana y en ella seleccionaremos Update Driver Softwarecomo se puede observar en la imagen a continuacin.

Luego Veremos la siguiente ventana:

Seleccione Browse my computer y pasara a la prxima ventana, en esta seccin deben localizar el archivo conde
instalaron el programa de Arduino, en este ejemplo lo instale en el desktop de mi maquina, buscaremos el folder
Drivers y presionan el botn OK

La siguiente ventana que vern les indicara una advertencia, seleccionen Istall this driver software anyway

Esperaremos que termine la instalacin. Cuando finalice abra reasignado el puerto, Veamos en la prxima imagen.

Luego sabiendo que le asigno el Puerto de comunicacin Com8, Pasaremos a abrir al programa de Arduino,
localizar el Modelo de nuestro micro controlador y liego el puerto de comunicacin. Como veremos en las siguientes
imgenes:

Ya para este momento estaremos listos para programar nuestro Arduino UNO. Espero que no tengan problemas.
Hasta la prxima.
Reacciones:
a la/s domingo, julio 08, 2012 5 comentarios:
Vnculos a esta publicacin
Etiquetas: Instalar Arduino
Medidor de distancias con LCD 162 y Sensor ultrasonico HC-SR04.
Enviar esto por correo electrnicoBlogThis!Compartir en TwitterCompartir en FacebookCompartir en Pinterest
Este circuito ya se complica ms, utilizare un Shield LCD +Keypad y el sensor snico HC-SR04.Es el que
estaremos utilizando frecuentemente en las pruebas. En esta ocasin veremos las lecturas, sin utilizar el puerto USB
de nuestra PC. Al utilizar este shield, nos ahorramos complicaciones, y resulta un proyecto con mayor esttica, luce
mas profesional.
Ver imagen:

Las conecciones son importantes:


VCC = 5Voltios
Trig= Conectar al pin #12
Echo= Conectar al pin #13
Gnd = Tierra
Aqu les dejo el sketch para instalarlo en el arduino, est en cm centmetros pero es sencillo cambiarlo a pulgadas.
// Ultrasonic.h Library for HR-SC04 Ultrasonic Ranging Module.
// Rev. 2 (06/2011)
// www.arduino.com.es
#include <Ultrasonic.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(8,9,4,5,6,7);
Ultrasonic ultrasonic(12,13); // (Trig PIN,Echo PIN)
void setup() {
lcd.begin(16, 2);
}
void loop()
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(ultrasonic.Ranging(CM)); // CM para metrico y INC para pulgadas
lcd.print( CM);
delay(500);
}
Espero que no tengan problemas, solo funciona si el programa de arduino esta actualizado para el sensor snico.
Cualquier complicacin, me dejan un comentario y tratare de ayudarles.
Reacciones:
a la/s domingo, julio 08, 2012 2 comentarios:
Vnculos a esta publicacin
Etiquetas: Sensor ultrasonico HC-SR04
Medidor de distancias con ultrasonidos HC-SR04.
Enviar esto por correo electrnicoBlogThis!Compartir en TwitterCompartir en FacebookCompartir en Pinterest

Hola, este circuito de pruebas, es para familiarizarse con el sensor ultrasinico, lo utilizare para tomar distancias, estas
se reflejaran en cm . Basicamente mide distancias calculando el tiempo en que emite el pulso sonico y lo recibe,
demodo que lo pocras ver en tu PC cuandi activas el monitor serial.
Les mostrare como activar este monitor, es sensillo.
Ver imagen:

Ver imagen de como se comunica con el monitor serial.

Las conecciones son importantes:


VCC = 5Voltios
Trig= Conectar al pin #12
Echo= Conectar al pin #13
Gnd = Tierra
Este es el Sketch que instalaran en su arduino, solo les fincionara si su programa de arduino esta actualizado para el
sensor ultrasonico HC-SR04.
// Ultrasonic.h Library for HR-SC04 Ultrasonic Ranging Module.
// Rev. 2 (06/2011)
// www.arduino.com.es
#include <Ultrasonic.h>
Ultrasonic ultrasonic(12,13); // (Trig PIN,Echo PIN)
void setup() {
Serial.begin(9600);
}
void loop()
{
Serial.print(ultrasonic.Ranging(CM)); // CM or INC
Serial.println( cm );
delay(100);
}

Вам также может понравиться