sexta-feira, 11 de outubro de 2013

3° Passo (2° Parte)

É pessoal agora vamos a parte pratica.

Como já foi dito na primeira parte sobre os componentes, nosso circuito atualmente disponibiliza de:
  • TRIAC BT137
  • Optoacoplador MOC 3012 (sem detector de passagem por zero da senoide)
  • Optoacoplador PC817 (corrente continua)
  • Retificador de ponte
  • Resistores: 20kohm e 470ohm.
Lembrando que o circuito foi criado a partir dos componentes que nos tínhamos em mãos por esse motivo que estamos usando um MOC3012 em vez de usar um que tenha detector de zero que iria deixar tudo muito mais simples de se fazer.
Software V 1.3; Hardware V 1.0 

Toda a descrição do funcionamento do software esta explicado com comentários a frente de cada função, lembrando que pela falta de um optoacoplador com detector de zero vamos utilizar de um outro optoacoplador para fazer isso com auxilio de programação para disparar o TRIAC no momento certo.


Software

//*******************************************************************************
//
//    Software V1.3    Hardware V1.0
//
//*******************************************************************************
#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 7, 6, 5, 4);

const int SensorLDR = A0; // Entrada do sensor LDR em porta analogica      
const int LedLCD = 9; // Pino de saida Led do LCD com saida PWM

int SensorValorLDR = 0; // Variavel que armazena o valor do LDR
int SaidaValorLDR = 0; //Variavel  que armazena o valor para colocar na saida  
int SaidaLedLCD = 0; //Variavel  que armazena o valor para colocar na saida 
int AC_LOAD = 3;    // Pino de saida para o Optoacoplador >> TRIAC
int dimming = 128;  // Nivel do dimmer (0-128)  0 = Ligado, 128 = Desligado

//== Abaixo é para fazer o efeito de grafico no LCD============================
byte a[8] = { 0b10000, 
0b10000,  
0b10000,
0b10000,
0b10000,
0b10000,
0b10000,
0b10000
};

byte b[8] = { 0b11000, 
0b11000,  
0b11000,
0b11000,
0b11000,
0b11000,
0b11000,
0b11000
};

byte c[8] = { 0b11100, 
0b11100,  
0b11100,
0b11100,
0b11100,
0b11100,
0b11100,
0b11100
};

byte d[8] = { 0b11110, 
0b11110,  
0b11110,
0b11110,
0b11110,
0b11110,
0b11110,
0b11110
};

byte e[8] = { 0b11111, 
0b11111,  
0b11111,
0b11111,
0b11111,
0b11111,
0b11111,
0b11111
};
//============================================================================

