Re: How to use PWM?

2016-01-21 Thread Raman Gopalan
Dear JB,

> When I plug the data cable into any pin on the entire board the
> servo spins clockwise, even when plugged into PWM0 and (pwm-stop 0)
> being called.

Understand. The servo might be responding that way to the default
level of the pins on the Mizar32. What does your multimeter say for
the level of the pin?

> clockwise, even when plugged into PWM0 and (pwm-stop 0) being called.

OK; We'll get to the PWM itself in just a bit.

> On another point is there a dedicated ground pin?

Sure; I've used it long ago but I can't remember exactly which pin in
the JTAG connector; But I can tell you how to find it. Put your
multimeter in beeper mode (it beeps when the circuit is closed and
keeps quiet when there's no connection). Put one of the probes of your
multimeter on the GND of your voltage regulator.

Well, I can tell you that the GND on the voltage regulator should the
the pin in the middle. The other probe touches the pins at the 4
corners of your JTAG connector (the left most pin in the bottom row;
The one closer to the SD card is the one if I can remember
correctly). One of the combinations will trigger a beep; And you'll
find your GND pin.

> I plugged the PWM0 port into an oscilloscope and it was littered
> with static, according to my electrical engineering tutor there is a
> bad ground and I need to earth it.

Have you tried this [1] example? Can you please check if you can
reproduce this example with an LED OR even better, remove the LED and
put the probes of the oscilloscope there. You should see the
waveform. We can then workout your specific example. We first make
sure your connections are OK.

> Another another point, my LCD display still doesn't work and I don't
> know what to do about it.

I'll get back to you on the LCD.

R

References:
[1]:
https://github.com/simplemachines-italy/examples/blob/master/pwmled/pwm-led.l

On 19 January 2016 at 21:02, J B  wrote:

> I'm trying to use the PWM module to control a parallax servo I purchased.
> I'm trying to get it to spin both ways as I need it for a project, I have
> tried to spin the servo both clockwise and anti clockwise but I do not know
> how to set a 20ms gap between each pulse, I need 1.7ms to go anti clockwise
> with a 20ms gap and 1.3ms with a 20ms gap to spin clockwise. I've converted
> the ms into frequency but it doesn't change the direction. When I plug the
> data cable into any pin on the entire board the servo spins clockwise, even
> when plugged into PWM0 and (pwm-stop 0) being called.
>
> On another point is there a dedicated ground pin? I plugged the PWM0 port
> into an oscilloscope and it was littered with static, according to my
> electrical engineering tutor there is a bad ground and I need to earth it.
>
> Another another point, my LCD display still doesn't work and I don't know
> what to do about it.
>
> The attachment is a datasheet for the servo I bought.
> Thanks.
>


Re: How to use PWM?

2016-01-21 Thread Jake
Thanks John, I had to wiggle the % around. I think I ended up with 10 
and 3, but it spins the same speed both ways. Thanks :)


On 19/01/16 19:18, John Duncan wrote:
You have a cycle that is 21.7ms (t) in length, with 1.7ms on and 20ms 
off. The frequency is 1/t or 46Hz. The duty cycle is the amount of 
time on divided by the length of the cycle, 1.7/21.7 or 8%. I'm 
rounding to the nearest integers.


On Tue, Jan 19, 2016 at 1:53 PM, Jake > wrote:


I can't test those numbers as I don't have a power supply at home.
I'm curious how your work out hte duty cycle as a percentage?
Thanks.

On 19/01/16 18:32, John Duncan wrote:

Just a guess, you probably need to consider the whole 21.7ms or
21.3ms to be your period (46Hz or 47Hz) and then your duty cycle
will be 8% or 6% respectively.

On Tue, Jan 19, 2016 at 10:32 AM, J B > wrote:

I'm trying to use the PWM module to control a parallax servo
I purchased. I'm trying to get it to spin both ways as I need
it for a project, I have tried to spin the servo both
clockwise and anti clockwise but I do not know how to set a
20ms gap between each pulse, I need 1.7ms to go anti
clockwise with a 20ms gap and 1.3ms with a 20ms gap to spin
clockwise. I've converted the ms into frequency but it
doesn't change the direction. When I plug the data cable into
any pin on the entire board the servo spins clockwise, even
when plugged into PWM0 and (pwm-stop 0) being called.

On another point is there a dedicated ground pin? I plugged
the PWM0 port into an oscilloscope and it was littered with
static, according to my electrical engineering tutor there is
a bad ground and I need to earth it.

Another another point, my LCD display still doesn't work and
I don't know what to do about it.

The attachment is a datasheet for the servo I bought.
Thanks.




-- 
John Duncan





--
John Duncan




Re: How to use PWM?

2016-01-21 Thread John Duncan
Glad I could help

On Thu, Jan 21, 2016 at 12:42 PM, Jake  wrote:

