Driver PL2303HX untuk Windows 10 64bit

Pernah beli alat USB to Serial Converter murah, dengan IC PL2303. Saat dipasang di komputer, ternyata butuh driver. Alhasil menemukan driver di situs produsen IC namun ada catatan :

Windows 8/8.1/10 are NOT supported in PL-2303HXA and PL-2303X EOL chip versions.

Untungnya ada situs yang baik hati (lupa dimana) memberikan file hasil modifikasi driver Windows 7 agar bisa dipasang di Windows 10.

Link: http://latiful.hayat.web.id/file/PL2303HX-edit.zip

Semoga bisa bermanfaat

Memprogram AT89S52 dengan Arduino

Programmer AT89S51 biasanya membutuhkan koneksi serial, namun laptop tidak memiliki port serial. Karena Arduino menggunakan port serial, maka bisa dimanfaatkan menjadi programmer AT89S52.

 

Siapkan arduino dengan kode berikut:

lalu upload ke arduino.

 

Siapkan rangkaian sesuai skema berikut:

 

Lalu gunakan applikasi file uploader untuk upload file

Kalibrasi MPU6050

MPU6050 adalah sensor sudut dan percepatan atau biasa disebut gyrometer. Sama seperti kebanyakan sensor lain, MPU6050 perlu dikalibrasi sebelum digunakan. Kinerja gyrometer ini sangat terpengaruh terhadap suhu, jadi pastikan suhu stabil terlebih dahulu sebelum melakukan proses kalibrasi. Beri jarak waktu antara 3 sampai dengan 5 menit setelah power on agar suhu stabil. Hasil proses kalibrasi pun akan berbeda saat dilakukan di suhu ruangan dibandingkan dengan kalibrasi di luar ruangan. Pastikan dikalibrasi pada suhu ruangan yang sama, atau setidaknya hampir sama, dengan dengan suhu dimana alat akan digunakan.

Berikut kode kalibrasi dari Luis Ródenas denga sedikit modifikasi:

Pastikan sudah melakuan instalasi librari I2Cdev dan MPU6050 dan hubungkan MPU6050 dengan skema berikut

 

Taru MPU6050 pada bidang datar, semisal meja dan jangan digerakkan sampai proses kalibrasi selesai.  Selanjutnya, untuk proses kalibrasi, buka dengan serial monitor dengan baud rate 115200 dan kirimkan satu huruf (bebas) lalu tekan send atau klik tombol enter. Tunggi hingga daftar offset muncul dengan ditandai tulisan ‘Your offsets:’

Arduino: ATMega8535 & Arduino IDE

Arduino Uno, merupakan salah satu varian yang saat ini banyak digunakan untuk praktisi dan hobbi elektronika. Arduino adalah pengendali mikro dengan prosesor Atmel AVR dan softwarenya memiliki bahasa pemrograman sendiri. Memiliki library yang cukup komplit serta didukung forum yang ramai, sehingga memudahkan untuk membangun proyek sistem kendali. Library arduino memiliki hampir semua interface dan sesor.

Arduino Uno use widely by electronic practical and hobbyist. Arduino consist of microcontroller which have its own Integrated Development Environtment based on Processing. It has plenty of library supported by many discussion forum, so it will be make easier to build control system projects.

Mikrokontroler arduino bermacam macam, untuk lebih jelasnya dapat dilihat di wikipedia. Kebanyakan menggunakan mikrokontroler Atmel AVR, namun untuk Arduino Yun, Arduino Due dan Arduino Zero menggunakan arsitektur ARM.

Arduino has vary variant depending on its microcontroler, it can be seen through wikipedia. Most of it use AVR, and Atmel Microcontroler. There is also 3 variants using ARM mikrocontroller such as Arduino Yun, Arduino Due and Arduino Zero.

Arduino UNO memiliki pin I/O yang cukup memadai, sekitar 14. Jilka memerlukan pin yang lbih banyak, dapat menggunakan Arduino dengan mikrokontroler jenis ATMega2560 atau jenis ARM yang memiliki I/O 54 pin. Namun sayang sekali memerlukan biaya yang cukup mengusras kantong 😀

