From: Jan Panteltje on
On a sunny day (Fri, 5 Mar 2010 19:55:12 -0800 (PST)) it happened Chris
<christopher.maness(a)gmail.com> wrote in
<33f8f59c-4242-428f-8226-d0c6866cefbd(a)a10g2000pri.googlegroups.com>:

>> Something like this will be less then 300$:
>> �ftp://panteltje.com/pub/24_to_60Hz_PLL_img_1847.jpg
>> the way this is supposed to work is:
>> the camera contact produces a short pulse that opens the 4015 6swicth.
>> That samples the 24 Hz and the system will stabilise so the camara pulse =
>is centered
>> around an edge of that 24 Hz waveform.
>> The 4046 runs at 120 Hz, set for exactly 120 Hz with no camera active.
>> The 7490 has a divide by 2 and a divide by 5, and makes 24 Hz and 60 Hz f=
>rom the 120 Hz.
>> Note the loop filter values.
>> This is not your normal PLL system, but my own invention.
>> Before you invest years in learning to program PICs,
>> maybe you could try this first:-)
>> I have not tried it for this, but at a slightly higher frequency with dif=
>ferent dividers
>> for in a data separator,
>> Extremely stable over a wide range.
>> Just a quick sketch too, not checked for errors.
>
>I am interested since I already have the parts. What do you think the
>lock time would be?

Some remarks to that diagram, I forgot a resistor, and the loop filter values are for 500 kHz.

\
------0 \------ R1 10k ----------------- pin9 4046
4016 | |
=== C1 |
| |
------ | +5V
| | R3 1M |
===C2 R2 | R4 100 Ohm
| | | |
----------------------------------| +2.5V
|
R5 100 Ohm
|
///
R1 is 10k
R2 is 2 k
So, looking at the loop filter, for 24 Hz (say 25) versus 500 kHz the values need to be 20000x bigger,
so that makes
C1 20000 x 10 nF = 200 uF
C2 20000 x 1nF = 20 uF

When the circuit starts up, without the camera running, or connected, the voltage divider formed by R3 R4
will cause the VCO input of the 4046 to be at 2.5 V, and it should then run exactly at 120 Hz.


The circuit that you call 'debounce', is not that.

It is a one shot pulse generator, it generates a small positive pulse that opens the 4016 switch momentarily:
+5V
| -- +4.3V
R6 1k | |
| | | | | pulse, length set by C3 R7
------------------0--------------------| |-------------------- -- --------------- -0.7V
| | | | |
| C3 | |
0 | |
\ --- R7 10k
|camera switch / \ |
| --- |
| | |
------------------0--------- /// ///
|
///

This 4016 switch connects C1 to the 24 Hz square wave from the divide by 5 counter 7490.
If the oscillator is slow, it will connect mostly during the high part, +5V, and C1 will charge fast for a moment.
If the oscillator is too fast, it will connect mostly during the low part (0V) and C1 will discharge fast.
This assures very fast lock time (10k in 200 uF).
This system *also* assures that when pulses are 'missing' the PLL does not veer of to all the way to a low frequency,
but stays at the last frequency, slowly moving to its free-running frequency because of R3.

One in lock the phase relationship is like this:

-----
| |
| |
------------- ------- sample pulse to 4016 switch


--------------- --------------
| |
| |
------------------------------------------------------------------------- 24 Hz from divide by 5

-
| |
.............| | ........ 0 charge current in R1 to C1
| |
| |
--
It is an exact phase lock.



>My design is very similar but I need to re design
>the loop filter. I have a large C and small R, but I have seen
>another design that has a a large R and small C. The lock takes
>several seconds tho with the large RC constant. All the wile precious
>film is burning through the camera. If I use a smaller RC constant
>then the jitter becomes unacceptable.
>
>Another big problem is the loop is locking on the wrong frequency on
>the camera. It works fine when I simulate the camera with a
>multivibe, but is locking strangely with the camera. I tried a low
>pass to filter bounces, it changed the lock frequency, but still not
>correct.
>
>The design requires a lock indication so that the operator will know
>when the pilot tone is up to pitch so that the movie can be slated.
>My fullcoat deck takes about 6 or 7 seconds for the fly wheel to get
>up to speed. The pitch is fine on this, but there is bad flutter
>until the flywheel is at speed.

I dunno. maybe you can use that other phase comparator in the 4046 as lock indicator?






