2 of 3
2
first atempt to sync ps3 eye and pulsed LEDs with full tutrial for circuit building
Posted: 13 May 2010 03:19 PM   [ Ignore ]   [ # 16 ]
Avatar
RankRankRank
Joined  2008-11-22
Total Posts:  493
Sr. Member

Thanks all you guys.
At first i should say that I’m not much familiar with professional electronics. I just want to try to learn with doing such this project (it’s not a real project actually) and help community to upgrade. i wanted to edit the first post but I thought that maybe it can help the way we are discussing.
Well, since two days ago I collected and read lots of information that I didn’t know them at all and I need to learn more and time to understand. Now I know that I have done lots of mistakes and I’m very thankful of you about your helps.
@ toucheur : the reason I used PWM was to control the pulse duration and make it constant. I thought that if I let the LEDs to be triggered with respect to vsync signal timing, with an accidental FPS drop maybe they will be overloaded and be damaged, so I decided to use constant pulse duration. I didn’t know about “monolithic high power PWM drivers” but I will check them. thank you for the link
About latest images, before I test it with infrared LED I used a colored led and I saw blinking of the LED with my eyes in direct connection and a constant glow in inverted (using simple 7404 chip) connection. Then I used an infrared LED to take picture with ps3 eye test app. and one more thing, unfortunately sfh485p was the only good LED I have found in my country.
Why we shouldn’t concern about camera shutter duration? In which frequency would you like to apply the pulses?

 Signature 

my 19” LCD setup ----> turned into new look
my 60” FTIR setup (old video)

Profile
 
 
Posted: 14 May 2010 05:35 AM   [ Ignore ]   [ # 17 ]
Rank
Joined  2010-05-11
Total Posts:  7
New Member

Hi!

I think that in this situation you can safely remove PWM part, there certainly won’t be any damages at frame drops.
Frame drop means that by some reason computer was unable to capture latest frame (maybe was too slow)
and it’ll have to wait for another, nothing to worry about I think. You could use PWM in a high power case,
where for example 200 watts are used to power large array of leds.

sfh485p led seems to be very good for this work and it has got good IR frequency (950 nm freq could be less visible for a camera).

As for exposure duration, have no idea how to account for it. Yesterday was reading ov7620 datasheet and noticed FREX pin,
which would be perfect - “The positive width of FREX defines the exposure time.”, but it seems it is input only pin.
Maybe counting rising edge of HSYNC pin would do the trick?

Profile
 
 
Posted: 14 May 2010 11:04 AM   [ Ignore ]   [ # 18 ]
Avatar
Rank
Joined  2009-07-07
Total Posts:  27
New Member

The sync pins are for reading data off the sensor rather than capturing, so I don’t think HSYNC would help.

Profile
 
 
Posted: 14 May 2010 01:10 PM   [ Ignore ]   [ # 19 ]
Rank
Joined  2010-05-11
Total Posts:  7
New Member

I was looking at ov7620 datasheet, chapter titled “Frame exposure mode”.
There is nice timing diagram with FREX, HSYNC, VSYNC and exposure time.
Period named “Tset” is exposure time. It happens shortly after VSYNC
and is ending good amount of time before next VSYNC.

Maybe if we could count HSYNC edges after VSYNC edge,
we could reach the number of 480 (rows) in VGA mode and
assume it good time to say that exposure has ended?

I think we incorrectly assume that exposure lasts till next VSYNC,
which is too long period. We just emit LED light in
“mechanical shutter closed” period, which overcharges sensor.
(The camera does not have physical shutter)

I have checked this by software method - blinking by shorter period of time
is enough to reduce nasty effects I have posted before.

Profile
 
 
Posted: 16 May 2010 08:21 PM   [ Ignore ]   [ # 20 ]
Avatar
RankRankRank
Joined  2008-05-08
Total Posts:  335
Administrator

The exposure on the camera is variable and controlled by the CLEYE_EXPOSURE parameter in the SDK.
The VSYNC is simply a signal indicating the beginning of the camera frame transfer. Of course the exposure is synchronized to this signal. Since this camera is a rolling shutter camera the exposure might precede this signal by some time in order to guarantee that row pixels to be transfered are exposed to the incoming light. So if you really want to control the LEDs by using VSYNC, your delay must be able to be set to be as large as one frame.

AlexP

 Signature 

Computing is not about computers any more.  It is about living!

Code Laboratories
CL Studio Live - Video like never before
CL Eye Platform SDK

Profile
 
 
Posted: 17 May 2010 11:41 AM   [ Ignore ]   [ # 21 ]
Avatar
RankRankRank
Joined  2008-11-22
Total Posts:  493
Sr. Member

thank you Alex. your answers always are good evidence.

this camera is a rolling shutter camera

I’m not familiar with camera functions. could you plz tell me what do you mean and do you know what is firefly camera’s type that other guys can sync it successfully.
now i have a question for others
plz look at this curve
sfh485.JPG
and
forward%20voltage.JPG
what 1 A & tp=100us means? is this means that if i want to power the LED with 1 A the max tp should be 10e-4 and from curve max duty cycle could be 5%? and it means that it will be powered for 10e-4 second and for 0.0019 second will be off.
am i right?

 Signature 

my 19” LCD setup ----> turned into new look
my 60” FTIR setup (old video)

Profile
 
 
Posted: 21 May 2010 05:41 PM   [ Ignore ]   [ # 22 ]
Avatar
RankRankRank
Joined  2009-11-09
Total Posts:  488
Sr. Member

what’s your status quo?

 Signature 

My DSI Project:

DSI Table
Proj.Surface: 7D006 on top
2x PS3 Camera from Peau with 850BF & 3.6mm lense
Endlightend XXL (10mm)with 850nm LED strip

Projector: SANYO DWL100 ~ 950€

PC:
Core i5, 8GB Ram, HD5850

Profile
 
 
Posted: 22 May 2010 02:11 AM   [ Ignore ]   [ # 23 ]
Avatar
RankRankRank
Joined  2008-11-22
Total Posts:  493
Sr. Member

no improvement yet,alex’s last post proved that vsync signal isn’t enough for sync.if i would get some free time i will go to univ and do some tests to calculate exact exposure timing.
your friend have used industrial cams with strob output that make it too easy.
i hope alex give us some more information about ps3 eye’s shutter’s function and it’s differences with other brands
any suggestion is welcome

 Signature 

my 19” LCD setup ----> turned into new look
my 60” FTIR setup (old video)

Profile
 
 
Posted: 25 May 2010 02:35 PM   [ Ignore ]   [ # 24 ]
Rank
Joined  2010-01-18
Total Posts:  32
New Member

Hi vahid,

I saw your message for me to post here from another thread. I’m impressed with all the technical discussions here. The graph explanation that you want is partly expained by others but I’ll add to it in a later post.

However I think there a few important points to stress before getting into a further discussion about VSYNC and the rest.

1) The LEDs being discussed (SFH485/SFH485P) operate at 880nm - this is a higher frequency than a lot of the lasers used with the PS3EYE. the sensor in the PS3EYE is probably not very sensitive at this frequency and so will give a poor picture. Even the FireflyMV is only about 60% efficient at these 880nm and the PS3EYE is color so it already operating at below 33% efficiency!
2) Look at how FTIR works. Improving the angles at which the LED strikes the edge of the Acrylic (rather than straight on) and ensuring that more of it gets into the acrylic may improve matters here. Also getting an LED with greater radiant strength may also improve things although the SFH485 provides good value and is easily available.
3) What filter are you using? - you can use an 830nm filter rather than an 780nm one which will cut out even more ambient light.

On point 2 I am going to be doing some experimentation myself over the next few days so I am going to report back in another post.

Even so this project has the potential to be very a very useful exercise - even though having a proper firewire camera would make it a lot easier because you have more control over the camera triggering.

I think that you need to know the start of the frame capture. The signal to look at (from the OV7720 datasheet) is the FSIN pin and not the VSYNC. This FSIN is an input to the image sensor and is used to start the frame capture. The trick as to trigger the light at the start of this frame capture and have frame capture times which are similar to the turned on light but then don’t capture be capturing frames when the light is off. So go for only 6ms frame capture/LED on say but then feed the only frames every 33ms - therefore 30fps. feed the output. Zuchao Wang has already alluded to it in this reply.

Further details to follow.

bamalam

Profile
 
 
Posted: 26 May 2010 01:03 PM   [ Ignore ]   [ # 25 ]
Rank
Joined  2010-01-18
Total Posts:  32
New Member

Sorry for trailing off in my last post but I was in a rush and so some of the statements don’t make a great deal of sense.

In summary though my suggestion boils down to:
- using the FSIN signal to start the capture
- trigger the light for less time than there is in the time between frames (this means that we have what is called a duty cycle)
- suggestion was for 6ms LED on time for frames at 30fps (33ms) frame time which is a 20% duty cycle

The Permissible Pulse Handling Capability Curve gives us a guide as to what we could use for the maximum current for a particular pulse time and duty cycle. The pulse time is 6ms in us and the duty figure of 20% translates as 0.2 curve on the graph. There is 33ms between pulses which is “frame time” in our case but this is not applicable to the graph.  I’ve marked the intersection point - the point where 6x10-3 seconds meets the 0.2 duty cycle as a red cross in the attached image.

This gives a figure of about 300mA from the Y axis as the maximum permissable current for this pulse. You could obviously try different pulse times and duty cycles and look at the graph to resolve the maximum current limit.

Vahid, I would not feed the output to the LEDs directly from the 555 chip. I’d use a drive transistor and resistor arrangement that would limit the current thru the LEDs to the value calculated from the graph.

bamalam

Image Attachments
sfh485_pulse_curve.png
Profile
 
 
Posted: 27 May 2010 07:31 AM   [ Ignore ]   [ # 26 ]
Avatar
RankRankRank
Joined  2008-11-22
Total Posts:  493
Sr. Member

thank you bamalam. you have pointed good points that can help and i will use them in future.
after 2 days attempt i assembled below circuit successfully and tested. this is a pulse generator circuit with delay function to see where ps3 eye close it’s EYE. i used two monostable 555 chip connected each other with a differentiator. The first 555 is used to sync with vsync signal produce delay time controlled by variable resistor. it’s output connected to differentiator and then to second 555 input to trigger it. i adjusted the second 555 pulse width on 0.5 ms so the output of whole circuit is a 0.5 ms duration pulse with a delay respect to vsync.
?ACT=28&fid=35&aid=5892_SlzMzXn8pqrr4wTbwmVH
at first i adjusted variable resistor to have 0.5 ms then i increased it to 14.5 K ohms but i didn’t see any flicker.i saw flicker more that 14.5 K value and it shows that delay time is about 16 ms and it is equal with ps3 eye’s period in 60FPS.
the result is disappointing.like Alex said before, ps3 eye don’t close it’s eyes or maybe closes for a very short time despite other cameras like firefly.
i will update the post with oscilloscope pictures next week

Image Attachments
555delay.gif
 Signature 

my 19” LCD setup ----> turned into new look
my 60” FTIR setup (old video)

Profile
 
 
Posted: 01 June 2010 06:05 AM   [ Ignore ]   [ # 27 ]
Rank
Joined  2010-01-18
Total Posts:  32
New Member

vahid,

the amount of time that the unit that the “eye” of a PS3eye is open for should be set by the value of the exposure. This is held in two registers on the chip but I don’t know how the CL-eye software references that directly. In any case it should be a matter of testing with the CL-Eye test software where you can adjust the values of gain and exposure on a user interface and see the results immediately on the screen.

I’m not 100% sure but that is what I think you can do to reduce the amount of time that the camera is exposed for after a frame trigger. Note that you are likely to need to adjust your trigger time because you are not triggering to the start of the frame - clever use of a 2nd 555 to get the adjustable time though.

bamalam

Profile
 
 
Posted: 01 June 2010 08:42 AM   [ Ignore ]   [ # 28 ]
Avatar
RankRankRank
Joined  2008-11-22
Total Posts:  493
Sr. Member

so you mean duration can be reduced with gain and exposure parameters.when i decrease gain to minimum nothing happens except making the image darken but decreasing exposure value less than half value the nasty effect that toucheur mentions appear.
last week accidentally i could remove that effect using a pulse generator in about 450 Hz (i couldn’t calculate it’s duty cycle because it was analog)

This is held in two registers on the chip but I don’t know how the CL-eye software references that directly


i haven’t know that maybe i can use other drivers such as Linux driver. i have installed ps3 eye’s driver on ubuntu, i should check it out too
anyway, thanx
 Signature 

my 19” LCD setup ----> turned into new look
my 60” FTIR setup (old video)

Profile
 
 
Posted: 06 June 2010 10:40 PM   [ Ignore ]   [ # 29 ]
Avatar
Rank
Joined  2009-07-07
Total Posts:  27
New Member

I spent some more time today exploring the VSYNC.

It seems that it is possible to charge the sensor before it actually starts integrating/exposing. It is significantly less sensitive in this state, but it can still cause residue on “dark” frames if you are alternating some LEDs. If anyone is more familiar with imaging sensors… I’d be curious to hear an explanation for this.

4676818703_f99c873e71_m.jpg

Here is my understanding of VSYNC in relation to the PS3Eye timing:

Assuming the exposure is set to 0, the first row of the sensor is exposed. Then the VSYNC is pulsed and the first row is read off the sensor. While the first row is being read, the second row is exposed and then read off the sensor, etc.

When the exposure is higher than 0, multiple rows are exposed simultaneously. This allows for the same row clock, but longer exposure times. When the exposure is complete, at 511, about half the sensor is exposed simultaneously.

As I mentioned, there is a strange effect where enough light can start charging the sensor before it is actually exposing. The two ways to avoid this are by using the lowest possible exposure setting for your application, or by only pulsing LEDs for half the frame with the sensor fully exposing. This second solution means the image will be brightest in the center and darkest on the top and bottom.

The attached Arduino code will pulse a pin for you in sync with the VSYNC of your PS3Eye, and has a single variable corresponding to the exposure that can be set.

File Attachments
SafeVsync.pde  (File Size: 1KB - Downloads: 143)
Profile
 
 
Posted: 07 June 2010 01:21 AM   [ Ignore ]   [ # 30 ]
Avatar
RankRankRank
Joined  2008-05-08
Total Posts:  335
Administrator
vahid - 01 June 2010 08:42 AM

so you mean duration can be reduced with gain and exposure parameters.when i decrease gain to minimum nothing happens except making the image darken but decreasing exposure value less than half value the nasty effect that toucheur mentions appear.
last week accidentally i could remove that effect using a pulse generator in about 450 Hz (i couldn’t calculate it’s duty cycle because it was analog)

This is held in two registers on the chip but I don’t know how the CL-eye software references that directly


i haven’t know that maybe i can use other drivers such as Linux driver. i have installed ps3 eye’s driver on ubuntu, i should check it out too
anyway, thanx

vahid, both hardware registers are programmed by the exposure value.

 Signature 

Computing is not about computers any more.  It is about living!

Code Laboratories
CL Studio Live - Video like never before
CL Eye Platform SDK

Profile
 
 
   
2 of 3
2