Mechanical TV Project

Forum for discussion of narrow-bandwidth mechanical television

Moderators: Dave Moll, Andrew Davie, Steve Anderson

Re: Mechanical TV Project

Postby Robonz » Tue Aug 21, 2018 9:33 pm

If you want really consistent results, shining this through a hole is pretty unbeatable. Reflective sensors suffer from poor contrast versus through beam. I use this circuit for rock solid sync. I normally use a 4k7 resistor for the phototransistor. You do want a good led and photo transistor for best good results.

Your photo transistor should look "black" e.g. ir pass filter
Attachments
ir_pair.gif
ir_pair.gif (4.21 KiB) Viewed 16845 times
User avatar
Robonz
Evil Genius
 
Posts: 149
Joined: Sat Aug 12, 2017 7:15 pm
Location: New Zealand

Re: Mechanical TV Project

Postby Robonz » Tue Aug 21, 2018 9:45 pm

Now I think about it, I did have some noise issues that I solved really simply. I added a 1000uf capacitor directly across my motor. You can see the write up here. It also adds speed stabiliy too. See this
https://www.taswegian.com/NBTV/forum/viewtopic.php?f=35&t=2465

And you can see how solid my sync pulse is here
https://www.taswegian.com/NBTV/forum/viewtopic.php?f=35&t=2447&start=15#p22589

Cheers
Keith
User avatar
Robonz
Evil Genius
 
Posts: 149
Joined: Sat Aug 12, 2017 7:15 pm
Location: New Zealand

Re: Mechanical TV Project

Postby FlyMario » Tue Aug 21, 2018 10:56 pm

Robonz wrote:Now I think about it, I did have some noise issues that I solved really simply. I added a 1000uf capacitor directly across my motor. You can see the write up here. It also adds speed stabiliy too. See this
https://www.taswegian.com/NBTV/forum/viewtopic.php?f=35&t=2465

And you can see how solid my sync pulse is here
https://www.taswegian.com/NBTV/forum/viewtopic.php?f=35&t=2447&start=15#p22589

Cheers
Keith


Cool! I have solid sync pulses at this time. I have monitored both sync pulses for long period of times. The encoder sync can run at least a minute without showing a bad pulse. The thing is, I know what the number should be. 80,000. If the number is off by say 10% on the encoder wheel, I know to simply toss the results as noise. if the video sync is off by more than 1% then discard it as well. Again both are very rare situations and I think that is pretty good over the analog nature of things.

Unless things change, I won't go back to through hole IR syncs because I am satisfied with my results so far.

The Capacitor over the motor is very interesting to me. I have no notion at all that my motor is generating any noise. The speed Stability though. I wonder how that would work since I am driving the motor over PWM. In my mind that would have to dampen the changes. I must investigate and maybe mount one with alligator clips. Indeed I must.

Thanks Keith!
FlyMario
 

Re: Mechanical TV Project

Postby smeezekitty » Wed Aug 22, 2018 5:47 am

I can confirm that putting a beefy capacitor across the motor helps a lot. I was suffering from MCU resets, load PWM whine and instability. Putting a 4700uF cap across the motor fixed it up. You don't want the response time too be too quick. It is only being adjusted 12.5 times per second anyway and reacting too fast will tend to cause the loop to oscillate.
smeezekitty
Just nod and pretend you understand me
 
Posts: 229
Joined: Fri Jan 29, 2010 11:42 am
Location: USA

Re: Mechanical TV Project

Postby FlyMario » Wed Aug 22, 2018 5:56 am

smeezekitty wrote:I can confirm that putting a beefy capacitor across the motor helps a lot. I was suffering from MCU resets, load PWM whine and instability. Putting a 4700uF cap across the motor fixed it up. You don't want the response time too be too quick. It is only being adjusted 12.5 times per second anyway and reacting too fast will tend to cause the loop to oscillate.


Interesting I have no whine or MCU resets. However I don't see a reason not to put the cap on. Especially if it dampens the changes. I am using a Bench Power supply so it might be taking up most of the work.

I am having a hard time justifying PID because I have a certain range that the motor can stay in to control the speed above or below the desired rpm. The range is very tiny. With a cap, it might take away the need for PID at all. But then, I am not chasing the video sync pulse either.
FlyMario
 

Re: Mechanical TV Project

Postby smeezekitty » Wed Aug 22, 2018 7:00 am