>I see that your design incorporates a debounce. I am interested, but
>I am having a little tough time reading the schematic.


Hope the above helps.
In the diagram the C1 can become negative, maybe use 2 caps in opposite direction in series?
None of the components are critical, and I just calculated them using my neural net (brain).
It is a small market, I think, especially these days, with all digital cameras and post processing...
else I could make some for 300$ a piece:-)



> Also, I might
>suggest I higher frequency for the VCO, I found that it was more
>stable at a higher frequency, and no big deal to divide down. Divide
>by 80 in the loop, and divide by 32 on the output.

You can try ;-)
The frequency cap is smaller, and probably has less tolerance, also versus temperature.
But my experienced with the original 4046 and the 74HC4046 are really good any ways,
I always keep some in stock for projects.
Although these day PICs make big inroads :-)
But it is hard to beat an analog PLL in some applications.


>I am friends with a guy that deals with a lot of pros that shoot small
>gauge film, and I might be able to incorporate this with some software
>and a PCM recorder. Right now, I am just trying to get my camera to
>play with my full coat deck.
>
>Chris
>
From: Bitrex on
linnix wrote:
> On Mar 5, 2:29 pm, Spehro Pefhany <speffS...(a)interlogDOTyou.knowwhat>
> wrote:
>> On Fri, 5 Mar 2010 12:32:47 -0800 (PST), Chris
>>
>>
>>
>> <christopher.man...(a)gmail.com> wrote:
>>> On Mar 5, 11:59 am, Jan Panteltje <pNaonStpealm...(a)yahoo.com> wrote:
>>>> On a sunny day (Fri, 5 Mar 2010 11:11:38 -0800 (PST)) it happened Chris
>>>> <christopher.man...(a)gmail.com> wrote in
>>>> <29529065-09fc-4636-9a29-c618cbc16...(a)x1g2000prb.googlegroups.com>:
>>>>> I have posted several threads about converting 24Hz pulses to 60Hz
>>>>> basically a 5/2 ratio. I tried a phase locked loop, it sorta works,
>>>>> but my chip count is getting high, and I am thinking about making more
>>>>> of these and selling them if I can write a computer program to resolve
>>>>> wave sound files.
>>>>> Therefore, since I am not very familiar with micro controllers, I was
>>>>> not planning on using one. However, I remember an engineer friend of
>>>>> mine mentioning the BASIC stamp. I have dabbled in BASIC so, I might
>>>>> approach the problem with this as a solution, especially if I can do
>>>>> it with one or two chips.
>>>>> I would think that I could sample the 24Hz side for one second. Take
>>>>> that number and use it to divide a much higher frequency quartz
>>>>> reference by some large value of N so that I can get it back down to
>>>>> 60Hz. Therefore my lock time would be one second. I can have an easy
>>>>> lock indication and a fairly fast response to any changes in
>>>>> frequency.
>>>>> What do you guys/gals think?
>>>>> Regards,
>>>>> Chris Maness
>>>> Years ago I posted a PIC 50 Hz PLL asm code here.
>>>> Or maybe it was 25 Hz.
>>>> I would not bother with BASIC, likely way too slow, and way too much resources hungry.
>>>> A 1$50 12 pin PIC should do...
>>> What are some models that would be good for that application. I see
>>> some 8 pin models that are only $2. The only problem is that I have
>>> NO clue how to start programming them.
>>> Regards,
>>> Chris
>> Just write code to initialize and make an LED flash at a visible rate.
>> The rest is easy...
>
> Or something like this:
>
> loop()
> {
> // sample 24Hz input
> now = ACSR & (1<<INPUT_BIT_NUMBER); // Analog comparator
> if(now && !before) // rising edge
> {
> // reload 60Hz timer
> TCCR1B = 3; // prescale by 64
> n = 2083; // 8,000,000 / 64 / 60
> TCNT1H = (n<<8)&0xff;
> TCNT1L = (n)&0xff;
> }
> before = now;
> }
>
> On_Timer1_Interrupt()
> {
> // pulse 60Hz output
> }


