Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

looking for servo controller circuit diagram using switch ?

Status
Not open for further replies.

calico

New Member
I 'm not an electrical person but my project need this.
i have hobby servo and I need to use it for closing and open a"door" using only 1 push botton.
I found many circuite board using 555 and PIC, but I prefer 555 but I can;t found the one which using 1 push botton switch.

all I need is if I push the botton once the servo will rotate to the right at certain degree, and when I push again the servo will rotate to the left at certain degree.


can somebody point me the schematic diagram ? it should be here somewhere, but my language is not good enough to "google"

please... I appriciate your help

regards
rud
 
I was trying to search keywords "servo toggle button",not a thing I feel that would match.However I have a clue for you.With the push buttom you can't use a single 555 to do that,while with a 2 way switch it's fine.

If you insist using that push button,a flip-flop needs to be added to reverse servo states as you push it.and you need to filter the noise it caused.

BTW,I have something in hand which works exactly as you described.It's my CD-ROM hatch opener.The hatch comes with the case of my computer and the room for the CD-ROM is empty.I built something else inside and used a servo to open or close the hatch as I push the button in the font.

It is a simple circuit with only a 8 pin ATtiny15L and a couple of resistors.
**broken link removed**a picture of it.And **broken link removed**'s a webpage for it(hope it will open),don't bother reading the text.Just check the pictures and the video.

The system always powers on with the servo restored to an initial position.When you press the button it turns to the other position.Press the but again it turns back.

The scheme is simple and I will try to draw it asap.The code is also simple.Anyway you don't even to read the code because I have the HEX file here.Solder the circuit,get an ISP programmer and download the file into the chip,there you go!

Whether you want it or not,I will prepare it for you.
 
Here it is.Look at the attachments below.There are more resistors and a transistor in the picture from the link.They were built to light the LED supporting my ISP programmer.You can ignore them.

Here's my source code for the AVR,and down there,I already had the HEX file uploaded.Use AVR Studio to compile the code if you want.

Code:
	.include"tn15def.inc"
	;PB4 is the switch input pin
	.org $0000
	rjmp	RESET
	.org $000A
RESET:	ldi	r16,$10
	out	portb,r16		;PB4 internal pull-up
	ldi	r16,$02
	out	ddrb,r16		;PortB:mostly input with pull-ups,PB1:PWM output
	;---------
	ldi	r16,$FD
	out	TCCR1,r16		;Clr when T1>OCR1B,PWM ena,positive output,1/256 prescale
	ldi	r16,$7D
	out	OCR1B,r16		;PWM frequency 50Hz
	ldi	r17,$75
	ldi	r16,$7A			;72-7A range(resolution not really good)
	out	OCR1A,r17		;PWM positive duration 2ms
	;---------
LOOP:	sbis	pinb,4
	rjmp	KYEVT
	rjmp	LOOP
KYEVT:	rcall	DELAY
	sbic	pinb,4
	rjmp	LOOP
	in	r18,OCR1A
	cpse	r18,r16
	rjmp	LOWER
	out	OCR1A,R17
	rcall	WAIT
CHKH:	sbic	pinb,4
	rjmp	LOOP
	rjmp	CHKH
LOWER:	out	OCR1A,r16
	rcall	WAIT
CHKL:	sbic	pinb,4
	rjmp	LOOP
	rjmp	CHKL
DELAY:	ldi	r19,$38
D1:	ldi	r20,$9F
D2:	dec	r20
	tst	r20
	brne	D2
	dec	r19
	tst	r19
	brne	D1
	ret
WAIT:	ldi	r19,$FF
W1:	ldi	r20,$FF
W2:	dec	r20
	tst	r20
	brne	W2
	dec	r19
	tst	r19
	brne	W1
	ret
 

Attachments

  • sch_195.gif
    sch_195.gif
    14.9 KB · Views: 1,179
  • servo.zip
    271 bytes · Views: 254
For one thing, if you don't get the answer you liked in one forum, doesn't mean post it again in another forum. Otherwise I was going to suggest what Nigel hinted at in your original thread and what the above poster did. A simple 8pin microcontroller, a power regulator, a button, and some simple passives are all you need if you manage to jump the hurdle of microcontroller programming.

If you get through the learning curve, which is not extensive, it will give you lots of possibilities for future projects as well.

Alex: Shouldn't you have a pullup on that button? It seems to be just floating there.
 
alex,
thank you for the help.
ok that looks simpler but I don;'t think I can find a programmer around here.

my problem is to "burn that code"
ok, can you put on the list what hardwares and softwares I need to do this ?
I meant to "burn the code to microchip" ?

secondly this is getting complecated when I ask you the steps of how to do the burn.

for soldering and the component I think I can manage it w no problem.

btw I don;t see any video on the site

regards
ruddy
 
alex,
now I see the video, the link works.
yes that CD drive is excaly what I need.
yes the video is exacly what I need, finally somebody knows what I want.

I will go looking for a programmer and ask them how to "burn", hopefully i can find one here .

I will buy the components right now !

you don;t know how much I appriciate this.

regards
rud
 
calico,Here in Harbin,China,I can buy a micro-controller in a company and have it burnt right there for free.Those guys sell components,programmers,developement kits,evaluation boards and take orders of designing brand new products.They say they can program chips free of charge for you as long as the chips come from them.

