domingo, 27 de julio de 2014

Forja, Carro L1500







Programador de riego Arduino SD backup V0.7


/*
Programador de riego V.07 http://jmloureiro77.blogspot.com
  - 3 sectores con desconexion manual y arranque de bomba
  - 4 arranques diarios por sector, un minuto de tiempo mínimo de riego
  - Programable mediante arcivos de texto en SD

Componentes:
  - Arduino UNO
  - RTCDS1307
  - Modulo SD & SD card
  - 4 Relés
  - Transformador con salida USB (alimenta Arduino)
  - Trasnformador 24V AC para activar electroválvulas estandar
  - Divisor resistivo pullDown e interruptor manual 1k ohm

Instrucciones:
  S1.txt, S2.txt, S3.txt en raiz SD segun el siguiente formato:
S  // Primera linea - "S" o "N"- S(para sector exterior afectado por la desconexion manual), N (Sector de invernadero, patio interior, etc noafectado por desconexion manual)
1  //segunda linea  - tiempo de riego en minutos, para > 1 hora, pex 61-120
09:00 // Hora delprimer arranque diario
10:00 // si no se una el segundo,... dejar en blanco. no usar 00:00 pues arrancaria a las 12 PM
18:00
19:00

insertar tarjeta y resetear arduino


(CC BY 3.0 ES)
  Usted es libre de:
    Compartir — copiar y redistribuir el material en cualquier medio o formato
    Adaptar — remezclar, transformar y crear a partir del material
    para cualquier finalidad, incluso comercial.
    El licenciador no puede revocar estas libertades mientras cumpla con los términos de la licencia.
 
  Bajo las condiciones siguientes:
    Reconocimiento — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.

Gracias a:
  http://www.extremadura-web.es/Blog/2013/01/16/leer-linea-fichero-sd-en-arduino/


 * SD card attached to SPI bus as follows:
 ** MOSI - pin 11
 ** MISO - pin 12
 ** CLK - pin 13
 ** CS - pin 4

 */

#include xSPI.hx
#include xWire.hx
#include xSD.hx
#include "RTClib.h"
RTC_DS1307 RTC;

// Pines
int PinDescoM = A1; // entrada del divisor resistivo en pullDown del interruptor de desconexion manual para sectores afectados por lluvia
                    //devolvera un valor > 700 si el interruptor manual de lluvia está activado
int DescoM = 0; //0=todos sectores activados 1= desactiva sectores exteriores

int PinPump = 5; //pin para rele que activa bomba conectado Normalmente Abierto
int PinS1 = 6;   //pin para sector de riego 1
int PinS2 = 7;
int PinS3 = 8;

File myFile;

//Variables Sector 1
String ext1;
String t1; //recupera de fichero
int t1d;  //covierte a decimal
  //Variables sector UNO para Hora de arranque UNO *ver en void setup
String h11; //ex recupera 13:22
String h11h; // selecciona 13
int h11hd;  //pasa a decimal
String h11m; //selecciona 22
int h11md;  //pasa a decimal
int h11d;  //13*60+22

String h12;
String h12h;
int h12hd;
String h12m;
int h12md;
int h12d;

String h13;
String h13h;
int h13hd;
String h13m;
int h13md;
int h13d;

String h14;
String h14h;
int h14hd;
String h14m;
int h14md;
int h14d;

//Variables Sector 2
String ext2;
String t2; //recupera de fichero
int t2d;  //covierte a decimal
  //Variables sector UNO para Hora de arranque UNO *ver en void setup
String h21; //ex recupera 13:22
String h21h; // selecciona 13
int h21hd;  //pasa a decimal
String h21m; //selecciona 22
int h21md;  //pasa a decimal
int h21d;  //13*60+22

String h22;
String h22h;
int h22hd;
String h22m;
int h22md;
int h22d;

String h23;
String h23h;
int h23hd;
String h23m;
int h23md;
int h23d;

String h24;
String h24h;
int h24hd;
String h24m;
int h24md;
int h24d;

//Variables Sector 3
String ext3;
String t3; //recupera de fichero
int t3d;  //covierte a decimal
  //Variables sector UNO para Hora de arranque UNO *ver en void setup
String h31; //ex recupera 13:22
String h31h; // selecciona 13
int h31hd;  //pasa a decimal
String h31m; //selecciona 22
int h31md;  //pasa a decimal
int h31d;  //13*60+22