That looks like avr-gcc, not PIC code! ;) That's one of the things that
sold me on AVR microcontrollers over the PIC - if you want to program
anything less than an 18 series PIC you have to either use assembly or
buy a 3rd party C compiler.
From: linnix on
On Mar 6, 5:01 am, Bitrex <bit...(a)de.lete.earthlink.net> wrote:
> linnix wrote:
> > On Mar 5, 2:29 pm, Spehro Pefhany <speffS...(a)interlogDOTyou.knowwhat>
> > wrote:
> >> On Fri, 5 Mar 2010 12:32:47 -0800 (PST), Chris
>
> >> <christopher.man...(a)gmail.com> wrote:
> >>> On Mar 5, 11:59 am, Jan Panteltje <pNaonStpealm...(a)yahoo.com> wrote:
> >>>> On a sunny day (Fri, 5 Mar 2010 11:11:38 -0800 (PST)) it happened Chris
> >>>> <christopher.man...(a)gmail.com> wrote in
> >>>> <29529065-09fc-4636-9a29-c618cbc16...(a)x1g2000prb.googlegroups.com>:
> >>>>> I have posted several threads about converting 24Hz pulses to 60Hz
> >>>>> basically a 5/2 ratio.  I tried a phase locked loop, it sorta works,
> >>>>> but my chip count is getting high, and I am thinking about making more
> >>>>> of these and selling them if I can write a computer program to resolve
> >>>>> wave sound files.
> >>>>> Therefore, since I am not very familiar with micro controllers, I was
> >>>>> not planning on using one.  However, I remember an engineer friend of
> >>>>> mine mentioning the BASIC stamp.  I have dabbled in BASIC so, I might
> >>>>> approach the problem with this as a solution, especially if I can do
> >>>>> it with one or two chips.
> >>>>> I would think that I could sample the 24Hz side for one second.  Take
> >>>>> that number and use it to divide a  much higher frequency quartz
> >>>>> reference by some large value of N so that I can get it back down to
> >>>>> 60Hz.  Therefore my lock time would be one second.  I can have an easy
> >>>>> lock indication and a fairly fast response to any changes in
> >>>>> frequency.
> >>>>> What do you guys/gals think?
> >>>>> Regards,
> >>>>> Chris Maness
> >>>> Years ago I posted a PIC 50 Hz PLL asm code here.
> >>>> Or maybe it was 25 Hz.
> >>>> I would not bother with BASIC, likely way too slow, and way too much resources hungry.
> >>>> A 1$50 12 pin PIC should do...
> >>> What are some models that would be good for that application.  I see
> >>> some 8 pin models that are only $2.  The only problem is that I have
> >>> NO clue how to start programming them.
> >>> Regards,
> >>> Chris
> >> Just write code to initialize and make an LED flash at a visible rate.
> >> The rest is easy...
>
> > Or something like this:
>
>> ...

>
> That looks like avr-gcc, not PIC code! ;) That's one of the things that
> sold me on AVR microcontrollers over the PIC - if you want to program
> anything less than an 18 series PIC you have to either use assembly or
> buy a 3rd party C compiler.

You missed the point. It's Atmel's Programmable Integrated Circuit
(Atmega8u2) using the Programmable Investigative Gadget (PIG). I am
going to try it out with 3 PIGs. PIG1 generates a 24Hz square wave.
PIG2 up-converts 24Hz to 60Hz. PIG3 monitors both outputs and sends
them to the PC virtual com.

Let's see if they fly.

This is PIG2 with 8 bits timer to pulse the LED and 16 bits timer to
do the 60Hz.

// 8 MHz clock

// Timer 0 - LED on timer
// Timer 1 - 60 Hz output timer

// Interface header
// PD0 PD2 VCC PB0 PB6
// PD1 PD3 GND PD6 PB5

// PD1 = input
// PD3 = output
// PD6 = locked

main()
{
PORTD = (1<<3)|(1<<6);
ACMUX = 0; // Select AIN1
ACSR = (1<<ACBG); // Select bandgap AIN0

while(1)
{
loop();
}
}