I am having a hard time justifying PID because I have a certain range that the motor can stay in to control the speed above or below the desired rpm. The range is very tiny. With a cap, it might take away the need for PID at all. But then, I am not chasing the video sync pulse either.


I don't quite understand what this means. Any speed difference at all will cause the picture to slowly roll one way or another. That's why we use phase lock instead of frequency lock.
smeezekitty
Just nod and pretend you understand me
 
Posts: 229
Joined: Fri Jan 29, 2010 11:42 am
Location: USA

Re: Mechanical TV Project

Postby Steve Anderson » Wed Aug 22, 2018 3:28 pm

The phototransistor or photodiode should be the black encased one of the two. This is supposed to be a 'daylight filter' keeping the sensor only responsive to IR light - there is a limit though, some daylight may filter through, but I surprised it's responding to normal room lighting. Unless you have an bright incandescent desk lamp nearby, most of the energy is radiated as heat/IR in those.

Steve A.
User avatar
Steve Anderson
"Fester! Don't do that to 'Thing'"
 
Posts: 5360
Joined: Fri Mar 30, 2007 10:54 pm
Location: Bangkok, Thailand

Re: Mechanical TV Project

Postby FlyMario » Thu Aug 23, 2018 1:15 am

Am I supposed to put this Electrolytic Capacitor onto the + and - poles of the motor? I did that and my motor sped up incredibly. My PWM went from 204 (normal) to 20 and I could never get down in speed. I put a 1000uf 35v Cap. I also started having trouble with my ATMEGA328 chip. Still puzzled by that as the motor is connected through a MOSFET and nothing I do to the motor should have affected the MCU.

Any ideas?

Pete
FlyMario
 

Re: Mechanical TV Project

Postby Andrew Davie » Thu Aug 23, 2018 1:23 am

FlyMario wrote:Am I supposed to put this Electrolytic Capacitor onto the + and - poles of the motor? I did that and my motor sped up incredibly. My PWM went from 204 (normal) to 20 and I could never get down in speed. I put a 1000uf 35v Cap. I also started having trouble with my ATMEGA328 chip. Still puzzled by that as the motor is connected through a MOSFET and nothing I do to the motor should have affected the MCU.

Any ideas?

Pete


It's been a while, but I do have some recollection of my motor resetting my Arduino (Micro ATMega32U4) when I was doing PID stuff. I recall that there was some back-current through the motor acting as a dynamo, or something like that. If you read the build log of the Arduino televisor it's buried in there somewhere. I recall it was solved in hardware eventually, but initially I modified my PID so that it wasn't so drastic in on/off behaviour but instead ramping up/down slowly and my guess was that this was reducing noise/spikes. However, I'm pretty sure it was Keith or maybe Steve who told me that this 'solution' was rubbish and we ended up doing something else. It will be well documented in the Arduino Televisor construction logs.
User avatar
Andrew Davie
"Gomez!", "Oh Morticia."
 
Posts: 1590
Joined: Wed Jan 24, 2007 4:42 pm
Location: Queensland, Australia

Re: Mechanical TV Project

Postby Robonz » Thu Aug 23, 2018 8:44 pm

It sounds like the power supply is drooping with the load. You probably should add 1000uf across the 12 volt rail. Maybe the motor capacitor could be reduced to 470uf as well. When I do this stuff I always scope it so I understand the root cause.

I found Andrew's board did this when I demanded too much PWM. Adding 1000uf across the 12V rail fixed this. His code ramped up the pwm slowly at start up which masked the issue nicely.

Cheers
Keith
User avatar
Robonz
Evil Genius
 
Posts: 149
Joined: Sat Aug 12, 2017 7:15 pm
Location: New Zealand

Re: Mechanical TV Project

Postby FlyMario » Thu Aug 23, 2018 11:17 pm

You know, I think I am looking at these numbers way to Grainularly. I had switched from Millis to Micros awhile back thinking this would increase my accuracy. This being analog with motors it is probably too much to expect. I also am not so sure that my reflective encoder wheel is the best option to expect that great of accuracy.

Since there are 80,000 microseconds between each frame, which I can measure. I am finding small variances with each time I report the time between each frame on the encoder wheel. These variances are small to be sure but then I am trying to correct for these no matter how small. For instance, 40 or even 100 microseconds is not even enough to react to... I am displaying the differences ever 50miliseconds (or about). Unless my motor is able to change speed very very quickly, I must be getting some error in my IR circuit. It is, however, not a lot to be worried about I suppose. I may decide to put a black plastic disk on the drive shaft and have a through hole configuration for the IR sensor.

