# Homework Help: Graphing a digit oscillating signal

1. Oct 20, 2005

### Mr. Hiyasaki

How would I go about graphing a digtal oscillating signal? I don't quite understand what a pulse width is, or rather how to find it given only the oscillation in Hz and a duty cycle. I understand that the duty cycle is the ratio of the pulse width over the total period, but i don't understand what the pulse width or the period is for a digital signal.

2. Oct 20, 2005

### Diane_

I'm not sure I fully understand the question. One could view a square wave as a "digital oscillating signal", and surely there's no problem with graphing that? The pulse width in that case would simply be the width of one of the "peaks".

What kind of signal are you dealing with? And, while this may seem an odd question, why are you graphing it? Wouldn't an oscilloscope be an easier way to handle it?

3. Oct 20, 2005

### Jelfish

I'll try to help you, but I should start by saying that I've only encountered this is programming a servo motor, so I'm not sure if what I'm about to say will help you much.

A servo motor is a motor that works by taking a digital oscillating signal and translating that into a certain angle. This can be useful for, say, programing a robotic arm - something that needs a motor with angular position control rather than speed control.

So when I had to program my chip to control the servo motor, I needed to make it send a digital oscillating signal. The servo motor read in a certain frequency. My chip will send a signal for a while and then start over. I want the time that my chip starts over to be the same as the period (1/frequency). Now that I have the frequency, the thing that tells the motor how much to turn is determined by how long during each period that signal is high. This is called the duty or pulse width. For example, say if I were to keep the signal low all the time, the servo motor would be at 0 degrees. But if I tell the chip to make that signal high during the first half of each period (so the signal would be high-low-high-low etc in equal increments), then the motor would turn 180 degrees. Since the amount of time that I leave the signal high is dependant on the period (half the period for 180 degrees, maybe 3/4 of a period for 270 degrees) we talk about duty cycles in terms of the percent of the whole period.

Here's a site that might help.
http://www.seattlerobotics.org/encoder/apr98/68hc12pwm.html

4. Oct 20, 2005

### Mr. Hiyasaki

for example:
Simulate the digital signal in microsoft excel:
the signal oscillates at 100 hz and alternates between 0 and 5 volts with a duty cycle of 50%

I have no idea why I have to do these sorts of graphs to be quite honest. I was given a lab where I had to construct a Pulse Width Modulation motor speed control. It involved measuring resistance and speed of the robot, then at the end they throw in a couple of random questions asking us to graph a bunch of these signals in excel. I guess it sort of relates because that is how the pwm works, but it wasn't something that was covered. There is no useful book for the class, so I have been searching for the past few days trying to figure this out.

[EDIT:]
I think I am figuring it out. For that example a 100 Hz frequency gives me a period of 10 ms, and a pulse width of 5ms since my duty cycle is 50%. My high being 5 volts and my low being 0 volts.