Programmable Servo Tester

Share rangkaian DIY dan buatan Anda disini

Moderators: christoffel, scratcher

User avatar
rachmatjeny
Captain
Captain
Posts: 1670
Joined: 19 Mar 2009, 21:55
Location: Depok
Contact:

Re: Programmable Servo Tester

Post by rachmatjeny »

o iya om...
ini ada masukan sedikit semoga berguna...

lebih enak ngatur servo pake PWM (attini13 adakan?)

http://mil.ufl.edu/~achamber/servoPWMwCodeVision.html

jadi kita lebih leluasa bikin program... delay si servo gak terganggu oleh program2 lain (kalau mau bikin program panjang)

tapi .. anu .. maap
itu pake codevision...
User avatar
coyo
Chief Master Sergeant
Chief Master Sergeant
Posts: 812
Joined: 17 Jan 2007, 17:00
Location: Kota Jababeka, Cikarang
Contact:

Re: Programmable Servo Tester

Post by coyo »

setelah sy coba ternyata hasilnya sama aja Om, delay 15ms pun gak keliatan bedanya.
sy coba pake servo HXT500, HXT900 & HS-325 lancar semua.

ternyata servo suka ngawur dulu gara2 belum pake PCB, masih trial di atas breadboard tua - mungkin kontak2nya ada yg kotor.

Thx link-nya Om, tapi...... ilmu sy belum nyampe euy...... ](*,)
maklum belajar micon baru bbrp minggu, masih perlu belajar lagi nih.....

Sebetulnya dgn ATtiny13 bisa bikin macam2 alat sederhana seperti v-tail mixer, servo slower, dll
cuma sy belum mudheng bahasa C & Assembly
User avatar
didin
Major
Major
Posts: 1793
Joined: 27 Aug 2008, 11:01
Location: Pekanbaru

Re: Programmable Servo Tester

Post by didin »

rachmatjeny wrote:mantap om coyo =D> =D> =D>

btw mau nanya (maap newbe)

kalao list
Pulseout Portb , 0 , B ' Menghasilkan pulsa di PB0 (Pin 5)
Waitms 20 ' tunggu 20 milidetik
maksudnya dia akan hi selama nilai B dan low selama 20ms ya?

berarti total waktu hi+ low nya lebih dari 20ms ya om?
kalo saya baca2 di web (mohon koreksi & mudah2an saya gak salah artikan)

wait 20ms harusnya di bikin rumus wait 20ms-B

dan saya pernah coba di beberapa servo akibatnya terjadi getaran di servo nya
mohom pencerahan om


Newbie lagi....trus saya apa ya...newbiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiieeeeeeeeeeeeeeee
User avatar
didin
Major
Major
Posts: 1793
Joined: 27 Aug 2008, 11:01
Location: Pekanbaru

Re: Programmable Servo Tester

Post by didin »