void oi(){
  lcd.setCursor(0, 0); //seta o lcd na linha zero coluna zero
  lcd.print("LDR "); // e escreve 
  SensorValorLDR = analogRead(SensorLDR);// Lê o valor do LDR e salva em SensorValorLDR   
  SaidaValorLDR = map(SensorValorLDR, 0, 1023, 0, 100); //Pega o valor de SensorValorLDR cria um map de 0 a 100 e salva na SaidaValorLDR 
  lcd.print(SaidaValorLDR); //escreve SaidaValorLDR no LCD  
  lcd.print(char(37)); // escreve o caracter % no LCD
  SaidaValorLDR = SensorValorLDR; // Pega o valor do SensorValorLDR novamente e salva em SaidaValorLDR
  SaidaLedLCD = map(SaidaValorLDR , 0, 1023, 0, 110); //min=0 max=128 // Cria um map de 0 a 110 << para melhor ajustar a lampada  
  dimming = SaidaLedLCD; //Pega o valor do map SaidaLedLCD e salva em dimming
  analogWrite(LedLCD, SaidaLedLCD); // Escreve o valor de SaidaLedLCD no LedLCD
  delay(50); // delay para não carregar o processamento
  lcd.clear();// apaga o LCD

void zero_crosss_int() 
{
  // Calculo do angulo da senoide :: 60Hz-> 8.33ms (1/2 Ciclo)
  // (8333us - 8.33us) / 128 = 65 (aproximado)
  int dimtime = (65*dimming);      
  delayMicroseconds(dimtime);    // Off cycle
  digitalWrite(AC_LOAD, HIGH);   // Disparo TRIAC
  delayMicroseconds(8.33);       // Triac ligado em 8.33us, atraves da nossa base de calculo
  digitalWrite(AC_LOAD, LOW);    // Corte do TRIAC
}

void setup() {
  lcd.begin(16, 2); // Inicia o LCD 16x2
  pinMode(LedLCD, OUTPUT); // Declara o LedLCD como saida
  lcd.createChar(1, a); // Declara o char 1
  lcd.createChar(2, b); // Declara o char 2
  lcd.createChar(3, c); // Declara o char 3
  lcd.createChar(4, d); // Declara o char 4
  lcd.createChar(5, e); // Declara o char 5
  pinMode(AC_LOAD, OUTPUT); // Declara o AC_LOAD como saida
  attachInterrupt(0, zero_crosss_int, RISING);  // Ativa a interrupção zero e chama a função zero_crosss_int 
}

//=== Toda essa parte abaixo é para fazer o grafico e chamar a função loop=========================================
void loop() { 
  int programas = map(SaidaValorLDR , 0, 1023, 1, 80);
  switch (programas){     
    case 1:lcd.setCursor(0, 1);lcd.write(1); oi();break;
    case 2:lcd.setCursor(0, 1);lcd.write(2); oi();break;
    case 3:lcd.setCursor(0, 1);lcd.write(3); oi();break;
    case 4:lcd.setCursor(0, 1);lcd.write(4); oi();break;
    case 5:lcd.setCursor(0, 1);lcd.write(5); oi();break;
    case 6:lcd.setCursor(1, 1);lcd.write(1);lcd.setCursor(0, 1);lcd.write(5); oi();break;
    case 7:lcd.setCursor(1, 1);lcd.write(2);lcd.setCursor(0, 1);lcd.write(5); oi();break;
    case 8:lcd.setCursor(1, 1);lcd.write(3);lcd.setCursor(0, 1);lcd.write(5); oi();break;
    case 9:lcd.setCursor(1, 1);lcd.write(4);lcd.setCursor(0, 1);lcd.write(5); oi();break;
    case 10:lcd.setCursor(1, 1);lcd.write(5);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5); oi();break;
    case 11:lcd.setCursor(2, 1);lcd.write(1);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5); oi();break;
    case 12:lcd.setCursor(2, 1);lcd.write(2);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5); oi();break;
    case 13:lcd.setCursor(2, 1);lcd.write(3);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5); oi();break;
    case 14:lcd.setCursor(2, 1);lcd.write(4);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5); oi();break;
    case 15:lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5); oi();break;
    case 16:lcd.setCursor(3, 1);lcd.write(1);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5); oi();break;
    case 17:lcd.setCursor(3, 1);lcd.write(2);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5); oi();break;
    case 18:lcd.setCursor(3, 1);lcd.write(3);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5); oi();break;
    case 19:lcd.setCursor(3, 1);lcd.write(4);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5); oi();break;
    case 20:lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5); oi();break;
    case 21:lcd.setCursor(4, 1);lcd.write(1);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5); oi();break;
    case 22:lcd.setCursor(4, 1);lcd.write(2);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5); oi();break;
    case 23:lcd.setCursor(4, 1);lcd.write(3);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5); oi();break;
    case 24:lcd.setCursor(4, 1);lcd.write(4);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5); oi();break;
    case 25:lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5); oi();break;
    case 26:lcd.setCursor(5, 1);lcd.write(1);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5); oi();break;
    case 27:lcd.setCursor(5, 1);lcd.write(2);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5); oi();break;
    case 28:lcd.setCursor(5, 1);lcd.write(3);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5); oi();break;
    case 29:lcd.setCursor(5, 1);lcd.write(4);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5); oi();break;
    case 30:lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5); oi();break;
    case 31:lcd.setCursor(6, 1);lcd.write(1);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5); oi();break;
    case 32:lcd.setCursor(6, 1);lcd.write(2);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5); oi();break;
    case 33:lcd.setCursor(6, 1);lcd.write(3);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5); oi();break;
    case 34:lcd.setCursor(6, 1);lcd.write(4);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5); oi();break;
    case 35:lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5); oi();break;
    case 36:lcd.setCursor(7, 1);lcd.write(1);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5); oi();break;
    case 37:lcd.setCursor(7, 1);lcd.write(2);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5); oi();break;
    case 38:lcd.setCursor(7, 1);lcd.write(3);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5); oi();break;
    case 39:lcd.setCursor(7, 1);lcd.write(4);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5); oi();break;
    case 40:lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5); oi();break;
    case 41:lcd.setCursor(8, 1);lcd.write(1);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5); oi();break;
    case 42:lcd.setCursor(8, 1);lcd.write(2);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5); oi();break;
    case 43:lcd.setCursor(8, 1);lcd.write(3);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5); oi();break;
    case 44:lcd.setCursor(8, 1);lcd.write(4);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5); oi();break;
    case 45:lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5); oi();break;
    case 46:lcd.setCursor(9, 1);lcd.write(1);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5); oi();break;
    case 47:lcd.setCursor(9, 1);lcd.write(2);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5); oi();break;
    case 48:lcd.setCursor(9, 1);lcd.write(3);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5); oi();break;
    case 49:lcd.setCursor(9, 1);lcd.write(4);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5); oi();break;
    case 50:lcd.setCursor(9, 1);lcd.write(5);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5); oi();break;
    case 51:lcd.setCursor(10, 1);lcd.write(1);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(9, 1);lcd.write(5); oi();break;
    case 52:lcd.setCursor(10, 1);lcd.write(2);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(9, 1);lcd.write(5); oi();break;
    case 53:lcd.setCursor(10, 1);lcd.write(3);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(9, 1);lcd.write(5); oi();break;
    case 54:lcd.setCursor(10, 1);lcd.write(4);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(9, 1);lcd.write(5); oi();break;
    case 55:lcd.setCursor(10, 1);lcd.write(5);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(9, 1);lcd.write(5); oi();break;
    case 56:lcd.setCursor(11, 1);lcd.write(1);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(9, 1);lcd.write(5);lcd.setCursor(10, 1);lcd.write(5); oi();break;
    case 57:lcd.setCursor(11, 1);lcd.write(2);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(9, 1);lcd.write(5);lcd.setCursor(10, 1);lcd.write(5); oi();break;
    case 58:lcd.setCursor(11, 1);lcd.write(3);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(9, 1);lcd.write(5);lcd.setCursor(10, 1);lcd.write(5); oi();break;
    case 59:lcd.setCursor(11, 1);lcd.write(4);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(9, 1);lcd.write(5);lcd.setCursor(10, 1);lcd.write(5); oi();break;
    case 60:lcd.setCursor(11, 1);lcd.write(5);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(9, 1);lcd.write(5);lcd.setCursor(10, 1);lcd.write(5); oi();break;
    case 61:lcd.setCursor(12, 1);lcd.write(1);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(9, 1);lcd.write(5);lcd.setCursor(10, 1);lcd.write(5);lcd.setCursor(11, 1);lcd.write(5); oi();break;
    case 62:lcd.setCursor(12, 1);lcd.write(2);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(9, 1);lcd.write(5);lcd.setCursor(10, 1);lcd.write(5);lcd.setCursor(11, 1);lcd.write(5); oi();break;
    case 63:lcd.setCursor(12, 1);lcd.write(3);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(9, 1);lcd.write(5);lcd.setCursor(10, 1);lcd.write(5);lcd.setCursor(11, 1);lcd.write(5); oi();break;
    case 64:lcd.setCursor(12, 1);lcd.write(4);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(9, 1);lcd.write(5);lcd.setCursor(10, 1);lcd.write(5);lcd.setCursor(11, 1);lcd.write(5); oi();break;
    case 65:lcd.setCursor(12, 1);lcd.write(5);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(9, 1);lcd.write(5);lcd.setCursor(10, 1);lcd.write(5);lcd.setCursor(11, 1);lcd.write(5); oi();break;
    case 66:lcd.setCursor(13, 1);lcd.write(1);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(9, 1);lcd.write(5);lcd.setCursor(10, 1);lcd.write(5);lcd.setCursor(11, 1);lcd.write(5);lcd.setCursor(12, 1);lcd.write(5); oi();break;
    case 67:lcd.setCursor(13, 1);lcd.write(2);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(9, 1);lcd.write(5);lcd.setCursor(10, 1);lcd.write(5);lcd.setCursor(11, 1);lcd.write(5);lcd.setCursor(12, 1);lcd.write(5); oi();break;
    case 68:lcd.setCursor(13, 1);lcd.write(3);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(9, 1);lcd.write(5);lcd.setCursor(10, 1);lcd.write(5);lcd.setCursor(11, 1);lcd.write(5);lcd.setCursor(12, 1);lcd.write(5); oi();break;
    case 69:lcd.setCursor(13, 1);lcd.write(4);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(9, 1);lcd.write(5);lcd.setCursor(10, 1);lcd.write(5);lcd.setCursor(11, 1);lcd.write(5);lcd.setCursor(12, 1);lcd.write(5); oi();break;
    case 70:lcd.setCursor(13, 1);lcd.write(5);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(9, 1);lcd.write(5);lcd.setCursor(10, 1);lcd.write(5);lcd.setCursor(11, 1);lcd.write(5);lcd.setCursor(12, 1);lcd.write(5); oi();break;
    case 71:lcd.setCursor(14, 1);lcd.write(1);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(9, 1);lcd.write(5);lcd.setCursor(10, 1);lcd.write(5);lcd.setCursor(11, 1);lcd.write(5);lcd.setCursor(12, 1);lcd.write(5);lcd.setCursor(13, 1);lcd.write(5); oi();break;
    case 72:lcd.setCursor(14, 1);lcd.write(2);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(9, 1);lcd.write(5);lcd.setCursor(10, 1);lcd.write(5);lcd.setCursor(11, 1);lcd.write(5);lcd.setCursor(12, 1);lcd.write(5);lcd.setCursor(13, 1);lcd.write(5); oi();break;
    case 73:lcd.setCursor(14, 1);lcd.write(3);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(9, 1);lcd.write(5);lcd.setCursor(10, 1);lcd.write(5);lcd.setCursor(11, 1);lcd.write(5);lcd.setCursor(12, 1);lcd.write(5);lcd.setCursor(13, 1);lcd.write(5); oi();break;
    case 74:lcd.setCursor(14, 1);lcd.write(4);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(9, 1);lcd.write(5);lcd.setCursor(10, 1);lcd.write(5);lcd.setCursor(11, 1);lcd.write(5);lcd.setCursor(12, 1);lcd.write(5);lcd.setCursor(13, 1);lcd.write(5); oi();break;
    case 75:lcd.setCursor(14, 1);lcd.write(5);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(9, 1);lcd.write(5);lcd.setCursor(10, 1);lcd.write(5);lcd.setCursor(11, 1);lcd.write(5);lcd.setCursor(12, 1);lcd.write(5);lcd.setCursor(13, 1);lcd.write(5); oi();break;
    case 76:lcd.setCursor(15, 1);lcd.write(1);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(9, 1);lcd.write(5);lcd.setCursor(10, 1);lcd.write(5);lcd.setCursor(11, 1);lcd.write(5);lcd.setCursor(12, 1);lcd.write(5);lcd.setCursor(13, 1);lcd.write(5);lcd.setCursor(14, 1);lcd.write(5); oi();break;
    case 77:lcd.setCursor(15, 1);lcd.write(2);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(9, 1);lcd.write(5);lcd.setCursor(10, 1);lcd.write(5);lcd.setCursor(11, 1);lcd.write(5);lcd.setCursor(12, 1);lcd.write(5);lcd.setCursor(13, 1);lcd.write(5);lcd.setCursor(14, 1);lcd.write(5); oi();break;
    case 78:lcd.setCursor(15, 1);lcd.write(3);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(9, 1);lcd.write(5);lcd.setCursor(10, 1);lcd.write(5);lcd.setCursor(11, 1);lcd.write(5);lcd.setCursor(12, 1);lcd.write(5);lcd.setCursor(13, 1);lcd.write(5);lcd.setCursor(14, 1);lcd.write(5); oi();break;
    case 79:lcd.setCursor(15, 1);lcd.write(4);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(9, 1);lcd.write(5);lcd.setCursor(10, 1);lcd.write(5);lcd.setCursor(11, 1);lcd.write(5);lcd.setCursor(12, 1);lcd.write(5);lcd.setCursor(13, 1);lcd.write(5);lcd.setCursor(14, 1);lcd.write(5); oi();break;
    case 80:lcd.setCursor(15, 1);lcd.write(5);lcd.setCursor(0, 1);lcd.write(5);lcd.setCursor(1, 1);lcd.write(5);lcd.write(5);lcd.setCursor(2, 1);lcd.write(5);lcd.setCursor(3, 1);lcd.write(5);lcd.setCursor(4, 1);lcd.write(5);lcd.setCursor(5, 1);lcd.write(5);lcd.setCursor(6, 1);lcd.write(5);lcd.setCursor(7, 1);lcd.write(5);lcd.setCursor(8, 1);lcd.write(5);lcd.setCursor(9, 1);lcd.write(5);lcd.setCursor(10, 1);lcd.write(5);lcd.setCursor(11, 1);lcd.write(5);lcd.setCursor(12, 1);lcd.write(5);lcd.setCursor(13, 1);lcd.write(5);lcd.setCursor(14, 1);lcd.write(5); oi();break;
    break;}    
}