wait(int msec)
{
// Timer 0 - 78 counts per msec
TCCR0B = 5; // prescale 1024
TCNT0 = 0
OCR0A = 78 * msec;
while(!(TIFR0 & (1<<OCF0A))// wait
;
}

loop()
{
// Analog comparator sample 24Hz input
now = ACSR & (1<<ACO);
if(now && !before) // rising edge
{
// reload 120Hz timer
TCCR1B = 3; // prescale by 64
n = 1541; // 8,000,000 / 64 / 120
TCNT1H = (0)&0xff;
TCNT1L = (0)&0xff;
OCR1AH = (n<<8)&0xff;
OCR1AL = (n)&0xff;

run = 0;
// enable timer1 interrupt
TIMSK1 = (1<<OCIE1A);

PORTD |= (1<<6); // LED on
wait(5); // 5 msec
PORTD &= ~(1<<6); // LED off
}
before = now;
}

On_Timer1_Interrupt()
{
// toggle 60Hz output bit
PORTD ^= (1<<3);
if(++run < 3)
{
TCNT1H = (0)&0xff;
TCNT1L = (0)&0xff;
OCR1AH = (n<<8)&0xff;
OCR1AL = (n)&0xff;
//re-enable timer1 interrupt
TIMSK1 = (1<<OCIE1A);
}
}

From: Chris on
On Mar 6, 5:02 am, Jan Panteltje <pNaonStpealm...(a)yahoo.com> wrote:
> On a sunny day (Fri, 5 Mar 2010 19:55:12 -0800 (PST)) it happened Chris
> <christopher.man...(a)gmail.com> wrote in
> <33f8f59c-4242-428f-8226-d0c6866ce...(a)a10g2000pri.googlegroups.com>:
>
>
>
> >> Something like this will be less then 300$:
> >>ftp://panteltje.com/pub/24_to_60Hz_PLL_img_1847.jpg
> >> the way this is supposed to work is:
> >> the camera contact produces a short pulse that opens the 4015 6swicth.
> >> That samples the 24 Hz and the system will stabilise so the camara pulse =
> >is centered
> >> around an edge of that 24 Hz waveform.
> >> The 4046 runs at 120 Hz, set for exactly 120 Hz with no camera active.
> >> The 7490 has a divide by 2 and a divide by 5, and makes 24 Hz and 60 Hz f=
> >rom the 120 Hz.
> >> Note the loop filter values.
> >> This is not your normal PLL system, but my own invention.
> >> Before you invest years in learning to program PICs,
> >> maybe you could try this first:-)
> >> I have not tried it for this, but at a slightly higher frequency with dif=
> >ferent dividers
> >> for in a data separator,
> >> Extremely stable over a wide range.
> >> Just a quick sketch too, not checked for errors.
>
> >I am interested since I already have the parts.  What do you think the
> >lock time would be?
>
> Some remarks to that diagram, I forgot a resistor, and the loop filter values are for 500 kHz.
>
>        \                          
> ------0 \------ R1 10k ----------------- pin9 4046
>      4016                  |          |
>                           === C1      |
>                            |          |
>                         ------        |                  +5V
>                        |      |       R3 1M               |
>                       ===C2   R2      |                   R4 100 Ohm
>                        |      |       |                   |
>                         ----------------------------------| +2.5V
>                                                           |
>                                                           R5 100 Ohm
>                                                           |
>                                                          ///
> R1 is 10k
> R2 is 2 k
> So, looking at the loop filter, for 24 Hz (say 25) versus 500 kHz the values need to be 20000x bigger,
> so that makes
> C1 20000 x 10 nF = 200 uF
> C2 20000 x 1nF   = 20 uF
>
> When the circuit starts up, without the camera running, or connected, the voltage divider formed by R3 R4
> will cause the VCO input of the 4046 to be at 2.5 V, and it should then run exactly at 120 Hz.
>
> The circuit that you call 'debounce', is not that.
>
> It is a one shot pulse generator, it generates a small positive pulse that opens the 4016 switch momentarily:
>                              +5V
>                               |                                         --  +4.3V
>                               R6 1k                                    |  |
>                               |          | |                           |  | pulse, length set by C3 R7
>   ------------------0--------------------| |--------------------     --    --------------- -0.7V
>  |                                       | |         |       |
>  |                                           C3      |       |
>  0                                                   |       |
> \                                                   ---      R7 10k
>  |camera switch                                     / \      |
>  |                                                  ---      |
>  |                                                   |       |
>   ------------------0---------                      ///     ///
>                               |
>                              ///
>
> This 4016 switch connects C1 to the 24 Hz square wave from the divide by 5 counter 7490.
> If the oscillator is slow, it will connect mostly during the high part, +5V, and C1 will charge fast for a moment.
> If the oscillator is too fast, it will connect mostly during the low part  (0V) and C1 will discharge fast.
> This assures very fast lock time (10k in 200 uF).
> This system *also* assures that when pulses are 'missing' the PLL does not veer of to all the way to a low frequency,
> but stays at the last frequency, slowly moving to its free-running frequency because of R3.
>
> One in lock the phase relationship is like this:
>
>               -----
>              |     |
>              |     |
> -------------       ------- sample pulse to 4016 switch
>
> ---------------                                                                           --------------
>                |                                                                         |
>                |                                                                         |
>                 ------------------------------------------------------------------------- 24 Hz from divide by 5
>
>              -
>             |  |
> ............|  |   ........ 0     charge current in R1 to C1
>                |  |
>                |  |
>                 --
> It is an exact phase lock.
>
>
>
> >My design is very similar but I need to re design
> >the loop filter.  I have a large C and small R, but I have seen
> >another design that has a a large R and small C.  The lock takes
> >several seconds tho with the large RC constant.  All the wile precious
> >film is burning through the camera.  If I use a smaller RC constant
> >then the jitter becomes unacceptable.
>
> >Another big problem is the loop is locking on the wrong frequency on
> >the camera.  It works fine when I simulate the camera with a
> >multivibe, but is locking strangely with the camera.  I tried a low
> >pass to filter bounces, it changed the lock frequency, but still not
> >correct.
>
> >The design requires a lock indication so that the operator will know
> >when the pilot tone is up to pitch so that the movie can be slated.
> >My fullcoat deck takes about 6 or 7 seconds for the fly wheel to get
> >up to speed.  The pitch is fine on this, but there is bad flutter
> >until the flywheel is at speed.
>
> I dunno. maybe you can use that other phase comparator in the 4046 as lock indicator?
>
> >I see that your design incorporates a debounce.  I am interested, but
> >I am having a little tough time reading the schematic.
>
> Hope the above helps.
> In the diagram the C1 can become negative, maybe use 2 caps in opposite direction in series?
> None of the components are critical, and I just calculated them using my neural net (brain).
> It is a small market, I think, especially these days, with all digital cameras and post processing...
> else I could make some for 300$ a piece:-)
>
> > Also, I might
> >suggest I higher frequency for the VCO, I found that it was more
> >stable at a higher frequency, and no big deal to divide down.  Divide
> >by 80 in the loop, and divide by 32 on the output.
>
> You can try ;-)
> The frequency cap is smaller, and probably has less tolerance, also versus temperature.
> But my experienced with the original 4046 and the 74HC4046 are really good any ways,
> I always keep some in stock for projects.
> Although these day PICs make big inroads :-)
> But it is hard to beat an analog PLL in some applications.
>
> >I am friends with a guy that deals with a lot of pros that shoot small
> >gauge film, and I might be able to incorporate this with some software
> >and a PCM recorder.  Right now, I am just trying to get my camera to
> >play with my full coat deck.
>
> >Chris