Arduino UNO has 14 pin can be used as I/O. If more pin needed, Arduino which employ ATMega2560 or ARM architechture are more elegible to use. Those variant have 54 I/O pin, of cource more expensive than Arduino UNO.

Pada komponen rack yang saya miliki hanya tersedia IC AVR jenis ATMega8, 328, 8535 dan ATTiny2313. Padahal project kali ini membutuhkan I/O sejumlah 20 pin. Mau tidak mau harus mengoprek ATMega8535 yang memiliki 40 pin (32 pin I/O) agar dapat diprogram menggunakan library Arduino. Oke, sekedar sharing ilmu, berikut langkah dan hasilnya :

In my component rack, there are only ATMega8, ATMega328, ATMega8535 and ATTiny2313. I’d tried to use ATMega8535 because I need 20 I/O pin. ATMega8535 has 32 I/O pin. To make ATMega8535 can be used with Arduino library, it can be done by add several line on arduino/hardware/arduino/board.txt as follow:

Tambahkan pada file arduino/hardware/arduino/board.txt dengan baris berikut:

##############################################################

arduino_atmega8535.name=Stumpino-Atmega8535-8Mhz arduino_atmega8535.upload.protocol=stk500v2 arduino_atmega8535.upload.maximum_size=7168 arduino_atmega8535.upload.speed=38400 arduino_atmega8535.bootloader.low_fuses=0xE4 arduino_atmega8535.bootloader.high_fuses=0x98 arduino_atmega8535.bootloader.extended_fuses=0xFD arduino_atmega8535.bootloader.path=atmega arduino_atmega8535.bootloader.file=stk500boot_v2_notdefined.hex #arduino_atmega8535.bootloader.unlock_bits=0x3F #arduino_atmega8535.bootloader.lock_bits=0x0F arduino_atmega8535.build.mcu=atmega8535 arduino_atmega8535.build.f_cpu=8000000L arduino_atmega8535.build.core=arduino arduino_atmega8535.build.variant=stumpinomega40 ##############################################################

arduino_atmega8535-16.name=Stumpino-Atmega8535-External 16Mhz arduino_atmega8535-16.upload.protocol=stk500v2 arduino_atmega8535-16.upload.maximum_size=7168 arduino_atmega8535-16.upload.speed=38400 arduino_atmega8535-16.bootloader.low_fuses=0xEF arduino_atmega8535-16.bootloader.high_fuses=0x98 arduino_atmega8535-16.bootloader.extended_fuses=0xFD arduino_atmega8535-16.bootloader.path=atmega arduino_atmega8535-16.bootloader.file=stk500boot_v2_notdefined.hex #arduino_atmega8535-16.bootloader.unlock_bits=0x3F #arduino_atmega8535-16.bootloader.lock_bits=0x0F arduino_atmega8535-16.build.mcu=atmega8535 arduino_atmega8535-16.build.f_cpu=16000000L arduino_atmega8535-16.build.core=arduino arduino_atmega8535-16.build.variant=stumpinomega40

Kemudian dengan bantuan header yang telah dibut oleh Eric Conner lalu taruh di folder arduino/hardware/arduino/variants/stumpinomega40

Using header that Eric Conner have made, place it in arduino/hardware/arduino/variants/stumpinomega40 folder

Ok, siap pakai. Buka Arduino lalu pilih menu Tool>Board>Stumpino ATMega8535-Eksternal16Mhz dan buka File>Example>01 Basic>Blink. Saya menggunakan downloader USBAsp, jadi saya pilih di bagian menu Tool>Programmer>USBAsp

OK, its ready to use. Open Arduino IDE than choose  Tool>Board>Stumpino ATMega8535-Eksternal16Mhz than open File>Example>01 Basic>Blink. I use USBAsp dwonloader, so I click on Tool>Programmer>USBAsp

Saatnya merangkai ATMega8535 dan ISP-pin di project board dan mencoba. Perlu diketahui, D13 pada ATMega8535 adalah di pin IC kaki 19, jadi tempatkan led di IC pin 19. Silahkan mencoba….

