Skip to main content

Pasang Arduino di ATMega32A

ATMEGA32A
Sebenarnya ini sudah lama saya praktekan, namun belum ada waktu untuk menulisnya. Mumpung ada waktu, selain untuk mengingat - ingat, mungkin dapat berguna juga bagi anda yang tertarik untuk mempraktikanya juga. Saya kebetulan punya sebuah chip Atmega32A dan Atmega8535, untuk mengobati rasa penasaran apakah Atmega32 bisa dmasuki Arduino, saya langsung mencoba saja.


Alat - alat yang dibutuhkan 
  1. Chip Atmega32A
  2. Arduino UNO (Tidak harus seri UNO) 
  3. Breadboard

Sebelumnya, untuk konfigurasi PIN dari Atmega32 ini, bisa dilihat di datasheetnya.
  1. Langkah selanjutnya adalah mengunduh konfigurasi untuk boardnya dan juga konfigurasi pin Atmega32 untuk Arduinonya. Silahkan unduh disini.
  2. Didalam archive tersebut terdapat file board.txt yang harus anda buka, dan salin isinya masukkan kedalam file board.txt yang ada pada direktori Arduino anda, normalnya terletak di \Program Files\Arduino\hardware\arduino\boards.txt. INGAT! Jangan hapus isi dari boards.txt yang ada pada folder Arduino, cukup tambahkan saja isi board.txt yang anda unduh kedalam board.txt milik Arduino. 
  3. Langkah selanjutnya adalah memasukkan fodler mega32 yang ada pada folder variants pada archive kedalam folder variants yang ada folder \Program files\Arduino\hardware\arduino\variants\ milik anda. Folder tersebut berisi konfigurasi pin pada Atmega 32 setelah nantinya diisi dengan Arduino.
  4. Sekarang, buka aplikasi Arduino anda dan buka isi ArduinoISP yang berada pada sub menu Examples. 
    Arduino ISP
  5. Setelah source code nya terbuka, colokkan Arduino Uno (contoh) ke PC, dan isi Arduino Unonya dengan Arduino ISP tersebut. 
  6. Setelah Arduino dalam posisi sudah terisi dengan ISP tersebut, masuk ke menu Tools >  Board dan pastikan anda sudah melihat ada Atmega32 pada list tersebut. Kemudian pilih Atmega32-1Mhz 
    Atmega32 board
  7. Kemudian masuk kembali ke menu Tools > Programmer dan pilih Arduino as ISP
  8. Langkah selanjutnya tinggal masuk ke Tools > Burn bootloader. Eits!! kan ciruitnya belum terpasang. 
  9. Karena saya malas menggambar, silahkan perhatikan konfigurasi pin dibawah ini
    1. Pin 13 Arduino menuju pin 8 Atmega32 (SCK)
    2. Pin 12 Arduino menuju pin 7 Atmega32 (MISO)
    3. Pin 11 Arduino menuju pin 6 Atmega32 (MOSI)
    4. Pin 10 Arduino menuju pin 9 Atmega32 (RESET) 
    5. Pin 5v Arduino menuju pin 10 Atmega32
    6. Pin GND Arduino menuju pin 11 Atmega32
  10. Konfigurasi diatas dapat anda ganti - ganti jika anda menggunakan chip AVR tipe lain, baca datasheetnya dan cari dimana pin SCK, MISO, MOSI dan RESET. 
  11. Setelah di pasang dengan benar, pastikan bahwa kabel tidak mudah lepas/goyah agar pada saat pembakaran bootloader dapat berjalan dengan lancar. 
  12. Sekarang anda boleh menekan menu Burn Bootloader!
  13. Tunggu sebentar, dan bootloader akan dipasang pada Atmega32. Maaf ini tidak ada screenshotnya juga. Jika berhasil maka akan muncul Bootloader berhasi dipasang (saya lupa bahasa inggrisnya).. hehehe
  14. Setelah berhasil diisi dengan Arduino. Harap perhatikan bahwa konfigurasi pin dari Atmega32 sudah berbeda. Silahkan lihat gambar dibawah ini 
    Pin Atmega32A
  15. Pada gambar diatas, dapat dilihat bahwa kita sekarang mempunyai pin digital sebanyak 32 pin, dan analog sebanyak 8 pin. 
  16. Pada konfigurasi baru ini, Atmega32 juga mendukung PWM pada pin D12, D13, dan pin 15. 
  17. Chip sudah bisa digunakan, setiap kali anda ingin memasukkan data ke chip ini, set board ke Atmega32-1Mhz dan set Programmer ke Arduino as ISP!
  18. Sekarang, coba masuk ke Arduino dan buka contoh program dengan nama Fading, dan rubah Pinya ke pin 13, kemudian kasih LED pada pin 13. 
  19. Atau bisa anda kopas kode dibawah ini