String h32;
String h32h;
int h32hd;
String h32m;
int h32md;
int h32d;

String h33;
String h33h;
int h33hd;
String h33m;
int h33md;
int h33d;

String h34;
String h34h;
int h34hd;
String h34m;
int h34md;
int h34d;

int HoraAc = 0; //variable para almacenar hora actual


void setup()
{
 // Open serial communications and wait for port to open:
  Serial.begin(9600); //activada durante pruebas
  Wire.begin();
  RTC.begin();
  //cuando quitamos el comentario(//) de la linea siguiente, se ajusta la hora y la fecha con la del ordenador
  //RTC.adjust(DateTime(__DATE__, __TIME__));
   pinMode(10, OUTPUT);
   pinMode(PinPump, OUTPUT);
   digitalWrite(PinPump,HIGH); //para que rele empiece apagado
   pinMode(PinS1, OUTPUT);
   digitalWrite(PinS1,HIGH); //para que rele empiece apagado

   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }


  Serial.print("Initializing SD card...");
  // On the Ethernet Shield, CS is pin 4. It's set as an output by default.
  // Note that even if it's not used as the CS pin, the hardware SS pin
  // (10 on most Arduino boards, 53 on the Mega) must be left as an output
  // or the SD library functions will not work.
 
 
  if (!SD.begin(4)) {
    Serial.println("initialization failed!");
    return;
  }
  Serial.println("initialization done.");

  // open the file. note that only one file can be open at a time,
  // so you have to close this one before opening another.
  myFile = SD.open("S1.txt", FILE_WRITE);

  // if the file opened okay, write to it:
  if (myFile) {
    //Serial.print("Writing to test.txt...");
    //myFile.println("testing 1, 2, 3.");
    // close the file:
    //myFile.close();
    Serial.println("done.");
  } else {
    // if the file didn't open, print an error:
    Serial.println("error opening test.txt");
  }

  // re-open the file for reading:
  myFile = SD.open("S1.txt");
  if (myFile) {
    Serial.println("S1.txt:");
 
    // read from the file until there's nothing else in it:
    while (myFile.available()) {
        Serial.write(myFile.read());
    }
    // close the file:
    myFile.close();
  } else {
    // if the file didn't open, print an error:
    Serial.println("error opening test.txt");
  }


//Serial.println();
char Ruta[7] = {'S', '1', '.', 't', 'x', 't', '\0'};

//Leemos linea de archivo en la SD
String Lin = ReadFile(0,Ruta);
ext1 = Lin;
Lin = ReadFile(1,Ruta);
t1 = Lin; //tiempo de riego sector 1
t1d = t1.toInt();
Lin = ReadFile(2,Ruta);
h11 = Lin; //hora arranque 1
h11h= h11.substring(0,2); //el primero no cuenta
h11hd = h11h.toInt();
h11m= h11.substring(3,5);
h11md = h11m.toInt();

Lin = ReadFile(3,Ruta);
h12 = Lin;
h12h= h12.substring(0,2);
h12hd = h12h.toInt();
h12m= h12.substring(3,5);
h12md = h12m.toInt();

Lin = ReadFile(4,Ruta);
h13 = Lin;
h13h= h13.substring(0,2);
h13hd = h13h.toInt();
h13m= h13.substring(3,5);
h13md = h13m.toInt();

Lin = ReadFile(5,Ruta);
h14 = Lin;
h14h= h14.substring(0,2);
h14hd = h14h.toInt();
h14m= h14.substring(3,5);
h14md = h14m.toInt();

//Sector 2
char RutaS2[7] = {'S', '2', '.', 't', 'x', 't', '\0'};

//Leemos linea de archivo en la SD
Lin = ReadFile(0,RutaS2);
ext2 = Lin;
Lin = ReadFile(1,RutaS2);
t2 = Lin; //tiempo de riego sector 1
t2d = t2.toInt();
Lin = ReadFile(2,RutaS2);
h21 = Lin; //hora arranque 1
h21h= h21.substring(0,2); //el primero no cuenta
h21hd = h21h.toInt();
h21m= h21.substring(3,5);
h21md = h21m.toInt();

Lin = ReadFile(3,RutaS2);
h22 = Lin;
h22h= h22.substring(0,2);
h22hd = h22h.toInt();
h22m= h22.substring(3,5);
h22md = h22m.toInt();

