Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Home made etching tank on Attiny2313

Status
Not open for further replies.

Vermes

Advanced Member level 4
Joined
Aug 2, 2011
Messages
1,163
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,316
Activity points
22,318


Dimensions of the etching tank: 25x30x3,5cm (it is about 1,4l of acid). A board with dimensions of an A4 page would fit it.

Heater used is SKALAR 150W, it heats up 1,3l of water at 20 degrees Celsius to 40 degrees Celsius in 15 minutes, 40 to 50 degrees Celsius in another 9 minutes.

The system was designed on Attiny2313. 6 LEDs indicate the operation of the etching tank:
  1. temperature was set on 40 degrees Celsius
  2. 45 degrees Celsius
  3. 50 degrees Celsius
  4. the heater on
  5. aerator mode
  6. power

Control is done using three buttons, first is used to set the temperature, second one for aerator and the last one turns on the heating.

The aerator can operate in four modes, 1s of aeration and 3s pause, 1s and 1s pause, continuous and off.

The board with buttons is outside. The entire device is made of 4mm plexiglass, glued to the aquarium with the adhesive. It is solid, you can add a faucet for draining acid.

Elements used:
  • heater
  • pump and hose
  • return valve
  • plexiglass
  • transformer
  • triacs

Program was written in C, here is the code:

Code:
Kod C - [rozwiń]
*
*
#include <avr/io.h>
#include <util/delay.h> 
#include "ds18b20.h"
*
#define GRE1on    PORTD = PORTD | (1<<0)
#define GRE1off          PORTD = PORTD &~(1<<0)
#define GRE2on    PORTD = PORTD | (1<<1)
#define GRE2off          PORTD = PORTD &~(1<<1)
#define GRE3on    PORTD = PORTD | (1<<2)
#define GRE3off          PORTD = PORTD &~(1<<2)
*
#define YEL1on            PORTD = PORTD | (1<<3)
#define YEL1off              PORTD = PORTD &~(1<<3)
#define YEL2on            PORTD = PORTD | (1<<4)
#define YEL2off              PORTD = PORTD &~(1<<4)
*
#define REDon            PORTD = PORTD | (1<<5)
#define REDoff          PORTD = PORTD &~(1<<5)
*
#define HEATon  PORTB = PORTB | (1<<2);  
#define HEAToff          PORTB = PORTB &~(1<<2); 
*
#define AIRon           PORTB = PORTB | (1<<3); 
#define AIRoff                   PORTB = PORTB &~(1<<3); 
*
*
*
int x=0,y=0,z=1,tem;         // 
int a=25, b=10;  // Ustawienia czasu napowietrzania
int min=37, sr=42, max=47;      // termostat
*
/****************** KLAWIATURA *********************/
int readkey( void )
{
 if (bit_is_clear(PIND,6))                  // key left ( ustawianie temperatury )
 {  // x=0_40 C || x=1_45C || x=2_50C
 _delay_ms(200);   
 x++;
 if (x>2) x=0;    
 return 1;
 } 
 if (bit_is_clear(PINB,0))                  // key middle ( ustawianie napowietrzacza )
 {  // y=0_wył  || y=1_co2sek || y=2_co1sek || y=3_co0sek
 _delay_ms(200);
 y++;
 if (y>3) y=0; 
 return 2;
 }
 if (bit_is_clear(PINB,1))                  // key right ( nagrzewanie )
 {   // z=0_wył  || z=1_wł
 _delay_ms(200); 
 z++;
 if (z>2) z=1;
 return 3;
 } 
 return -1; 
}
*
/******************** DELAY **********************/
void delay(unsigned char czas) //sekundy
{
 uint8_t i;
*
 while (czas > 0) {
 czas--;
 for (i=0;i<10;i++) 
 {
 readkey(); ///// BREAKK
 _delay_ms(10);
 }
 }
}
*
/************** POMIAR TEMPERATURY *****************/
int pomiar( void )
{
 unsigned char ds18b20_pad[9];
 if(ds18b20_ConvertT())
 {
 // _delay_ms(10);  // czas konwersji (750ms)
 ds18b20_Read(ds18b20_pad); 
 tem  = ( ((ds18b20_pad[1] << 8) + ds18b20_pad[0])*1000) / 16000 ;
 }
 return 0;
}
*
*
/********************* MAIN ***********************/
int main(void)
{ 
 DDRD = 0x3F;
 PORTD = 0xC0;
*
 DDRB = 0xEC;
 PORTB = 0x03; 
*
 while (1) 
 {
 readkey();
 if ( z == 2 ) // prawy klawisz
 {
 readkey();
 if ( x == 0 ) //jezeli wybrano 40C
 {
 GRE1on;
 GRE2off; GRE3off;
 pomiar();
 readkey();
 if (tem < min ) { YEL1on; HEATon;  }
 else        { YEL1off;HEAToff; }
*
 if (tem > (min-2) ) REDon;
 else     REDoff;
*
 if ( y == 1 )  { AIRon; YEL2on; delay(a-13); AIRoff; YEL2off; delay(a);}
 else   AIRoff; 
*
 if ( y == 2 )  { AIRon; YEL2on; delay(b-3); AIRoff; YEL2off; delay(b); }
 else   AIRoff; 
*
 if ( y == 3 )  { AIRon; YEL2on;  }
 else     { AIRoff; YEL2off; }
 }
 else { GRE1off; GRE2off; GRE3off; }
*
 readkey();
 if ( x == 1 ) //jezeli wybrano 45C
 {
 GRE2on;
 GRE1off; GRE3off;
 pomiar();;
 readkey();
 if (tem < sr ) { YEL1on; HEATon;  }
 else        { YEL1off;HEAToff; }
*
 if (tem > (sr-2) ) REDon;
 else     REDoff;
*
 if ( y == 1 )  { AIRon; YEL2on; delay(a-13); AIRoff; YEL2off; delay(a);}
 else   AIRoff; 
*
 if ( y == 2 )  { AIRon; YEL2on; delay(b-3); AIRoff; YEL2off; delay(b); }
 else   AIRoff; 
*
 if ( y == 3 )  { AIRon; YEL2on;  }
 else     { AIRoff; YEL2off; }
 }
 else { GRE1off; GRE2off; GRE3off; }
*
 readkey();
 if ( x == 2 ) //jezeli wybrano 50C
 {
 GRE3on;
 GRE1off; GRE2off;
 pomiar();
 readkey();
 if (tem < max ) { YEL1on; HEATon;  }
 else        { YEL1off;HEAToff; }
*
 if (tem > (max-2) ) REDon;
 else     REDoff;
*
 if ( y == 1 )  { AIRon; YEL2on; delay(a-13); AIRoff; YEL2off; delay(a);}
 else   AIRoff; 
*
 if ( y == 2 )  { AIRon; YEL2on; delay(b-3); AIRoff; YEL2off; delay(b); }
 else   AIRoff; 
*
 if ( y == 3 )  { AIRon; YEL2on;  }
 else     { AIRoff; YEL2off; }
 }
 else { GRE1off; GRE2off; GRE3off; }
*
 readkey();
 }
 else 
 { 
 GRE1off;
 GRE2off;
 GRE3off; 
*
 YEL1off;
 HEAToff;
 }
 }
 return 0;
}
*
*

Pictures:




Link to original thread (useful attachment) – Wytrawiarka na attiny2313 by dp
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top