Pages

Tampilkan postingan dengan label ELEKTRONIKA. Tampilkan semua postingan
Tampilkan postingan dengan label ELEKTRONIKA. Tampilkan semua postingan

4/23/2012

Memprogram motor servo dengan Code Vision AVR

           Motor merupakan bagian utama dari sebuah robot. Hampir semua jenis robot kecuali yang menggunakan muscle wire (kawat otot) selalu menggunakan motor. Jenis turtle, vehicle dan rover membutuhkan motor untuk menggerakkan rodanya. Appendage membutuhkan motor untuk menggerakkan lengan dan mencengkeram. Walker dan android membutuhkan motor untuk menggerakkan kakinya. Terdapat beberapa jenis motor di pasaran dan untuk merancang sebuah robot maka kita harus dapat memilih motor yang tepat sesuai fungsinya pada robot tersebut, salah satu diantaranya motor servo.

            Servo motor banyak digunakan sebagai aktuator pada mobile robot atau lengan robot. Servo motor umunya terdiri dari servo continuous dan servo standar. Servo motor continuous dapat berputar sebesar 360 derajat..  Sedangkan servo motor tipe standar hanya mampu berputar 180 derajat.  Servo motor yang umum digunakan ialah Continuous Parallax.  Namun jika ingin servo motor yang berkekuatan besar dan cepat, idealnya menggunakan servo HS-311 (continuos ) dan servo HS-322HD (standar).     

            Untuk menggerakkan motor servo ke kanan atau ke kiri, tergantung dari nilai delay yang kita berikan. Untuk membuat servo pada posisi center, berikan pulsa 1.5ms.  Untuk memutar servo ke kanan, berikan pulsa <=1.3ms, dan pulsa >= 1.7ms untuk berputar ke kiri dengan delay 20ms, seperti ilustrasi berikut:

       
    Konektor Motor servo ada 3, yaitu :
·           Untuk posisi ground yaitu pada kabel hitam.
·           Untuk posisi data pada kabel warna putih.
·           Untuk Vcc pada kabel merah dengan tegangan +5v dan maximalnya +6v


Contoh pembangkitan  Pulse Modulation Width (PWM) dengan menggunakan mikrokontroler keluarga AVR ( ATMega 8535 ) dengan Software CodeVision AVR dapat dilakukan dengan menuliskan listing program sederhana seperti berikut ini :

* Di mana kecepatan motor dapat diatur dengan mengubah delay ON dan OFF-nya

So..selamat mencoba...:-)



6/04/2010

Membuat USB Downloader

Main mikrokontroller yuk…!!Tapi tunggu dulu,kita mau masukin programnya lewat apa .Hehm…ada downloader parallel ada usb downloader pilih yang mana yaa…Kalo pingin hasil download program maksimal ,memang banyak yang nyarankan untuk pake downloader parallel…Rangkaiannya pun lebih simple..Namun berdasarkan pengalamanku nih…(sementara masih kuliah)..Enak pake usb downloader…temen-temen di kampus kan banyak yang punya Laptop…nah ini bisa dimanfaatin tuh bagi yang gak punya komputer ataupun laptop….Rangkaiannya juga gak kalah simple kok…tapi kalo gak hati-hati dalam merangkai,bisa bikin stress juga…tapi optimis dulu sebelum membuat…Ku udah buat dan udah berhasil …yang kupakai ini…” usb asp “.Downloader for AVR yang ada di http://www.fischl.de/usbasp/. Mungkin temen-temen sudah bisa membuat USB downloader ini, tapi tak ada salahnya penulis menuliskan bagaimana cara membuat USB downloader ini. Cara membuat USB downloader ini sebagai berikut:
1. Buat PCB dari rangkaian dibawah ini


2. Install Driver USB, pilih sesuai versi winAVR yang digunakan

Kalo proses intallasi driver USB sukses, akan muncul gambar di bawah ini


5. USB Downloader siap digunakan
Untuk menulis .hex ke mikrokontroller dapat digunakan program khazama (khazama.com), seperti dibawah ini




5/25/2010

Rangkaian Charger Otomatis LM555

Buat temen – temen yang hobi banget dengan elektronika…Ni ku kasih skematik charger otomatis….bisa di coba deh…Q udah nyoba hasilnya pun tak mengecewakan.Pokoknya gak kalah deh sama buatan pabrik….hi..hi…
Prinsip kerjanya sederhana, bila baterai kosong maka led akan menyala menandakan baterai sedang diisi.
Bila baterai telah penuh maka led akan mati menandakan rangkaian berhenti menyalurkan arus. Bila baterai yang akan diisi berkapasitas 3v6 maka zener diodenya menggunakan zener 3v3. Bila dipakai mengisi baterai 6v maka zener 5v6 yang dipakai. Waktu pengisian hingga penuh antara 2-3 jam.
Perhatian: sambung baterai kerangkaian terlebih dahulu baru nyalakan. Bila tidak maka otomatisasi tidak berjalan. VR untuk menset kapan baterai berhenti mengisi bila penuh. Dengan voltmeter (tanpa baterai tersambung) set ke 4v.

3/29/2010