Hardware

Esquemático criado no software fritzing. veja postagem anterior.



Fotos









Vídeo 



quinta-feira, 10 de outubro de 2013

3° Passo (1°Parte)

Nesse nosso novo passo iremos fazer o controle de uma lampada incandescente através do arduino, para isso sera executado alguns passos, e vamos explicar tudo, vamos então....

Para controlar a intensidade da nossa lampada vamos mudar um pouco o processo, como a lampada incandescente trabalha com corrente alternada e como é de conhecimento o modo mais fácil e sensato é controlar o disparo da senoide, controlando assim a intensidade da lampada, esse circuito chamado de Dimmer controla a luz a partir do disparo que é feito por um TRIAC que é controlado por um DIAC que é controlado pelo potenciômetro, porem para fazer esse controle com o arduino iremos mudar alguma coisas, mais vamos começar do básico ate o fim para ficar tudo bem explicado.

- Vamos entender um pouco do optoacoplador que será a base do nosso circuito de potencia, pois nele iremos controlar o TRIAC e analisar o ponto zero da senoide.

Optoacoplador

O optoacoplator tem como sua principal finalidade isolar um sistema de outro, pois dentro dele não temos contato elétrico apenas contato óptico. 

O principio de funcionamento é um Led infravermelho que polarizado corretamente ira iluminar a base de um  fototransistor que ira conduzir. Mais observem que esse modelo de optoacoplador é apenas para corrente continua, mais temos um outro modelo que invés de um fototransistor tem um fototriac que por sua vez é capaz de conduzir corrente alternada.