> Thanks John, I had to wiggle the % around. I think I ended up with 10 and
> 3, but it spins the same speed both ways. Thanks :)
>
> On 19/01/16 19:18, John Duncan wrote:
>
> You have a cycle that is 21.7ms (t) in length, with 1.7ms on and 20ms off.
> The frequency is 1/t or 46Hz. The duty cycle is the amount of time on
> divided by the length of the cycle, 1.7/21.7 or 8%. I'm rounding to the
> nearest integers.
>
> On Tue, Jan 19, 2016 at 1:53 PM, Jake  wrote:
>
>> I can't test those numbers as I don't have a power supply at home. I'm
>> curious how your work out hte duty cycle as a percentage?
>> Thanks.
>>
>> On 19/01/16 18:32, John Duncan wrote:
>>
>> Just a guess, you probably need to consider the whole 21.7ms or 21.3ms to
>> be your period (46Hz or 47Hz) and then your duty cycle will be 8% or 6%
>> respectively.
>>
>> On Tue, Jan 19, 2016 at 10:32 AM, J B < 
>> k1llfre...@hotmail.co.uk> wrote:
>>
>>> I'm trying to use the PWM module to control a parallax servo I
>>> purchased. I'm trying to get it to spin both ways as I need it for a
>>> project, I have tried to spin the servo both clockwise and anti clockwise
>>> but I do not know how to set a 20ms gap between each pulse, I need 1.7ms to
>>> go anti clockwise with a 20ms gap and 1.3ms with a 20ms gap to spin
>>> clockwise. I've converted the ms into frequency but it doesn't change the
>>> direction. When I plug the data cable into any pin on the entire board the
>>> servo spins clockwise, even when plugged into PWM0 and (pwm-stop 0) being
>>> called.
>>>
>>> On another point is there a dedicated ground pin? I plugged the PWM0
>>> port into an oscilloscope and it was littered with static, according to my
>>> electrical engineering tutor there is a bad ground and I need to earth it.
>>>
>>> Another another point, my LCD display still doesn't work and I don't
>>> know what to do about it.
>>>
>>> The attachment is a datasheet for the servo I bought.
>>> Thanks.
>>>
>>
>>
>>
>> --
>> John Duncan
>>
>>
>>
>
>
> --
> John Duncan
>
>
>


-- 
John Duncan


Re: How to use PWM?

2016-01-19 Thread John Duncan
You have a cycle that is 21.7ms (t) in length, with 1.7ms on and 20ms off.
The frequency is 1/t or 46Hz. The duty cycle is the amount of time on
divided by the length of the cycle, 1.7/21.7 or 8%. I'm rounding to the
nearest integers.

On Tue, Jan 19, 2016 at 1:53 PM, Jake  wrote:

> I can't test those numbers as I don't have a power supply at home. I'm
> curious how your work out hte duty cycle as a percentage?
> Thanks.
>
> On 19/01/16 18:32, John Duncan wrote:
>
> Just a guess, you probably need to consider the whole 21.7ms or 21.3ms to
> be your period (46Hz or 47Hz) and then your duty cycle will be 8% or 6%
> respectively.
>
> On Tue, Jan 19, 2016 at 10:32 AM, J B  wrote:
>
>> I'm trying to use the PWM module to control a parallax servo I purchased.
>> I'm trying to get it to spin both ways as I need it for a project, I have
>> tried to spin the servo both clockwise and anti clockwise but I do not know
>> how to set a 20ms gap between each pulse, I need 1.7ms to go anti clockwise
>> with a 20ms gap and 1.3ms with a 20ms gap to spin clockwise. I've converted
>> the ms into frequency but it doesn't change the direction. When I plug the
>> data cable into any pin on the entire board the servo spins clockwise, even
>> when plugged into PWM0 and (pwm-stop 0) being called.
>>
>> On another point is there a dedicated ground pin? I plugged the PWM0 port
>> into an oscilloscope and it was littered with static, according to my
>> electrical engineering tutor there is a bad ground and I need to earth it.
>>
>> Another another point, my LCD display still doesn't work and I don't know
>> what to do about it.
>>
>> The attachment is a datasheet for the servo I bought.
>> Thanks.
>>
>
>
>
> --
> John Duncan
>
>
>


-- 
John Duncan


Re: How to use PWM?

2016-01-19 Thread Jake
I can't test those numbers as I don't have a power supply at home. I'm 
curious how your work out hte duty cycle as a percentage?

Thanks.
On 19/01/16 18:32, John Duncan wrote:
Just a guess, you probably need to consider the whole 21.7ms or 21.3ms 
to be your period (46Hz or 47Hz) and then your duty cycle will be 8% 
or 6% respectively.


On Tue, Jan 19, 2016 at 10:32 AM, J B > wrote:


I'm trying to use the PWM module to control a parallax servo I
purchased. I'm trying to get it to spin both ways as I need it for
a project, I have tried to spin the servo both clockwise and anti
clockwise but I do not know how to set a 20ms gap between each
pulse, I need 1.7ms to go anti clockwise with a 20ms gap and 1.3ms
with a 20ms gap to spin clockwise. I've converted the ms into
frequency but it doesn't change the direction. When I plug the
data cable into any pin on the entire board the servo spins
clockwise, even when plugged into PWM0 and (pwm-stop 0) being called.

On another point is there a dedicated ground pin? I plugged the
PWM0 port into an oscilloscope and it was littered with static,
according to my electrical engineering tutor there is a bad ground
and I need to earth it.

Another another point, my LCD display still doesn't work and I
don't know what to do about it.

The attachment is a datasheet for the servo I bought.
Thanks.




--
John Duncan