@ Jan

I have company today, but I like your design. I have company today,
so I can't ask any questions today. Can you email me directly? My
email on here is good. I tried yours, but it just bounced.

Regards,
Chris Maness
From: JosephKK on
On Fri, 05 Mar 2010 20:30:33 +0000, Tim Watts <tw(a)dionic.net> wrote:

>Chris <christopher.maness(a)gmail.com>
> wibbled on Friday 05 March 2010 19:11
>
>> I have posted several threads about converting 24Hz pulses to 60Hz
>> basically a 5/2 ratio. I tried a phase locked loop, it sorta works,
>> but my chip count is getting high, and I am thinking about making more
>> of these and selling them if I can write a computer program to resolve
>> wave sound files.
>>
>> Therefore, since I am not very familiar with micro controllers, I was
>> not planning on using one. However, I remember an engineer friend of
>> mine mentioning the BASIC stamp. I have dabbled in BASIC so, I might
>> approach the problem with this as a solution, especially if I can do
>> it with one or two chips.
>>
>> I would think that I could sample the 24Hz side for one second. Take
>> that number and use it to divide a much higher frequency quartz
>> reference by some large value of N so that I can get it back down to
>> 60Hz. Therefore my lock time would be one second. I can have an easy
>> lock indication and a fairly fast response to any changes in
>> frequency.
>>
>> What do you guys/gals think?
>>
>> Regards,
>> Chris Maness
>
>Look at the Atmel AVRs (Tiny for smallness or Mega for more
>pins/features/Memory). Cheap, programmable in C or ASM from a variety of
>platforms.
>
>I'm an embedded newbie and I have *no* trouble getting them to dance (in C,
>with which I am familiar), so I reckon anyone could ;->

So just perzactly what kit did you use? Requiring minds want to know.