Porém o Optoacoplador a base de Triac encontramos dois modelos um sem passagem de zero ou seja o componente físico não é equipado com um dispositivo que detecta a passagem da senoide por zero, mais temos um que ja vem equipado com esse dispositivo interno, observem:


Com esse tipo de Optoacoplador garantimos uma melhor exatidão nos circuitos pois ele garante que so sera acionado a parte da potencia quando a senoide passar por zero, assim teremos melhor controle em ponto certo.


TRIAC

Com o TRIAC conseguimos controlar o disparo de uma senoide a partir de um disparo no gate, assim controlando o percentual de atuação da senoide cortando ela no tempo certo.





Como vocês podem observar com o controle do disparo do TRIAC a partir do pulso no Gate. na senoide 1° podemos observar que o disparo é bem curto pois só um pequeno filete da senoide é ativo, assim na 2° maior sera o tempo da senoide ativa e na 3° maior ainda.


Isso ai pessoal essa é a primeira parte aguarde a segunda parte com o projeto em funcionamento.

quarta-feira, 9 de outubro de 2013

Ferramenta de ouro!!!

Pessoal nessa postagem vou apresentar a ferramenta fritzing. Essa ferramenta é muito interessante pois podemos criar desenho do nosso projeto e automaticamente criar a placa de circuito impresso e o esquemático.  Observe esse vídeo de apresentação do software:



Esse software pode ser baixado no próprio site: http://fritzing.org/
clicando em Download our latest version (0.8.3b was released July 27th) and start right away.


Apos isso selecione a versão ideal para seu micro



Depois de baixado e instalado, só executar.



É isso ai mais uma ferramenta para ajudar!!