eye writer 2

Hi
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 YCAM InterLab 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:

/*
 StrobeEye

 
 The strobe (also called vertical sync) from a camera is broken out and
 drives an interrupt on pin 3 (interrupt 1). The loop() uses the offset
 defined by vsync() to determine whether the LEDs on pin 11 or the LEDs
 on pin 12 should be on.
*/

/*
 This should be set to the same fps you expect the camera to capture at.
*/
const float fps = 30;

/*
 If you are using a PS3Eye or other rolling shutter camera, you also
 need to set the exposure. An exposure value of 1 means the camera is
 exposing half the sensor at any given moment, and an exposure value of
 0 means the sensor is exposing only one row at any given moment.
*/
const float exposure = 1;

/*
 For nicer cameras with global shutters, define USE_GLOBAL_SHUTTER.
 This will disable the use of the exposure variable, and leave the LEDs
 on as long as possible.
*/
//#define USE_GLOBAL_SHUTTER

/*
 Most cameras have a strobe signal that is tied to HIGH, and brought to
 LOW when a frame is captured. If you are buffering the signal with a
 transistor, this will invert the behavior and the polarity of the change
 will probably be RISING. If you are tapping the strobe directly, the
 polarity will probably be FALLING.
*/
const int polarity = RISING;

/*
 Feel free to use different LED output pins.
*/
const int glintPin = 11;
const int pupilPin = 12;

/*
 The rest of the code shouldn't change between setups.
*/
const int interrupt = 1;
volatile unsigned long offset = 0; 
volatile boolean firstFrame = true;
const float microScale = 1000000;
const float totalTime = microScale / fps;
const float cutoff = 1 - (exposure / 2);

float position;

void setup() {
 pinMode(pupilPin, OUTPUT);
 pinMode(glintPin, OUTPUT);
 attachInterrupt(interrupt, vsync, polarity);
}

void loop() {
 position = (float) (micros() - offset) / totalTime;
 #ifdef USE_GLOBAL_SHUTTER
  if(position < 1) {
   digitalWrite(pupilPin, HIGH);
   digitalWrite(glintPin, LOW);
 } else {
   digitalWrite(pupilPin, LOW);
   digitalWrite(glintPin, HIGH);
 }
 #else
 if(position < cutoff) {
   digitalWrite(pupilPin, HIGH);
   digitalWrite(glintPin, LOW);
 } else if (position > 1 && position - 1 < cutoff) {
   digitalWrite(pupilPin, LOW);
   digitalWrite(glintPin, HIGH);
 } else {
   digitalWrite(pupilPin, LOW);
   digitalWrite(glintPin, LOW);
 }
 #endif
}

void vsync() {
 firstFrame = !firstFrame;
 if(firstFrame)
   offset = micros();
}[code]

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)

[/code]

The way you have described your problem will only make sense to someone else who is familiar with eye writer. I suspect you are unlikely to find anyone like that here - the chances are very low, anyway. Is there an eye writer Forum which might have like-minded people?

Alternatively, if you want help here I think you need to describe your problem as an Arduino issue.

  • Explain the role the Arduino plays;
  • Post the entire project code (as an attachment if it is long);
  • Provide a good overview of how all the different parts of the code work;
  • Explain where in the code you think the problem lies;
  • And explain what the different Arduino pins are used for - especially Pin3.

and everything else you think would help someone who know zero about your project.

...R

i have edited the post also gave the code please revisit post

the problem i am facing is called stobing.

I have no idea what this means.

i have edited the post also gave the code

Didn't get that right, either. Code goes in code tags (generated by the icon with the #).

sorry its strobing or vertical sync signal of camera

shyckh:
i have edited the post also gave the code please revisit post

It's fine to edit posts to correct mistakes but it just confuses everyone if you put stuff into an early post that was suggested by a later comment. Put the new stuff in a new post so anyone reading the Thread can make sense of it.

As @PaulS said, code should be in code tags so it looks like this

It's interesting - the code is much much shorter than I expected. Can you explain (in english rather than code) how it should work.

...R

Edit to change from Quote tags to the Code tags I had intended to use. Bad hair day !

the code is simple and self explanatory. it checks for interrupt 1 . when it finds an interrupt 1 it sands a signal on pin 11 and 12 so that leds attached to these pin will flicker out of phase with respect to each other.Position is the distace between two set of leds wrt to central led. cut off is some intermediate value. exposure and global shutter are related to camera. some other things in the code takes a lot of time for explanation. so just ignore them if you find them misleading or confusing.
Other way around; what i want::
i want to make a code for arduino which accept an input of some frequency say 30Hz and give me a 2 pulses of same frequency which are out of phase with respect to each other..

shyckh:
the code is simple and self explanatory.

It may be to you, but then you understand the system it is trying to work with.

I would like you to explain how that system works. Then I could more easily make sense of your code.

...R

for complete system please visit the link

Hi,

Please use code tags.. See section 7 http://forum.arduino.cc/index.php/topic,148850.0.html

Tom...... :slight_smile:

shyckh:
for complete system please visit the link
http://www.instructables.com/id/The-EyeWriter-20/

Life is too short.

Give me the executive summary and I will try to help.
Rememeber, I have no interest in making an eyewriter.

...R

:smiley: :smiley: i need a code for arduino which can drive the load of 2 set of ir leds which can blink out of phase with respect to each other....... :stuck_out_tongue: :stuck_out_tongue: each set contain 16 ir leds. more ever blinking frequency is same as that of incoming signal on pin 3 of arduino....... life cant be more shorter than above lines :slight_smile: XD see the circuit also

shyckh:
:smiley: :smiley: i need a code for arduino which can drive the load of 2 set of ir leds which can blink out of phase with respect to each other....... :stuck_out_tongue: :stuck_out_tongue: each set contain 16 ir leds. more ever blinking frequency is same as that of incoming signal on pin 3 of arduino....... life cant be more shorter than above lines :slight_smile: XD see the circuit also

I don't really see the justifcation for all those smileys. I have spent a lot of time on this and this description doesn't seem to have anything in common with your original post.

As far as I can see blinking out of phase can be done with something very simple like this

void loop() {
   blinkOutOfPhase();
}

void blinkOutOfPhase() {
  digitalWrite(led1pin, LOW);
  digitalWrite(led2pin, HIGH);
  delay(asLongAsYouWant);
  digitalWrite(led1pin, HIGH);
  digitalWrite(led2pin, LOW);
  delay(asLongAsYouWant);
}

and if you just want it to blink when another pin goes high

void loop() {
   newInputState = digitalRead(inputPin);
   if (newInputState == HIGH && prevInputState == LOW) {
       blinkOutOfPhase();
    }
   prevInputState = newInputState;
}

This may not be exactly what you want but it may get you started.

...R