Show Posts
Pages: [1]
1  Using Arduino / Sensors / Re: Help with Photo Diode on: July 08, 2011, 06:16:18 pm
Is there a way to change the sensitivity so that it only detects visible light?
The way device is wired is the servo is connected to pin 10, power and ground and the photodiode is connected to analog pin 0 and ground.
2  Using Arduino / Sensors / Re: Help with Photo Diode on: July 08, 2011, 03:07:42 pm
The photo diode is covered with a cap.  That's why I assume that there is no light going through.

The serial output that I receive is the following.
Code:
Differance = -6      Servo position = 0             Diode  = 69
Differance = 5      Servo position = 1             Diode  = 80
Differance = -6      Servo position = 0             Diode  = 69
Differance = -6      Servo position = 0             Diode  = 69
Differance = -6      Servo position = 0             Diode  = 69
Differance = 11      Servo position = 1             Diode  = 86
Differance = -6      Servo position = 0             Diode  = 69
Differance = -6      Servo position = 0             Diode  = 69
Differance = -5      Servo position = 0             Diode  = 70
Differance = -5      Servo position = 0             Diode  = 70
Differance = -5      Servo position = 0             Diode  = 70
Differance = -4      Servo position = 0             Diode  = 71
Differance = -4      Servo position = 0             Diode  = 71
Differance = -3      Servo position = 0             Diode  = 72
Differance = 14      Servo position = 1             Diode  = 89
Differance = -3      Servo position = 0             Diode  = 72
Differance = -3      Servo position = 0             Diode  = 72
Differance = -3      Servo position = 0             Diode  = 72
Differance = -2      Servo position = 0             Diode  = 73
Differance = -2      Servo position = 0             Diode  = 73
Differance = -1      Servo position = 0             Diode  = 74
Differance = -1      Servo position = 0             Diode  = 74
Differance = 1      Servo position = 1             Diode  = 76
Differance = 6      Servo position = 2             Diode  = 81
Differance = 7      Servo position = 3             Diode  = 82
Differance = 5      Servo position = 4             Diode  = 80
Differance = 4      Servo position = 5             Diode  = 79
Differance = 5      Servo position = 6             Diode  = 80
Differance = 4      Servo position = 7             Diode  = 79
Differance = 3      Servo position = 8             Diode  = 78
Differance = 8      Servo position = 9             Diode  = 83
Differance = 2      Servo position = 10             Diode  = 77
Differance = 1      Servo position = 11             Diode  = 76
Differance = 1      Servo position = 12             Diode  = 76
Differance = 1      Servo position = 13             Diode  = 76
Differance = 1      Servo position = 14             Diode  = 76


The purpose of this project is to reduce the intensity of a laser with a polarized lens.  The lens is connected to a servo motor which allows it to rotate.  The photo diode records the intensity of the laser after it passes the lens.  It will then compare the actual intensity to the desired intensity and rotates the lens until the desired intensity is reached.  The photo diode has 2 wires one which is connected to the analog pin and the other is connected to ground.
3  Using Arduino / Sensors / Help with Photo Diode on: July 08, 2011, 01:59:45 pm
Hey,

I need help with connecting a photo diode to my arduino-mega (atmeg1280).
I'm using a photodiode form thorlabs http://www.thorlabs.com/thorProduct.cfm?partNumber=DET36A.
The problem I'm encountering is that when there is no light being pass through the photo diode I would like it
to output a value of 0 to the arduino.  However when I check the serial monitor it shows me that its receiving some sort of light.
I have connected the photo diode to analog pin 0 and ground. 

Code:
#include <Servo.h>
 
Servo myservo;  // create servo object to control a servo
 
int diodePin = A0;    // Assign analog pin value A0 to diode pin
int diodeValue = 0; 
int intensity = 0;
int desiredValue = 75;
int pos = 0;
int differance = 0;

void setup()
{
  myservo.attach(10,650,2400);  // attaches pin 13 to the servo object with min period
  Serial.begin(9600);           //Set baud rate to 9600
 
 
}
 