If I switch back to millis, then I suppose I would expect (1000 / 12.5) 80 ticks per frame. God that sounds terrible. Do you guys use Millis? How does that work out for you? Wouldn't that give you the opportunity to be off by nearly 1/3 of a frame?

Last night I worked on trying to chase the Sync. That has more bounce than the Globetrotters. Also worked a bit with PID but not getting answers I believe. I will be looking over the construction diaries over this.

Pete
FlyMario
 

Re: Mechanical TV Project

Postby FlyMario » Fri Aug 24, 2018 12:16 am

Looking over Andrews code from Github I would think he is actually using Milli's in his calculations.

His PID is quite fascinating. It seems that he is willing to bring his disk into sync normally if he is around 1/2 frame out of sync. Otherwise he goes for broke to hurry the process up. I love his implementation of PID.

So much of his code is way out of my league. He is accessing registers and doing some other manipulations.

That being said, He is configuring the PWM which brings me to ask. My PWM for around the right RPM is 204. 203 and 205 can really affect the timing. However, the temperature can alter if 204 is correct really. So through PWM, register settings he is applying, can you make like 200 to 220 like a huge variable set so like... 10 could be 200 and 255 could be 220? Does it work that way? I feel that changing just 1 up or 1 down currently is too much of a change.

Yes I realize that resolution is way too much to expect but I think you get the picture.

Thanks,
Pete
FlyMario
 

Re: Mechanical TV Project

Postby smeezekitty » Fri Aug 24, 2018 4:49 pm

I used micros() myself.

You can increase the resolution of the PWM by reprogramming the top value for TIMER1. Note that there are only two pins this works for.
https://arduino.stackexchange.com/quest ... resolution

With that said, I am just using the stock PWM configuration. Using PID control, the overall variance is quite a bit more than +/-1 PWM value
smeezekitty
Just nod and pretend you understand me
 
Posts: 229
Joined: Fri Jan 29, 2010 11:42 am
Location: USA

Re: Mechanical TV Project

Postby Robonz » Sat Aug 25, 2018 5:28 pm

A couple of notes. Andrew and I have proven that 8 bit pwm is enough to get a very good frame lock, but 10 bit cannot hurt. The inertia of the disc makes the small changes in the pwm insignificant.

If your sync pulse timer is not using an interrupt then it is likely your code needs to be modified. You typically use a timer on interrupt and that will precisely count cpu clock cycles between each sync pulse. Using "micros()" can be bad. e.g. if your code is doing some math which takes many clock cycles then the micros() result will not happen until the math is finished. If you use an interrupt then this will override any code running and jump straight into your timer interrupt where you can read the elapsed time (clock cycles). You also need to ensure that the PID is only run once per sync cycle.

Pete. why don't you attach your code so people can comment on it?

Cheers
Keith
User avatar
Robonz
Evil Genius
 
Posts: 149
Joined: Sat Aug 12, 2017 7:15 pm
Location: New Zealand

Re: Mechanical TV Project

Postby FlyMario » Wed Mar 27, 2019 11:25 pm

[quote="Robonz"]Thinking about this e.g. you want to use a live video feed going in to your ADC and an analog comparator to extract the sync pulse. Your video is live so nothing can be adjusted there which means you need to match the wheel speed to the Sync pulse speed. You also need to pull the wheel position (frame) to match the live sync pulse. Not too hard if you simplify things

I keep looking at this module https://www.amazon.com/gp/product/B01DL ... LMXA&psc=1 which at its heart is an ADS1115 chip. Reading the specs, it seems fast enough to perform ADC on the video signal to pull out the Sync Pulse. Also inside of it is a comparator where you can fire off a pin within a window. Seems like it could be a fun chip for grabbing sync pulses. Though I really also keep thinking to digitize the whole picture / audio signal. Especially the video.

Peter
Peter J. Fischel
Mechanical TV Fan, Programmer and Tinkerer.
FlyMario
Mad Scientist
 
Posts: 73
Joined: Sat Sep 22, 2018 11:34 am

PreviousNext

Return to Mechanical NBTV

Who is online

Users browsing this forum: No registered users and 48 guests

cron