Lin = ReadFile(4,RutaS2);
h23 = Lin;
h23h= h23.substring(0,2);
h23hd = h23h.toInt();
h23m= h23.substring(3,5);
h23md = h23m.toInt();

Lin = ReadFile(5,RutaS2);
h24 = Lin;
h24h= h24.substring(0,2);
h24hd = h24h.toInt();
h24m= h24.substring(3,5);
h24md = h24m.toInt();

//Sector 3
char RutaS3[7] = {'S', '3', '.', 't', 'x', 't', '\0'};

//Leemos linea de archivo en la SD
Lin = ReadFile(0,RutaS3);
ext3 = Lin;
Lin = ReadFile(1,RutaS3);
t3 = Lin; //tiempo de riego sector 1
t3d = t3.toInt();
Lin = ReadFile(2,RutaS3);
h31 = Lin; //hora arranque 1
h31h= h31.substring(0,2); //el primero no cuenta
h31hd = h31h.toInt();
h31m= h31.substring(3,5);
h31md = h31m.toInt();

Lin = ReadFile(3,RutaS3);
h32 = Lin;
h32h= h32.substring(0,2);
h32hd = h32h.toInt();
h32m= h32.substring(3,5);
h32md = h32m.toInt();

Lin = ReadFile(4,RutaS3);
h33 = Lin;
h33h= h33.substring(0,2);
h33hd = h33h.toInt();
h33m= h33.substring(3,5);
h33md = h33m.toInt();

Lin = ReadFile(5,RutaS3);
h34 = Lin;
h34h= h34.substring(0,2);
h34hd = h34h.toInt();
h34m= h34.substring(3,5);
h34md = h34m.toInt();

}