Relay Pemutus Otomatis





3/20/2010

ATmega48/88/168 Development Board


The development board consists of:

1. ATmega AVR microcontroller in DIP28 package
The development board is designed to use ATmega48 with 4kB flash memory or ATmega88 (8kB), ATmega168 (16kB). New version of these microcontrollers ATmega48P/88P/168P and ATmega328P (with 32kB) are pin compatible with old version, so they can be used also.

External crystal X1 is placed in socket, so it is easy to change it or remove it. If internal oscillator is used then two PB6 and PB7 pins dedicated for crystal can be connected to the Port B connector.

Microcontroller can be reset by pressing reset button S1.

2. AVR Ports B, C, D headers
If built in peripheries are not used another device can be connected to the PORT B, C and D. Each port is connected to the 10-pin header. You could connect LCD display, Rotary Encoder, SD Card Reader, etc. with microcontroller. See my future posts.


3. 5V Power supply
Both AC and DC voltage can be plugged in, because of using rectifier bridge. Input voltage can be connected to 2.5mm power jack connector or screw terminal. Power can be switch on / off by SW1. Power supply voltage is stabilized by common IO 7805. When the power is switch on red LED6 is lighted.

4. 4x LEDs
Four green LEDs can be connected to the Port D shorting jumpers JMP6-9.


5. 4x Buttons
Four buttons are connected to the Port B.


6. Piezo
Piezo speaker can be connected to pin PB1 through JMP5.


7. ADC accessories
The microcontroller has built-in 10bits AD converter. On the board is LC filter for power supply of this ADC. You can use internal or external reference. The rotary trimming resistor R2 is connected to Aref input for playing with the external reference.


8. Potentiometer
For simulation of varying ADC input voltage the rotary trimming resistor R1 can be connected to PC1 (ADC1) through JMP12.


10. Temperature sensors
If you want to play with temperature sensor, you can connect temperature sensor with either analog or PWM output. Temperature sensor with analog output can be connected to the PC0 (ADC0) through JMP10. Temperature sensor with PWM output can be connected to the PB0 through JMP11.


10. RS232 line
Standard serial interface is placed on the board. Level shifter MAX232 is used. MAX232 has two receiver and two transmitter lines. You can connect RXD and TXD of RS232 with RXD and TXD of microcontroller with help of config header. RTS and CTS of RS232 can be connected with PD6 and PD7 through JMP3 and JMP4. See config header part.


11. Config Header
Config header allows interconnect different I/O microcontroller pins with RS232 line or with screw terminal.


12. Srew terminals
Screw terminals allow easily connect wires to microcontroller. Through this terminal you compose for example frequency counter of voltmeter, etc. Ground and 5 Volts are also presented on screw terminal.


13. ISP
Development board includes serial port interface to allow direct in-system programming (ISP). Microcontroller can be programmed trough RS232 serial port by using program Pony Prog or Avrdude (ponyser). To avoid interference with RS232 signals, programmer can be disconnected using analog switches 4066. These switches can be closed manually by SW2 or automatically when the reset is active (using JMP13).


14. Mounting Holes
In each corner of PCB is placed one ø3.2mm mounting hole.





And the result ...


Assembly diagram



Top Side



Bottom Side


LINKS:


Following web side inspired me to build the development board.





You can download this project including whole schematic, assembly diagram and PCB.


Controlling Stepper Motor with a Parallel Port


Controlling Stepper Motor with a Parallel Port Scheme






Controlling Stepper Motor with a Parallel Port Physical


This is an easy to build stepper motor driver that will allow you to precisely control a unipolar stepper motor through your computer's parallel port. With a stepper motor you can build a lot of interesting gadgets such as robots, elevator, PCB drilling mill, camera panning system, automatic fish feeder, etc. If you have never worked with stepper motors before you will surely have a lot of fun with this project.

How Stepper Motor Works?


Stepper motors are very different from a regular DC motors. Instead of spinning like DC motors do, stepper motor steps at a specific resolution for each pulse. The motor that we are using needs 48 steps / pulses just to complete a single revolution! That should be enough to tell about its precision.

Another advantage of stepper motors is the fact that their speed of rotation can be achieved almost instantly even if you change the spinning direction.

Stepper motor consists of a rotor - the permanent magnet that rotates inside, and stator - four coils (north, east, south, west) that are part of the case, and which don't move. Rotor can be moved by sequentially applying a pulsed DC voltage to one or two coils at a time.

Unipolar motor should have five or six connections depending on the model. If the motor has six connections like the one pictured above, you have to join pins 1 and 2 (red) together and connect them to a (+) 12-24V voltage supply. The remaining pins; a1 (yellow), b1 (black), a2 (orange), b2 (brown) should be connected to a driver (ULN2003) as shown on the schematic.

Circuit diagram for CCTV by Solar Panel

Below is the circuit used to power the CCTV camera, provide lighting inside the nestbox, and charge batteries from a PV solar panel.
Circuit diagram for CCTV powered by Solar Panel with Battery Backup


