Eye writer 2

Discussion in 'The Projects Forum' started by shyckh, Sep 8, 2014.

  1. shyckh

    Thread Starter New Member

    Jul 28, 2014
    24
    0
    i am working on eyewriter 2. i have made the project following the instructions on http://www.instructables.com/id/The-EyeWriter-20/. and also i took help from http://interlab.ycam.jp/projects/labact/eye-tracking-study/how-to-make-eyewriter2 this site. the problem i am facing is called stobing. when i disconnect pin 3 of arduino the leds lights up other wise they remain off. any one can help me on that? the circuit diagram can be found at http://www.instructables.com/id/The-EyeWriter-20/step11/Full-Circuit/.

    More information:

    the arduino code for the project is:

    Code (Text):
    1.  
    2. /*
    3. StrobeEye
    4.  
    5.  
    6. The strobe (also called vertical sync) from a camera is broken out and
    7. drives an interrupt on pin 3 (interrupt 1). The loop() uses the offset
    8. defined by vsync() to determine whether the LEDs on pin 11 or the LEDs
    9. on pin 12 should be on.
    10. */
    11.  
    12. /*
    13. This should be set to the same fps you expect the camera to capture at.
    14. */
    15. const float fps = 30;
    16.  
    17. /*
    18. If you are using a PS3Eye or other rolling shutter camera, you also
    19. need to set the exposure. An exposure value of 1 means the camera is
    20. exposing half the sensor at any given moment, and an exposure value of
    21. 0 means the sensor is exposing only one row at any given moment.
    22. */
    23. const float exposure = 1;
    24.  
    25. /*
    26. For nicer cameras with global shutters, define USE_GLOBAL_SHUTTER.
    27. This will disable the use of the exposure variable, and leave the LEDs
    28. on as long as possible.
    29. */
    30. //#define USE_GLOBAL_SHUTTER
    31.  
    32. /*
    33. Most cameras have a strobe signal that is tied to HIGH, and brought to
    34. LOW when a frame is captured. If you are buffering the signal with a
    35. transistor, this will invert the behavior and the polarity of the change
    36. will probably be RISING. If you are tapping the strobe directly, the
    37. polarity will probably be FALLING.
    38. */
    39. const int polarity = RISING;
    40.  
    41. /*
    42. Feel free to use different LED output pins.
    43. */
    44. const int glintPin = 11;
    45. const int pupilPin = 12;
    46.  
    47. /*
    48. The rest of the code shouldn't change between setups.
    49. */
    50. const int interrupt = 1;
    51. volatile unsigned long offset = 0;
    52. volatile boolean firstFrame = true;
    53. const float microScale = 1000000;
    54. const float totalTime = microScale / fps;
    55. const float cutoff = 1 - (exposure / 2);
    56.  
    57. float position;
    58.  
    59. void setup() {
    60. pinMode(pupilPin, OUTPUT);
    61. pinMode(glintPin, OUTPUT);
    62. attachInterrupt(interrupt, vsync, polarity);
    63. }
    64.  
    65. void loop() {
    66. position = (float) (micros() - offset) / totalTime;
    67. #ifdef USE_GLOBAL_SHUTTER
    68.   if(position < 1) {
    69.    digitalWrite(pupilPin, HIGH);
    70.    digitalWrite(glintPin, LOW);
    71. } else {
    72.    digitalWrite(pupilPin, LOW);
    73.    digitalWrite(glintPin, HIGH);
    74. }
    75. #else
    76. if(position < cutoff) {
    77.    digitalWrite(pupilPin, HIGH);
    78.    digitalWrite(glintPin, LOW);
    79. } else if (position > 1 && position - 1 < cutoff) {
    80.    digitalWrite(pupilPin, LOW);
    81.    digitalWrite(glintPin, HIGH);
    82. } else {
    83.    digitalWrite(pupilPin, LOW);
    84.    digitalWrite(glintPin, LOW);
    85. }
    86. #endif
    87. }
    88.  
    89. void vsync() {
    90. firstFrame = !firstFrame;
    91. if(firstFrame)
    92.    offset = micros();
    93. }
    94.  
    Circuit Diagram Explanation:


    The link provided above shows the diagram which can be operated as:
    when the signal from vsyn appeared on the base of npn transistor it will be amplified and fed to pint 3 of arduino as an interrupt. arduino checks for the interrupt and give appropriate signal to pin 11 and 12 of arduino which triggers the two FET's so that leds connected with these FET's will flicker out of phase with respect to central Ring (Led ring)
    [​IMG]
     
    Last edited by a moderator: Sep 8, 2014
  2. wayneh

    Expert

    Sep 9, 2010
    12,123
    3,048
    That schematic is not really a schematic - it's a cartoon of a breadboard. That's useful for building a copy but not so much for diagnostic work. Do you have an actual schematic? Sorry if it's there and I missed it, but I didn't see one there.
     
  3. shyckh

    Thread Starter New Member

    Jul 28, 2014
    24
    0
    [​IMG] take alook at this
     
  4. shyckh

    Thread Starter New Member

    Jul 28, 2014
    24
    0
     
  5. shyckh

    Thread Starter New Member

    Jul 28, 2014
    24
    0
     
  6. wayneh

    Expert

    Sep 9, 2010
    12,123
    3,048
    Divide and conquer. If you remove the Arduino and simulate its functions manually, does it all work? In other words, when you take the MOSFET gates high, do the LEDs turn on? Perhaps you already know the problem is with controlling the Arduino?

    Those gates should have pull-down resistors on them to ensure they go of if the Arduino signal goes "open". Also, did you draw those MOSFETs? I think the body diodes are backwards since they would conduct all the time as shown, regardless of the gate voltage.
     
  7. shyckh

    Thread Starter New Member

    Jul 28, 2014
    24
    0
    thanks for reply... mosfet remain conducting until the gate signal force them to turn off or to flicker. i have sorted the problem.
     
  8. shyckh

    Thread Starter New Member

    Jul 28, 2014
    24
    0
    The transistor dose not switching properly. Tried different transistor. Any help how can i perform switching
     
  9. wayneh

    Expert

    Sep 9, 2010
    12,123
    3,048
    Perhaps you have the pinout wrong? It's very hard to diagnose without a picture. Is the Arduino ground shared with MOSFET ground?
     
  10. shyckh

    Thread Starter New Member

    Jul 28, 2014
    24
    0
    please see the fig. as it is for noobs...
     
    Last edited: Sep 14, 2014
  11. wayneh

    Expert

    Sep 9, 2010
    12,123
    3,048
    Are you referring to T1 in the schematic you provided in #4, the 2N2222 ? Have you checked the pinout of your transistor against what the author of that drawing had? Sounds crazy, but they are not always identical.

    Do you have an oscilloscope?
     
Loading...