void loop()
{
  if (PinDescoM > 500)  { //esta parte del codigo imposivilita controlar el parametro por web, la desconexion de los sectores exteriores se hace fisicamente
    DescoM = 1;
  }
  else {
    DescoM = 0;
  }
 DateTime now = RTC.now();
 HoraAc = now.hour()*60 + now.minute(); //pasamos la hora actual a minuto del dia

 h11d = ((h11hd * 60)+ h11md); //pasamos a minuto del dia la hora de arranque
 h12d = ((h12hd * 60)+ h12md);
 h13d = ((h13hd * 60)+ h13md);
 h14d = ((h14hd * 60)+ h14md);

 h21d = ((h21hd * 60)+ h21md); //pasamos a minuto del dia la hora de arranque
 h22d = ((h22hd * 60)+ h22md);
 h23d = ((h23hd * 60)+ h23md);
 h24d = ((h24hd * 60)+ h24md);

 h31d = ((h31hd * 60)+ h31md); //pasamos a minuto del dia la hora de arranque
 h32d = ((h32hd * 60)+ h32md);
 h33d = ((h33hd * 60)+ h33md);
 h34d = ((h34hd * 60)+ h34md);

//Control Sector 1
if (DescoM == 1 && ext1 == "S") {
  }
else {
  if (HoraAc >= h11d && HoraAc < (h11d+t1d)) { //Arranque 1
    digitalWrite(PinPump,LOW); //low es encendido y no preguntes. encendemos bomba
    digitalWrite(PinS1,LOW); //abrimos electrovalbula
  }
  else {
    digitalWrite(PinPump,HIGH);
    digitalWrite(PinS1,HIGH);
  }
  if (HoraAc >= h12d && HoraAc < (h12d+t1d)) { //Arranque 2
    digitalWrite(PinPump,LOW);
    digitalWrite(PinS1,LOW);
  }
  else {
    digitalWrite(PinPump,HIGH);
    digitalWrite(PinS1,HIGH);
  }
  if (HoraAc >= h13d && HoraAc < (h13d+t1d)) { //Arranque 3
    digitalWrite(PinPump,LOW);
    digitalWrite(PinS1,LOW);
  }
  else {
    digitalWrite(PinPump,HIGH);
    digitalWrite(PinS1,HIGH);
  }
  if (HoraAc >= h14d && HoraAc < (h14d+t1d)) { //Arranque 4
    digitalWrite(PinPump,LOW);
    digitalWrite(PinS1,LOW);
  }
  else {
    digitalWrite(PinPump,HIGH);
    digitalWrite(PinS1,HIGH);
  }
}
//Control Sector 2
if (DescoM == 1 && ext2 == "S") {
  }
else {
  if (HoraAc >= h21d && HoraAc < (h21d+t2d)) { //Arranque 1
    digitalWrite(PinPump,LOW); //low es encendido y no preguntes. encendemos bomba
    digitalWrite(PinS2,LOW); //abrimos electrovalbula
  }
  else {
    digitalWrite(PinPump,HIGH);
    digitalWrite(PinS2,HIGH);
  }
  if (HoraAc >= h22d && HoraAc < (h22d+t2d)) { //Arranque 2
    digitalWrite(PinPump,LOW);
    digitalWrite(PinS2,LOW);
  }
  else {
    digitalWrite(PinPump,HIGH);
    digitalWrite(PinS2,HIGH);
  }
  if (HoraAc >= h23d && HoraAc < (h23d+t2d)) { //Arranque 3
    digitalWrite(PinPump,LOW);
    digitalWrite(PinS2,LOW);
  }
  else {
    digitalWrite(PinPump,HIGH);
    digitalWrite(PinS2,HIGH);
  }
  if (HoraAc >= h24d && HoraAc < (h24d+t2d)) { //Arranque 4
    digitalWrite(PinPump,LOW);
    digitalWrite(PinS2,LOW);
  }
  else {
    digitalWrite(PinPump,HIGH);
    digitalWrite(PinS2,HIGH);
  }
}
//Control Sector 1
if (DescoM == 1 && ext3 == "S") {
  }
else {
  if (HoraAc >= h31d && HoraAc < (h31d+t3d)) { //Arranque 1
    digitalWrite(PinPump,LOW); // encendemos bomba
    digitalWrite(PinS3,LOW); //abrimos electrovalbula
  }
  else {
    digitalWrite(PinPump,HIGH);
    digitalWrite(PinS3,HIGH);
  }
  if (HoraAc >= h32d && HoraAc < (h32d+t3d)) { //Arranque 2
    digitalWrite(PinPump,LOW);
    digitalWrite(PinS3,LOW);
  }
  else {
    digitalWrite(PinPump,HIGH);
    digitalWrite(PinS3,HIGH);
  }
  if (HoraAc >= h33d && HoraAc < (h33d+t3d)) { //Arranque 3
    digitalWrite(PinPump,LOW);
    digitalWrite(PinS3,LOW);
  }
  else {
    digitalWrite(PinPump,HIGH);
    digitalWrite(PinS3,HIGH);
  }
  if (HoraAc >= h34d && HoraAc < (h34d+t3d)) { //Arranque 4
    digitalWrite(PinPump,LOW);
    digitalWrite(PinS3,LOW);
  }
  else {
    digitalWrite(PinPump,HIGH);
    digitalWrite(PinS3,HIGH);
  }
}
}


//Funcion para leer linea de un archivo de la sd http://www.extremadura-web.es/Blog/2013/01/16/leer-linea-fichero-sd-en-arduino/
//Primer parametro numero de linea
//Segundo Parametro ruta del fichero
String ReadFile(int Linea,char Ruta[]){
  int Lin=0;
  String Resultado;
  File myFile;
  byte Bin;
  myFile = SD.open(Ruta);;
  if (myFile) {
  while (myFile.available()) {
  Bin=myFile.read();
  if (Bin==13){Lin++;myFile.read();}
  else
  {
  if (Lin==Linea){Resultado=Resultado+(char(Bin));}
  if (Lin>Linea){myFile.close();return Resultado;}
  }
  }
  myFile.close();return Resultado;
  }
}

jueves, 17 de julio de 2014

Forja, Carro





Forja, Cuna D para muñeca







Forja en frío, Cuna C para muñeca







Forja en frío, Carretilla




Forja en Frio, Mesa









Banco de trabajo para soldar

Cuando vi este vídeo en youtuve pensé en actualizar mi banco de trabajo, anteriormente era de madera pero me decidí a construirlo en metal para poder soldar sobre él. Naturalmente el mio está a años luz por detrás...



Vemos una pata y un larguero en hierro de 25.2 y 20.1,5 repetimos la operación hasta conseguir...


Según van pasando los días he añadido varias cosillas...



Ahora tiene una estiva en la parte de atrás, un colgador para la pantalla y el mandil etc
También construí varios útiles para forja en frío...





Con estos útiles realice algunas piezas que podéis ver en las siguientes entradas.