Its time to connect  ATMega8535 and ISP-pin in project board. Arduino D13 pin in ATMega8535 is pin 19. Happy trying…

SetUp ESP8266 as AP, WebServer

BAUD RATE 115200
AT

AT+UART_DEF=9600,8,1,0,0 //(CHANGE TO 9600)
AT+CWMODE=2 //AP MODE
AT+CWSAP?    //CEK SSID

AT+CWSAP=”AsepRemote”,””,1,0 //Set SSID
AT+CWDHCP=0,1 //set dhcp

AT+CIPAPMAC=”2c:aa:35:97:d4:7b” //set mac AP

AT+CIPAP? //cek ip
AT+CIPAP=”192.168.4.1″

AT+CIPMUX=1 //Enable multiple connections

AT+CIFSR //cek local ip

AT+CIPSERVER=1,80 //start server

Connection request is here, take a look at id (e.g: +IPD, 0)  –> 0 will be the connection id

AT+CIPSEND=0,40  //0 is the id and 40 is char length

<html><head></head><body>Hello from ESP8266 </body></html>

AT+CIPCLOSE=0  //0 is the ID

 

Arduino Code Example:

 

Another arduino Code Example:

sources: &nbsp
http://allaboutee.com/2015/01/20/esp8266-android-application-for-arduino-pin-control/ &nbsp
https://github.com/espressif/ESP8266_AT/wiki

Memprogram AT89S52 dengan Arduino

Programmer AT89S51 biasanya membutuhkan koneksi serial, namun laptop tidak memiliki port serial. Karena Arduino menggunakan port serial, maka bisa dimanfaatkan menjadi programmer AT89S52.

 

Siapkan arduino dengan kode berikut:

lalu upload ke arduino.

 

Siapkan rangkaian sesuai skema berikut:

 

Lalu gunakan applikasi file uploader untuk upload file

Kalibrasi MPU6050

MPU6050 adalah sensor sudut dan percepatan atau biasa disebut gyrometer. Sama seperti kebanyakan sensor lain, MPU6050 perlu dikalibrasi sebelum digunakan. Kinerja gyrometer ini sangat terpengaruh terhadap suhu, jadi pastikan suhu stabil terlebih dahulu sebelum melakukan proses kalibrasi. Beri jarak waktu antara 3 sampai dengan 5 menit setelah power on agar suhu stabil. Hasil proses kalibrasi pun akan berbeda saat dilakukan di suhu ruangan dibandingkan dengan kalibrasi di luar ruangan. Pastikan dikalibrasi pada suhu ruangan yang sama, atau setidaknya hampir sama, dengan dengan suhu dimana alat akan digunakan.

Berikut kode kalibrasi dari Luis Ródenas denga sedikit modifikasi:

Pastikan sudah melakuan instalasi librari I2Cdev dan MPU6050 dan hubungkan MPU6050 dengan skema berikut

 

Taru MPU6050 pada bidang datar, semisal meja dan jangan digerakkan sampai proses kalibrasi selesai.  Selanjutnya, untuk proses kalibrasi, buka dengan serial monitor dengan baud rate 115200 dan kirimkan satu huruf (bebas) lalu tekan send atau klik tombol enter. Tunggi hingga daftar offset muncul dengan ditandai tulisan ‘Your offsets:’

USBASP, Arduino IDE, Linux

Make sure USBasb plugged into USB Port and check whenever its conected or not by typing lsusb in terminal.

stufi1983@latif-laptop:~$ lsusb
Bus 001 Device 003: ID 0db0:6877 Micro Star International RT2573
Bus 001 Device 004: ID 058f:6387 Alcor Micro Corp. Flash Drive
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 003: ID 16c0:05dc Van Ooijen Technische Informatica shared ID for use with libusb
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

USBasp should detected with VendorID 16c0 and ProductID 05dc. Look at bus address. It says Bus 002 Device 003. See permission on Bus 002 Device 001 by typing ls -l /dev/bus/usb/002/003 in terminal.