/*
Fading
This example shows how to fade an LED using the analogWrite() function.
The circuit:
* LED attached from digital pin 9 to ground.
Created 1 Nov 2008
By David A. Mellis
modified 30 Aug 2011
By Tom Igoe
http://arduino.cc/en/Tutorial/Fading
This example code is in the public domain.
*/

int ledPin = 13;  // Pin PWM milik ATMEGA32

void setup() {
// nothing happens in setup
}


void loop() {
// fade in from min to max in increments of 5 points:
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) {
// sets the value (range from 0 to 255):
analogWrite(ledPin, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}


// fade out from max to min in increments of 5 points:
for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) {
// sets the value (range from 0 to 255):
analogWrite(ledPin, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
}
Coba anda upload ke Atmega32 dan lihat apakah LED yang dipasang pada pin 13 melakukan fading ? Jika ya, selamat anda sudah berhasil :)
Selanjutnya saya masih penasaran dengan Attiny2313, mungkin akan saya bahas nantinya jika sudah ada dana terkumpul untuk membelinya :)

Good Luck!

Comments

Post a Comment

Popular posts from this blog

HackRF Mayhem Failed to Update - M0 Guru Meditation Hard

I was on Mayhem Portapack v2.0.1 and want to upgrade to the latest stable release v2.1.0. The update went okay using the web upgrade https://hackrf.app/. But then I saw the latest nightly update and want to try it, since it has many new tools that are not yet included in the stable release. But then the update failed :( Disclaimer: I didn't take any photos of the errors, since I was focused on googling the solution. So the error was " Bad Firmware or Failed W/R error" during the upgrade process, and it was stuck. So I had to restart the device, and it was booting to the Mayhem menu, but on the bottom left, which should show the current firmware version, it was showing a  "FLASH ERR"  message. I think I should go back to the stable release, but I can't. Every time I want to flash the stable release version, the portapack will shows an error M0 Guru Meditation - Hard Fault.  There's an issue that was closed on the Mayhem GIT repo that has the same issue a...

Fiberhome HG6145D2 Superadmin Login

Maybe some of you are using In**ehome ISP as your home internet and found out that using the provided login has minimal options to configure the router: user  user1234 I know it’s not the admin login, and that must be a full-control user account that can be used to control this router fully. So I searched and found some posts on the net and most of them are telling me to use: admin %0|F?H@f!berhO3e I tested it and it doesn’t work! But there’s more to it, you need to reset the router first by pressing the reset button on the side of the router. Then after resetting, you can log in using the admin superaccount! But keep in mind, never use the user log in again, because it will lock the super admin login until you reset the router again. Cheers 🍺

Macintosh Classic II Brightness Issue

The Problem My Macintosh Classic II suffers from an issue where the display CRT goes dim after a few minutes on a cold boot. Every time it happens, I need to crank up the cut-off and brightness  pot behind the machine to show the image. The Analyze At first, I thought it must be the brightness issue, so I searched for the Macintosh Classic analog board schematic to check the brightness line. I found the schematic from Bomarc, and the schematic is suitable with my board, since there are two analog board versions.  I started to suspect the resistors and potentiometer on the brightness line. This Macintosh version has software-controlled brightness, so the analog board will get a 22.25 kHz square wave PBM signal from the logic board to control the brightness. I checked and replaced some resistors and cleaned the potentiometer, but nothing seems to work. The signal is there, and no sign of degradation that makes the screen dim after a few minutes.  Brightness Line So I suspec...