Alat Pengukur Kelembaban Tanah Dengan AVR ATMEGA 8535
Alat ini saya modifikasi dari rangkaian pada soil moisture Tester 😀 😀 . Pada rangkaian tersebut yang menjadi pengolah pembacaan sensor hingga menjadi output dengan menggunakan IC LM3914. Output yang dihasilkan berupa indikator led, berjumlah 10. Pada alat yang saya buat, menggantikan IC LM3914 dan indikator led dengan sebuah mikrokontroler dan LCD 2×16. Secara dasar input sebuah sensor berupa sinyal analog yang nantinya diubah menjadi sinyal digital. Klo sewaktu kuliah dulu, namanya ADC (analog digital converter) 😀 😀 . Karena kebetulan ada temen yang meminta tolong untuk membuatkan alat ini sebagai Penulisan Ilmiahnya “Kok gw yang ngerjain alatnya yach” 😀 😀 . Lumayan buat nambahin beli gitar fender uangnya 😀 :D. Karena di ATMEGA8535 terdapat ADC internal didalamnya, maka saya memanfaat ADC tersebut sebagai pengolah sensornya nanti “biar sedikit pengurangi pengeluaran belanja komponen”. Ok, kita mulai dengan bahan-bahannya yang dibutuhkan.
1. Modul DT-AVR (Low Cost Micro System) + isp programmer dari Innovative Electronics
2. LCD 2×16
3. CodevisionAVR (Full Version)
4. Sensor kelembaban seperti gambar dibawah
Berikut Source Codenya
#include #include #include // Alphanumeric LCD Module functions #asm .equ __lcd_port=0x18 ;PORTB #endasm #include #define ADC_VREF_TYPE 0x60 char buf[33]; unsigned char dtadc; // Read the 8 most significant bits // of the AD conversion result unsigned char read_adc(unsigned char adc_input) { ADMUX=adc_input|ADC_VREF_TYPE; // Start the AD conversion ADCSRA|=0x40; // Wait for the AD conversion to complete while ((ADCSRA & 0x10)==0); ADCSRA|=0x10; return ADCH; } //Konversi Dari Hexa ke Desimal void tampil(unsigned char dat) { unsigned char data; data = dat / 100; data+=0x30; lcd_putchar(data); dat%=100; data = dat / 10; data+=0x30; lcd_putchar(data); dat%=10; data = dat + 0x30; lcd_putchar(data); } //Tampilan Led Baris 1 void display() { if (dtadc==0){ lcd_gotoxy(0,0); lcd_putsf(" "); } if ((dtadc>1) && (dtadc<=10)){ lcd_gotoxy(0,0); sprintf(buf,"\xff"); lcd_puts(buf); lcd_putsf(" "); } if ((dtadc>10) && (dtadc<=20)){ lcd_gotoxy(0,0); sprintf(buf,"\xff"); lcd_puts(buf);lcd_puts(buf); lcd_putsf(" "); } if ((dtadc>20) && (dtadc<=30)){ lcd_gotoxy(0,0); sprintf(buf,"\xff"); lcd_puts(buf);lcd_puts(buf);lcd_puts(buf); lcd_putsf(" "); } if ((dtadc>30) && (dtadc<=40)){ lcd_gotoxy(0,0); sprintf(buf,"\xff"); lcd_puts(buf);lcd_puts(buf);lcd_puts(buf);lcd_puts(buf); lcd_putsf(" "); } if ((dtadc>40) && (dtadc<=50)){ lcd_gotoxy(0,0); sprintf(buf,"\xff"); lcd_puts(buf);lcd_puts(buf);lcd_puts(buf);lcd_puts(buf);lcd_puts(buf); lcd_putsf(" "); } if ((dtadc>50) && (dtadc<=60)){ lcd_gotoxy(0,0); sprintf(buf,"\xff"); lcd_puts(buf);lcd_puts(buf);lcd_puts(buf);lcd_puts(buf);lcd_puts(buf);lcd_puts(buf); lcd_putsf(" "); } if ((dtadc>60) && (dtadc<=70)){ lcd_gotoxy(0,0); sprintf(buf,"\xff"); lcd_puts(buf);lcd_puts(buf);lcd_puts(buf);lcd_puts(buf);lcd_puts(buf);lcd_puts(buf);lcd_puts(buf); lcd_putsf(" "); } if ((dtadc>70) && (dtadc<=80)){ lcd_gotoxy(0,0); sprintf(buf,"\xff"); lcd_puts(buf);lcd_puts(buf);lcd_puts(buf);lcd_puts(buf);lcd_puts(buf);lcd_puts(buf);lcd_puts(buf);lcd_puts(buf); lcd_putsf(" "); } if ((dtadc>80) && (dtadc<=90)){ lcd_gotoxy(0,0); sprintf(buf,"\xff"); lcd_puts(buf);lcd_puts(buf);lcd_puts(buf);lcd_puts(buf);lcd_puts(buf);lcd_puts(buf);lcd_puts(buf);lcd_puts(buf);lcd_puts(buf); lcd_putsf(" "); } if ((dtadc>90) && (dtadc<=100)){ lcd_gotoxy(0,0); sprintf(buf,"\xff"); lcd_puts(buf);lcd_puts(buf);lcd_puts(buf);lcd_puts(buf);lcd_puts(buf);lcd_puts(buf);lcd_puts(buf);lcd_puts(buf);lcd_puts(buf);lcd_puts(buf); lcd_putsf(" "); } } // Declare your global variables here void main(void) { // Declare your local variables here // Input/Output Ports initialization // Port A initialization // Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In // State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T PORTA=0x00; DDRA=0x00; // Port B initialization // Func7=Out Func6=Out Func5=Out Func4=Out Func3=Out Func2=Out Func1=Out Func0=Out // State7=0 State6=0 State5=0 State4=0 State3=0 State2=0 State1=0 State0=0 PORTB=0x00; DDRB=0xFF; // Port C initialization // Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In // State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T PORTC=0x00; DDRC=0x00; // Port D initialization // Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In // State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T PORTD=0x00; DDRD=0x00; // Timer/Counter 0 initialization // Clock source: System Clock // Clock value: Timer 0 Stopped // Mode: Normal top=FFh // OC0 output: Disconnected TCCR0=0x00; TCNT0=0x00; OCR0=0x00; // Timer/Counter 1 initialization // Clock source: System Clock // Clock value: Timer 1 Stopped // Mode: Normal top=FFFFh // OC1A output: Discon. // OC1B output: Discon. // Noise Canceler: Off // Input Capture on Falling Edge // Timer 1 Overflow Interrupt: Off // Input Capture Interrupt: Off // Compare A Match Interrupt: Off // Compare B Match Interrupt: Off TCCR1A=0x00; TCCR1B=0x00; TCNT1H=0x00; TCNT1L=0x00; ICR1H=0x00; ICR1L=0x00; OCR1AH=0x00; OCR1AL=0x00; OCR1BH=0x00; OCR1BL=0x00; // Timer/Counter 2 initialization // Clock source: System Clock // Clock value: Timer 2 Stopped // Mode: Normal top=FFh // OC2 output: Disconnected ASSR=0x00; TCCR2=0x00; TCNT2=0x00; OCR2=0x00; // External Interrupt(s) initialization // INT0: Off // INT1: Off // INT2: Off MCUCR=0x00; MCUCSR=0x00; // Timer(s)/Counter(s) Interrupt(s) initialization TIMSK=0x00; // Analog Comparator initialization // Analog Comparator: Off // Analog Comparator Input Capture by Timer/Counter 1: Off ACSR=0x80; SFIOR=0x00; // ADC initialization // ADC Clock frequency: 1000.000 kHz // ADC Voltage Reference: AVCC pin // ADC High Speed Mode: On // ADC Auto Trigger Source: None // Only the 8 most significant bits of // the AD conversion result are used ADMUX=ADC_VREF_TYPE & 0xff; ADCSRA=0x82; SFIOR&=0xEF; SFIOR|=0x10; // LCD module initialization lcd_init(16); // Global enable interrupts lcd_gotoxy(2,0); lcd_putsf("Alat Pengukur"); delay_ms(1000); lcd_gotoxy(0,1); lcd_putsf("Kelembaban Tanah"); delay_ms(1000); lcd_clear(); lcd_gotoxy(4,1); lcd_putsf("%"); lcd_gotoxy(11,0); lcd_putsf("<-Led"); while (1) { dtadc=read_adc(0); // baca data ADC dari ch.0; lcd_gotoxy(0,1); tampil(dtadc); display(); // Keterangan if (dtadc<=50){ lcd_gotoxy(6,1); lcd_putsf("Kering "); } if ((dtadc>50) && (dtadc<=90)){ lcd_gotoxy(6,1); lcd_putsf("Lembab "); } if (dtadc>90){ lcd_gotoxy(6,1); lcd_putsf("Basah "); } delay_ms(100); }; }
Selesai
Hey Guys,
Warning: From February 2024, all existing email autoresponders will become obsolete!
In fact, if you want to send marketing emails, promotional emails, or any other sort of emails starting in February 2024, you’ll need to comply with Gmail’s and Yahoo’s draconic new directives.
They require regular marketers like you and I to setup complex code on sending domains… and existing autoresponders like Aweber and GetResponse are not helping: they’re requesting you do all the work, and their training is filled with complex instructions and flowcharts…
How would you like to send unlimited emails at the push of a button all with done-for-you DMARC, DKIM, SPF, custom IPs and dedicated SMTP sending servers?
What I mean by all of that tech talk above, is that with ProfitMarc, we give you pre-set, pre-configured, DONE-FOR-YOU email sending addresses you can just load up and mail straight away.
We don’t even have any “setup tutorials” like other autoresponders either, because guess what: we already did all the setup for you!
All of our built-in sending addresses and servers are already pre-warmed with Gmail and Yahoo and they’re loving us: 99% inbox rate is the average!
⇒ Grab your copy here! ⇒ https://ext-opp.com/ProfitMarc