Download my HEX,and take it along with you in a portable storage device when you go for the chip.Pick a retailer who also sells programmers to by your ATtiny15L.And then convince the guy to burn the chip for you.Even if he insists charging you a little,it's better than buying a programmer for yourself.

*Note,AVR microcontrollers have "lock bits"and"fuse bits" inside.My application doesn't need any modification to these bits.Make sure these bits are kept unchanged.Improper settings will disable the accessibility of the microcontroller permanently,and waste a good reprogrammable chip.If you can't be sure that the programmer in hand leaves the settings alone,either read them out first or set them as shown below,then write them back.("clear" means the bit=0)
 

Attachments

  • bits.jpg
    bits.jpg
    13.5 KB · Views: 880
Alex,
I just come back from electronic shops, took me 2 hours to search the ATtiny15L.

I Can not find it here !
what they have is ATmega 8535 and this one cost US$50. very expensive?

lucky for you, you are in china.

I'm stuck now. how about the dual 555 ?

regards
rud
 
If you added your location to your profile it would be easier, but:

$2.24 USD for the PDIP version.

www.digikey.com
https://www.digikey.com/scripts/DkSearch/dksus.dll?Detail?Ref=10606&Row=116784&Site=US

You'll need to get a programmer. Alex seems to have it pretty good with a place that will program them as well as sell them, but I wouldn't count on finding a place like that. Sounds like a money losing proposition on a $2.00 part.

If you want to learn about the Atmel one used above, and what it takes to program it, check out avrfreaks.net You could use the PIC line as well, check the tutorials listed in the sticky at the top of this forum. You could also use the Z8 Encore, which I recommend, but nobody ever actually does, and I think I'm going to cry soon about it.
 
:shock: with this lack of option you may have to turn to PIC or analogue circuits.I'm sorry,in this case I can't help you because I'm in the middle of something,and can't spare any time to design a new circuit.You need to have the circuit designed somehow.I can offer you no more than some clue-search for "555 design".It's the name of a software that helps calculating parameters of basic 555 based circuits.You need a square wave with 20ms cycle and 0.5 to 1.5ms variable high period.Which are determined by a couple of resistors.
And search for "lip-flop".Use your imagination.Control the resistance or whatever needed to generate the square wave with the flip-flop.Change the high level period with the cycle unaffected.
 
Hi DirtyLude,heard there's snowstorm in Canada.Tough whether outta there huh?Hope everything is fine indoors.

The price of tiny15L in the site you gave makes sense.I think $50 for a 90S8535 is highway robbery.By the way I've heard 8535 has ceased production.

calico,if you don't expect entering the electronics field,maybe you can find a local guy to design a circuit for you.Pay him to get a dedicated controller.Try your best to talk down the price.It's inappropriate to go too far in here in search of a dedicated circuit.This forum is built to help people who would like to learn about electronics,and teach them neccessary abilities to design circuits independently.You can't expect someone here to design the entire stuff for you.
 
Alex,
thank you for the long reply, of course I can't ask someone to do my problem, and you already give me the solution i wanted.

i'm in Indonesia btw, i did not put on my profile because I need this project done fast.

I don;t mind getting the program module to write the chip as long as cost me less than US$50

avrfreaks is a nice place, I just found it yesterday, damn that design you give me is the size i want. very small since my project is for the car DIN size.

may be I can buy the chip in singapore, i think they sell it.

the tiny chip is cheap, less than US$3, the shipping is US$ 18.
yeah right....

calico
 
calico, if you decide to order the chip online,you can try asking the sender to burn it for you before shipping.If he agrees then you can send him an Email with my HEX file and the fuse settings required.

One thing I have to let you know is that this PWM servo control implementation MIGHT SLIGHTLY exceed the servo travel.Though the possibility is extremely low.If it ever happens,replace the servo with one of different type.Or try to get a programmer.Modify these two lines
Code:
   ldi   r17,$75         ;initial servo location 
   ldi   r16,$7A         ;75-7A range(resolution not really good)
of the code I posted above.Then content of r17 and r16 determine the two positions of the servo arm.Try to adjust the numbers to get your best angle.
 
alex,
I think that's the question I would ask you .. how if the movement is not match to what I want after ... say "programmed/burn" in the shop I bought in Singapore or somewhere ?

anyway... let me understand the sites you just give me, looks much better and much cheaper... but let me read as much as I can understand :)

ruddy
 
alex,
corrct me if I'm wrong.
with ponyprog (software) I can get it for free right ?
with SI-prog BASE Board, I can build it my self right ?
but the AVRat90sxx adapter I can not build it my self becaus ethe chip required to programmed right ?
but I don;t think I can get the component locally, i prefer order the kit.

if I get this SI-prog (base and avr board) and Pony prog I can do your design and programmed into it my self.
I wonder how much it cost.

interesting
regards
ruddy
 
Due to an incoming new version of SI-prog with USB and more features, we decided to stop production of this item.

this means I can;t get it now.

rud
 
It seems a lot of work if you don't already have access to programming micro-controllers? (although it's a good thing to be learning!). Why noy use a simple 555 design - there's plenty of examples available.

A few seconds on the net found this **broken link removed**, which you could easily use for your project - just have two pots feeding the input, and switch between them with a toggle switch! (this will give you individual control of both positions).
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top