void loop()
{
 
  delay(1000);
  do {
      diodeValue = analogRead(diodePin);                 // reads the value of the photo-diode (value between 0 and 1023)
      intensity = diodeValue;
      diodeValue = map(diodeValue, 0, 1023, 0, 179);     // scale it to use it with the servo (value between 0 and 180)
      intensity = map(intensity, 0, 1023, 0, 100);       // scale diodeValue between 1 - 100 for intensity of light         
     
      differance =(intensity - desiredValue);            // calculate the differance between desired value and actual value.
     
      Serial.print("Differance = "); Serial.print(differance);
     
      if (differance>0)                                 
        pos=constrain (pos+1,0,180);                   //rotate clockwise by 1 degree
      else if (differance<0)
        pos=constrain(pos-1,0,180);                    //rotate anti-clockwise by 1 degree
       
      myservo.write(pos);                              // sets the servo position according to the scaled value
      delay(150);                                      // waits for the servo to get there   
    Serial.print("      Servo position = "); Serial.print(pos);      Serial.print("             Diode  = "); Serial.println(intensity,DEC);
  } while (desiredValue!=intensity);                   //run while the intensity is not the same
 
   Serial.println("ACHIEVED");
   digitalWrite(13,HIGH);
   delay(5000);
   digitalWrite(13,LOW);
   delay(5000);
}

Thanks
4  Using Arduino / Installation & Troubleshooting / Re: Arduino Mega Problem Uploading to Board on: February 12, 2011, 07:26:14 pm
I tried burning the bootloader i still get an error.


avrdude: usbdev_open(): did not find any USB device "usb"
5  Using Arduino / Installation & Troubleshooting / Re: Arduino Mega Problem Uploading to Board on: February 12, 2011, 02:27:17 pm
No, its definitely the 1280.  I just received the AVRISP mkII and have been using that along with AVR Studio to program the board and its been working fine.  I don't understand why it won't work with Arduino program though.
6  Using Arduino / Installation & Troubleshooting / Re: Arduino Mega Problem Uploading to Board on: February 11, 2011, 05:56:33 pm
Here is the Verbose Output:

Code:
Binary sketch size: 1584 bytes (of a 126976 byte maximum)
C:\Program Files (x86)\arduino-0022\hardware/tools/avr/bin/avrdude -CC:\Program Files (x86)\arduino-0022\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega1280 -cstk500v1 -P\\.\COM5 -b57600 -D -Uflash:w:C:\Users\Sharma\AppData\Local\Temp\build1209324899978110727.tmp\Blink.cpp.hex:i

avrdude: Version 5.4-arduino, compiled on Oct 11 2007 at 19:12:32
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         System wide configuration file is "C:\Program Files (x86)\arduino-0022\hardware/tools/avr/etc/avrdude.conf"

         Using Port            : \\.\COM5
         Using Programmer      : stk500v1
         Overriding Baud Rate  : 57600
avrdude: ser_open(): setting dtr
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Recv:
avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: Send: Q [51]   [20]
avrdude: Recv:
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0xfd

avrdude done.  Thank you.
7  Using Arduino / Installation & Troubleshooting / Re: Arduino Mega Problem Uploading to Board on: February 11, 2011, 12:41:12 pm
I have used a 9v battery to power up the arduino and still no luck.
I have also chosen the correct board on the arduino software, I'm using the the 1280 board.
This problem is really frustrating, could it have to do with bootloader?
8  Using Arduino / Installation & Troubleshooting / Arduino Mega Problem Uploading to Board on: February 10, 2011, 05:11:43 pm
Hey,

I'm having trouble with an Arduino Mega board I received.
I'm using Windows 7 64bit with the Arduino 0022 software.
I have configured the software to the Arduino Mega at Port5.
Then I try to upload the example Blink and I recieve the following error:


Binary sketch size: 1584 bytes (of a 126976 byte maximum)
avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0xfd

Could you please help me with this issue.
Thx
Pages: [1]