Society of Robots - Robot Forum
Electronics => Electronics => Topic started by: offy on April 12, 2009, 08:36:58 AM
-
I ran out of PWM ports and need to add 1 more servo, can I put it in a port without PWM, and if I do what could happen to my MCU and servo.
-
nothing bad will happen to your mcu if you put a servo on a non-pwm port man! what mcu?
-
Roboduino is the MCU
-
man, look at the $50 robot, it uses non-pwm ports and it hasn't screwed anyone yet.
-
yea ofcourse... for one of my bots i used a PIC microcontroller to run 3 servo motors using general purpose I/O pins. i tried the PWM module of the PIC but it had noise in the output and the servo had lots of twitches in its movement. so i scraped the idea and used the GPIO.
All you have to do is, write a code to create a software delat to give a high on the pin for some time and switch it off for the rest of the time. this is PWM. The servo would happily consider this as the control signal and work!
BEAMer
-
all pwm is is a PULSE WIDTH that is modulated eh? eg. you send a pulse and wait 1.5ms for center etc...
-
Hi,
all pwm is is a PULSE WIDTH that is modulated eh?
And exactly how do you modulate a width?? ;)
eg. you send a pulse and wait 1.5ms for center etc...
No, You send a pulse that IS 1.5 ms wide (for center position), then wait for around 17..18 ms before repeating the stunt.
-
Hi,
all pwm is is a PULSE WIDTH that is modulated eh?
And exactly how do you modulate a width?? ;)
dammit! well i was close enough!
-
SoftwareServo does not care about if the port is PWM or not. Heck, if you set the analog in pins to output you could use those too.
-
Hi,
all pwm is is a PULSE WIDTH that is modulated eh?
And exactly how do you modulate a width?? ;)
eg. you send a pulse and wait 1.5ms for center etc...
No, You send a pulse that IS 1.5 ms wide (for center position), then wait for around 17..18 ms before repeating the stunt.
Look in the $50 robot sor_utils.h
It says
void servo_left(signed long int speed)
{
PORT_ON(PORTD, 0);
delay_cycles(speed);
PORT_OFF(PORTD, 0);//keep off
delay_cycles(200);
}
It's saying turn on portd wait for 1ms to 2ms turn portd off. Then wait around 9ms and do it again. You specify the 1-2ms delay to choose the position of the servo. Write a similair function to this and you'll be good.
-
Hi,
Look in the $50 robot sor_utils.h
It says
void servo_left(signed long int speed)
{
PORT_ON(PORTD, 0);
delay_cycles(speed);
PORT_OFF(PORTD, 0);//keep off
delay_cycles(200);
}
It's saying turn on portd wait for 1ms to 2ms turn portd off. Then wait around 9ms and do it again. You specify the 1-2ms delay to choose the position of the servo. Write a similair function to this and you'll be good.
Thanks for the info, but I don't really need it (I played with micros, servos and lots of other stuff back when you were probably just a glimpse in your fathers eye, or even long before he had such thoughts ;) and build a "personal" complete computer in the mid seventies when the Z80 was all the rage and the big liberator)
I was merely pointing out that you cannot modulate a "width", that expression doesn't make sense at all and in electronics, as well as in all other technical science, you have to be precise in your statements.
BTW. A cycle time of 10ms might easily be too short for some servos, the specified nominal cycle time of the R/C protocol is 50Hz/20ms (not 60Hz like you might read somewhere around the net).
-
Thanks for the info, but I don't really need it (I played with micros, servos and lots of other stuff back when you were probably just a glimpse in your fathers eye, or even long before he had such thoughts
Wow, a little rude.
was merely pointing out that you cannot modulate a "width", that expression doesn't make sense at all and in electronics, as well as in all other technical science, you have to be precise in your statements.
I didn't use the word width in my reply at all, although that is the name of this technique, I don't know why, because as you said that expression doesn't make any sense.
BTW. A cycle time of 10ms might easily be too short for some servos, the specified nominal cycle time of the R/C protocol is 50Hz/20ms (not 60Hz like you might read somewhere around the net).
All I'm saying is that's what was used in the $50 robot.
-
Hi,
Wow, a little rude.
Never ment to, just gave you a backgrounder on why I don't really needed your (rude?) lecture on PWM.
I didn't use the word width in my reply at all, although that is the name of this technique, I don't know why, because as you said that expression doesn't make any sense.
You used a quote which did, which means that it was what your reply was founded in.
The reason for the name is not to modulate a width, but that the (variation of the) pulse width is the modulation.
-
If you're really stuck, you can use audio to control a servo
-
hes not really stuck, like 8 spare ports for him to use, and how the hell do you do that?
-
hes not really stuck, like 8 spare ports for him to use, and how the hell do you do that?
Well I've been experimenting, and haven't exactly perfected it, but you generate a square wave at the required frequency. My physics is rusty (been years since I studied audio production) most signal generators create a symetrical waveform (eg a 100Hz wave will be positive for .0005 seconds and negative for the same time. If the pause between peaks is important (I know very little about servos) then you'll need to make an asymetrical waveform for precise control (due to lack of effort, I've only made the servo spin, I haven't tried to work out any precise controls yet)
I remember I had a graphical sequencing program where you could draw the waveform you wanted to use, you could probably also use C sound to generate the waveforms.
Essentially what you're doing both ways is exactly the same, if you want an interresting experiment, try hooking your servo outputs to an amplifier and speaker (make sure it's at a low level, square waves can do a lot of damage to speakers, and your ears) I think it would produce some interresting stereo experiences on the $50 robot,
But with the audio controlling method, you could plug into a DX7 and Rick Wakeman your heart out
----
come to think of it, you could go the other way round and use the normal outputs as a basic sound generator, if you can oscillate them off and on fast enough. Hook your 8 D outputs up to a speaker (well, probably to an amplifier first...I have no idea how much current would flow through them) and you could have your little chip making 3 bit sounds (expect pain), probably wouldn't be too hard to make it output a wave file...might try it as soon as I can get my programmer to work
-
by dx7 do you mean jackson DX7? ive been wanting to get my hands on one of those sweet babies for ever now!
-
by dx7 do you mean jackson DX7? ive been wanting to get my hands on one of those sweet babies for ever now!
That's a guitar right? I guess you could if you get guitar to MIDI device...hmm, could be good, would be good to watch at least
I was referring to the legendary Yamaha DX7 keyboard, though I'm not sure if Rick Wakeman's ever played one
-
Hahaha, I just get a mental picture of SmAsH trying control a 'bot by a hefty guitar solo.
The big question now is... Would a 12-string be able to control more servos than a regular model? ;D
-
its a 7 string! and maybe you could make one tune into a certain freq range? so like on only follows low g another e, a, d, g, b, e etc...