stufi1983@latif-laptop:~$ ls -l /dev/bus/usb/002/003
crw-rw-r-- 1 root root 189, 130 Sep  6 10:05 /dev/bus/usb/002/003

Current permission is crw-rw-r– mean user dont have permission to write at the bus. So, change permission to 777 with chmod command.

stufi1983@latif-laptop:~$ sudo chmod 777 /dev/bus/usb/002/003
[sudo] password for stufi1983:

OK, Done. USBasp now already to use with Arduino. Select in Arduino  menu Tool>Progammer>USBasp. Make new file New>Examples>Basic>Blink. Then upload by using menu: File>Upload using Programer

Timer Interrupt on ATMega8535

I have writeATMEga8535 & Arduino IDE, its time to try how will it works. This time I’d like to try using Timer Interrupt. Will be usefull for time critical (e.g dot matrix scanning) and PWM generation.

First step, open BareMinimum on File>Example>Basic and place this code in the setup routines (just after void setup() {):
// initialize timer1
noInterrupts();           // disable all interrupts
TCCR1A = 0;
TCCR1B = 0;
TCNT1  = 0;

  OCR1A = 31250;            // compare match register 16MHz/256/2Hz
TCCR1B |= (1 << WGM12);   // CTC mode
//TCCR1B |= (1 << CS11);    // 8 prescaler
TCCR1B |= (1 << CS10);    // 64 prescaler (overide) or no prescaler (standalone)
TIMSK |= (1 << OCIE1A);  // enable timer compare interrupt /TIMSK1
interrupts();             // enable all interrupts

That was initialization for Timer1 which is 16bit timer. The important thing to do are disable interrupt vector and  re-enable interupt vector after timer initialization done.

TCCR1A (Timer/Counter1 Control Register A) is register consist of WGM (Wave Generation Mode) to decide what mode which we will use. There are 4 main modes, Normal, CTC, PWM and Fast PWM mode. This time i’d prefer CTC mode.

In CTC (Clear Timer on Compare) mode the counter will count until it hits the value specified in the OCR1 register.  When the TCNT1 passes the TOP value (Specified by the OCR1) it resets to 0 and at the same time sets the TOV1 flag.

Look at following table, what we need to set is only WGM12 to be 1 (mode 4).

But wait! What is the difference between mode 4 and mode 12? Yes, Register that used to manipulate the counter resolution is OCR1A for CTC mode 4, mean while CTC mode 12 use ICR1. The ICR1 Register is not double buffered. This means that if ICR1 is changed to a low value when the counter is running with a low or none prescaler value, there is a risk that the new ICR1 value written is lower than the current value of TCNT1. The result will then be that the counter willmiss the Compare Match at the TOP value. The OCR1A Register however, is double buffered. This feature allows the OCR1A I/O location to be written anytime.

When the OCR1A I/O location is written the value written will be put into the OCR1A Buffer Register. The OCR1A Compare Register will then be updated with the value in the Buffer Register at the next timer clock cycle the TCNT1 matches TOP. The update is done at the same timer clock cycle as the TCNT1 is cleared and the TOV1 Flag is set.

Using the ICR1 Register for defining TOP works well when using fixed TOP values. By using ICR1, the OCR1A Register is free to be used for generating a PWM output on OC1A. However, if the base PWM frequency is actively changed (by changing the TOP value), using the OCR1A as TOP is clearlya better choice due to its double buffer feature.

Next step is reseting Timer 1 Counter in TCNT1 Register. TCNT1 is the counter register which is increasing when timmer is running.

To make timer work, prescales have to be set either internal or external clock source. Prescaler can be set in TCCR1B Register at CS12;CS11;CS10.

To user timer1 as interrupt, TIMSK Register have to be set. When OCIE1A bit is written to one, and the I-flag in the Status Register is set (interrupts globally enabled), the Timer/Counter1 Output Compare A Match interrupt is enabled. The corresponding Interrupt Vector is executed when the OCF1A Flag, located in TIFR, is set.

Don’t forget to re-enable Interrupt to get TImer1 Interrupt work.