D1 is a Schottky Diode used to prevent battery charge escaping through the solar panel at night. Something like a 1N5817 (1 Amp 20 Volt diode) will do the job and it has a very low voltage drop of under 0.45 Volts. D2 and D3 are ultrabright LEDs used to illuminate the inside of the nestbox. R3 and R4 are resistors chosen (400+ Ohms) to ensure that no more than 30mA of current gets to the sensitive LEDs, with R5 (a 10k variable resistor) used to increase the resistance and therefore dim the LED s if they are too bright.The LM317T is a voltage regulator * used to bring the voltage of the solar panel and batteries down to just over 8 volts using resistors R1 (270 Ohm) and R2 (1500 Ohm) to set this value. K is the wireless CCTV camera. A switch (not labelled) is used to manually turn the camera on and off as required.

Via : reuk.co.uk

Description of the serial programmer:

The programmer is quite simple and it is based on the SI-Prog from the author of PonyProg software. The Zener diodes D2, D3 with the resistors R2, R3 reduce the voltage from the ouput pins DTR, RTS on the serial port to around 5V which is suitable for microcontroller (MOSI, SCK). MISO signal is connected directly to the input CTS pin. The Zener diode D1 with the resistor R1 drive the NPN transistor T1, which controls RESET signal. The AVR microcontrollers are in reset when the signal has low level. The resistor R5 works as a pull-up for reset signal. The resistor R4 helps to close the transistor T1. The programmer has standard 10 pins header.

Schematic of the serial programmer


Assembly diagram


PCB (top side)


PCB (bottom side)


Panelization (When you need more pieces.)


Assembled PCB (top side)


Attention:
The transistor T1 should be in opposite position then is depicted in the assembly diagram.
Please check the position of Base-Colector-Emitor on your transistor.

I use this programmer for programming Attiny13, Attiny26, Attiny2313, Atmega48, Atmega88, Atmega168, Atmega16 and it works very well. I also use the programmer with desktop computer, laptop, with and wihout USB-to-RS232 adapter and it works in all cases.


Using PonnyProg2000:
When you want to program your microcontroller with the PonnyProg2000 you have to setup the program as you can see on the following picture. You have to select chosen COM port, where is connected your programmer.

Ponyprog I/O port setting


Using Avrdude:
When you want to program your microcontroller with Avrdude you have to select the keyword "ponyser" as a programmer type and appropriate COM port. I'm using this method to program my microcontroller directly from the Atmel AVRstudio when I'm debuging my application. I create a batch file with the command for the avrdude and I call the batch file directly from the tool bar. It is very fast and easy. Avrdude is also part of the WinAVR package.

Microcontroler programming by avrdude


Programming header reduction:Sometimes you have to program microcontroller in a aplication where is only 6 pins header instead of 10 pins. I created small adapter for this purpose. The adapter has 10 pins header, 6 pins header and 6 pins header in one line. 6 pins header in line is useful when you want to bring the signals to the breadboard.
Schematic of the programming header reduction


Assembly diagram


PCB (bottom side)


Assembled PCB (top side)


With this equipment you should be able easily program your AVR microcontrollers. Good luck.

SOURCE

AVR PROGRAMMER FOR MICROCONTROLLER




This simple AVR Programmer will allow you to painlessly transfer hex programs to most ATMEL AVR microcontrollers without sacrificing your budget and time. It is more reliable than most other simple AVR programmers available out there and can be built in very short amount of time.

AVR programmer consists of in-circuit serial programmer (dongle) and small pcb with a DIP socket where you can fit your microcontroller and have it quickly programmed.

You may also use this programmer as a stand alone in-circuit serial programmer that can be used to conveniently program AVR microcontrollers without removing them from the target circuit.
Entire AVR programmer has been build with using common parts and fits in the case of the serial connector. The socket pcb has been created to fit a 28-DIP AVR ATmega8 microcontroller, but you can build a socket pcb for any other AVR microcontroller out there. This AVR programmer is compatible with a popular PonyProg software that shows you a status bar of the programming progress.




avr programmer
AVR In-Circuit Serial Programmer




avr programmer schematic



AVR Programmer's PCB (front) with 9-PIN female RS232 serial connector.





AVR Programmer's PCB (back)




Fitting AVR Programmer's PCB in RS232 serial case.



Finished AVR Programmer with standard 6-PIN ICSP connector.


AVR Socket PCB



Socket PCB has very minimal number of components and is used for programming your desired AVR microcontroller outside of your target circuit.



Socket PCB with 28-DIP AVR ATmega8 microcontroller.




There are two connections; ICSP that connects to AVR Programmer, and external +5V supply.



Socket PCB consists of the PCB, 28-DIP socket, 4MHz crystal resonator, or crystal with two 22pF decoupling capacitors, and two header connectors. Two-PIN connector supplies +5V voltage to the AVR microcontroller, and 6-PIN ICSP connects to AVR Programmer dongle.

Supplying microcontroller with external +5V voltage as opposed to taking it directly from computer's serial connection port ensures that the chip is receiving exactly +5V voltage and provides very reliable error free programming.



Socket PCB for 28-DIP AVR ATmega8 microcontroller.

+5V voltage supply for AVR chip may be provided from external power supply or even better - directly from USB connection.