thoha wrote:maaf newbe juga mau komentar 8-[

untuk frekuensi kayaknya tidak harus persis 50Hz
bisa kurang/lebih dikit
bahkan untuk servo digitak bisa sampai 125Hz
tergantung jenis servonya juga

kalau frek terlalu rendah torsi servo akan banyak berkurang
kalau terlalu tinggi torsi bisa bertambah tapi motor bisa semakin panas




Kok newbie lagi....monggo lanjutkan....menyimak terus nich....minat, tapi jauh dari newbie...
User avatar
coyo
Chief Master Sergeant
Chief Master Sergeant
Posts: 812
Joined: 17 Jan 2007, 17:00
Location: Kota Jababeka, Cikarang
Contact:

Re: Programmable Servo Tester

Post by coyo »

lho? lanjutkan apanya lagi ya? 'kan dah jadi => selesai
User avatar
thoha
Senior Master Sergeant
Senior Master Sergeant
Posts: 694
Joined: 11 Sep 2008, 16:09
Location: Yogyakarta
Contact:

Re: Programmable Servo Tester

Post by thoha »

coyo wrote:lho? lanjutkan apanya lagi ya? 'kan dah jadi => selesai

kalau yg v-tail mixer pake bascom juga ya pak?
User avatar
coyo
Chief Master Sergeant
Chief Master Sergeant
Posts: 812
Joined: 17 Jan 2007, 17:00
Location: Kota Jababeka, Cikarang
Contact:

Re: Programmable Servo Tester

Post by coyo »

Pake Assembly Om, bisa pake AVR Studio
Ini webnya: http://www.gadgetparadise.com/121901/index.htm
User avatar
rachmatjeny
Captain
Captain
Posts: 1670
Joined: 19 Mar 2009, 21:55
Location: Depok
Contact:

Re: Programmable Servo Tester

Post by rachmatjeny »

wah keren webnya om.. =D> =D>

ini saya ada contoh program vtail mix
pengiriman ke servo pakai intrup pwm
tapi pakai atmega8.
output servo harus ke PB1 dan PB2 (OC1A dan OC1B)
input PPM elevator ke PORTD.2 dan D.3

ayo om toha di coba ke quad copternya tinggal copas aja...
udah saya tes kok.. untuk control Vtailnya... tapi belum ke Qcopter.. \:D/ \:D/

mudah2an bisa bermanfaat.

Code: Select all

/*****************************************************
This program was produced by the
CodeWizardAVR V1.25.7 beta 5 Professional
Automatic Program Generator
© Copyright 1998-2007 Pavel Haiduc, HP InfoTech s.r.l.
http://www.hpinfotech.com

Project :
Version :
Date    : 4/28/2010
Author  : F4CG                           
Company : F4CG                           
Comments:


Chip type           : ATmega8
Program type        : Application
Clock frequency     : 11.059200 MHz
Memory model        : Small
External SRAM size  : 0
Data Stack size     : 256
*****************************************************/

#include <mega8.h>
#include <delay.h>
bit st_1;
int servo[2], timer1,timer2,timer;
// Declare your global variables here
// Timer 0 overflow interrupt service routine
interrupt [TIM0_OVF] void timer0_ovf_isr(void)
{
// Place your code here 
timer++;
PORTD.0=~PORTD.0;

}// External Interrupt 0 service routine

interrupt [EXT_INT0] void ext_int0_isr(void)
{



}

// External Interrupt 1 service routine
interrupt [EXT_INT1] void ext_int1_isr(void)
{
// Place your code here
//if (PIND.3)timer=0;
//if (!PIND.3)timer2=timer;
//PORTD.0=~PORTD.0;
}

void main(void)
{           
int i,x,y;
// Declare your local variables here

// Input/Output Ports initialization
// Port B initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=Out Func1=Out Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=0 State1=0 State0=T
PORTB=0x00;
DDRB=0x06;

// Port C initialization
// Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// 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: 1382.400 kHz
TCCR0=0x01;
TCNT0=0x00;

DDRD.0=1;
// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: 1382.400 kHz
// Mode: Ph. & fr. cor. PWM top=ICR1
// OC1A output: Non-Inv.
// OC1B output: Non-Inv.
// 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=0xA0;
TCCR1B=0x12;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;
ICR1=10000;

// 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: On
// INT0 Mode: Any change
// INT1: Off
//GICR|=0x40;
//MCUCR=0x01;
//GIFR=0x40;


// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x01;

// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0x80;
SFIOR=0x00;

#asm("sei")
PORTD.2=1;PORTD.3=1;
DDRD.2=0;DDRD.3=0;
while (1)
      {

//while (PIND.2){;}
while (!PIND.2){;}
timer1=0;
while (PIND.2){timer1++;delay_us(1);}
timer1=timer1;

//while (PIND.3){;}
while (!PIND.3){;}
timer2=0;
while (PIND.3){timer2++;delay_us(1);}
timer2=timer2;
/*
  servo[0] = timer1 + timer2;
  servo[0] = servo[0] /2;  // div 2
  servo[1] = timer1 - timer2;
  servo[1] = servo[1] /2;  // div 2
  servo[1]=1500-servo[1];
*/

 x=timer2;
 y=timer1;
  servo[0]=(x-(1500-1500))+y;
//servo[0]=servo[0]/2;
 servo[1]=((1500)-y)+x;

OCR1A=servo[0];
OCR1B=servo[1];

      };
}
User avatar
iwan21
Administrator
Administrator
Posts: 9769
Joined: 17 Jan 2007, 14:11
Location: Bekasi
Contact:

Re: Programmable Servo Tester

Post by iwan21 »

Mumet.. #-o , utek udah kagak sanggup mikir yg gini2...
User avatar
thoha
Senior Master Sergeant
Senior Master Sergeant
Posts: 694
Joined: 11 Sep 2008, 16:09
Location: Yogyakarta
Contact:

Re: Programmable Servo Tester

Post by thoha »

rachmatjeny wrote:wah keren webnya om.. =D> =D>

ini saya ada contoh program vtail mix
pengiriman ke servo pakai intrup pwm
tapi pakai atmega8.
output servo harus ke PB1 dan PB2 (OC1A dan OC1B)
input PPM elevator ke PORTD.2 dan D.3

ayo om toha di coba ke quad copternya tinggal copas aja...
udah saya tes kok.. untuk control Vtailnya... tapi belum ke Qcopter.. \:D/ \:D/

mudah2an bisa bermanfaat.

Code: Select all

/*****************************************************
This program was produced by the
CodeWizardAVR V1.25.7 beta 5 Professional
Automatic Program Generator
© Copyright 1998-2007 Pavel Haiduc, HP InfoTech s.r.l.
http://www.hpinfotech.com

Project :
Version :
Date    : 4/28/2010
Author  : F4CG                           
Company : F4CG                           
Comments:


Chip type           : ATmega8
Program type        : Application
Clock frequency     : 11.059200 MHz
Memory model        : Small
External SRAM size  : 0
Data Stack size     : 256
*****************************************************/

#include <mega8.h>
#include <delay.h>
bit st_1;
int servo[2], timer1,timer2,timer;
// Declare your global variables here
// Timer 0 overflow interrupt service routine
interrupt [TIM0_OVF] void timer0_ovf_isr(void)
{
// Place your code here 
timer++;
PORTD.0=~PORTD.0;

}// External Interrupt 0 service routine

interrupt [EXT_INT0] void ext_int0_isr(void)
{



}

// External Interrupt 1 service routine
interrupt [EXT_INT1] void ext_int1_isr(void)
{
// Place your code here
//if (PIND.3)timer=0;
//if (!PIND.3)timer2=timer;
//PORTD.0=~PORTD.0;
}

void main(void)
{           
int i,x,y;
// Declare your local variables here

// Input/Output Ports initialization
// Port B initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=Out Func1=Out Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=0 State1=0 State0=T
PORTB=0x00;
DDRB=0x06;

// Port C initialization
// Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// 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: 1382.400 kHz
TCCR0=0x01;
TCNT0=0x00;

DDRD.0=1;
// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: 1382.400 kHz
// Mode: Ph. & fr. cor. PWM top=ICR1
// OC1A output: Non-Inv.
// OC1B output: Non-Inv.
// 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=0xA0;
TCCR1B=0x12;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;
ICR1=10000;

// 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: On
// INT0 Mode: Any change
// INT1: Off
//GICR|=0x40;
//MCUCR=0x01;
//GIFR=0x40;


// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x01;

// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0x80;
SFIOR=0x00;

#asm("sei")
PORTD.2=1;PORTD.3=1;
DDRD.2=0;DDRD.3=0;
while (1)
      {

//while (PIND.2){;}
while (!PIND.2){;}
timer1=0;
while (PIND.2){timer1++;delay_us(1);}
timer1=timer1;

//while (PIND.3){;}
while (!PIND.3){;}
timer2=0;
while (PIND.3){timer2++;delay_us(1);}
timer2=timer2;
/*
  servo[0] = timer1 + timer2;
  servo[0] = servo[0] /2;  // div 2
  servo[1] = timer1 - timer2;
  servo[1] = servo[1] /2;  // div 2
  servo[1]=1500-servo[1];
*/

 x=timer2;
 y=timer1;
  servo[0]=(x-(1500-1500))+y;
//servo[0]=servo[0]/2;
 servo[1]=((1500)-y)+x;

OCR1A=servo[0];
OCR1B=servo[1];

      };
}


wah bagus nih
tapi butuh 4 input (interupt) dan 4 output (PWM)
harus modif lagi nih

harus ganti chip ya pak
Post Reply