PhotoLuminescence

Whats going on everyone? This is my first post and a big project (IMO) i'm tackling with little to no programming experience but a fair amount of electronics background. Hoping someone can offer some advice and suggestions going forward.

I'm looking to integrate a SICK luminescence sensor (LUT3-620) into a current piece of equipment to read the intensity of light using my ArduinoUNO. I'm looking to use this SICK sensor as an analog input (it outputs 0-3vDC which is perfect) to define as an integer in the ArduinoUNO based on its returned voltage. Once the baseline is set an external button will be pressed to program that specification (voltage) and a predetermined threshold will be applied (+/-10), anything that deviates will sound an alarm.

Has anyone done anything similar? any advice as to how you might go about this programming/code wise?

Once this set, i'd like to add the blue LED screen to display the voltage (or integer) to give me a visual of the reading- but thats a project for another time.

Thanks in advance

Scott

The analogRead reference would be a starting place. Also the examples in the IDE (File, Examples, Analog).

Thanks Groundfungus, been doing some other research online as well. Found some youtube videos which have been helpfull but not 100% for my application.

If you need help, just ask. Hopefully you have read the "how to use the forum" stickies. Following their guideline help us to help you. Welcome to the forum.

Is it true that i don't have to hook up a ground if running the sensor off an external power supply if Analog pins always reference 5V?

Only if all of these "ground"s are true ground connections - as in, connected to the ground, the real ground under your feet, not just a chunk of copper on the back of a breadboard or a power line you arbitrarily call "0 V" or "gnd" or so.

So for normal applications you'll have to connect the ground between the two sources. Otherwise you never know what the real voltage difference between the two is.

To come back to your original question, if what you're after is the brightness of light in lux, get a simple sensor such as the TSL2561. Conveniently connects to the I2C bus and digitally provides the current brightness as absolute number (up to 65535 lux).

The LUT3 measures luminescence of fluorescent objects which meets the requirements for this task. I read the arduino can be powered by up to 12v via the coax port which is internally regulated, and the minimum for the sensor is 10v but 9v is sufficient. I might try to use 1 PS at 9v to power both for the sake of complexity. that will also resolve the ground issue. I came accross a basic code to measure a POT, but when I look at serial monitor i'm getting quite a range.

/*
ReadAnalogVoltage
Reads an analog input on pin 0, converts it to voltage, and prints the result to the serial monitor.
Graphical representation is available using serial plotter (Tools > Serial Plotter menu)
Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.

This example code is in the public domain.
*/

// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
float voltage = sensorValue * (5.0 / 1023.0);
// print out the value you read:
Serial.println(voltage);
}

Be very careful to never connect any voltage higher than 5V to the analog (or any) input. Use a voltage divider to drop the voltage if necessary.

but when I look at serial monitor i'm getting quite a range.

What does that mean.

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

I might try to use 1 PS at 9v to power both for the sake of complexity. that will also resolve the ground issue.

Don't try a smoke detector type battery it will not be able to supply the current.

Also the SICK detector needs 12V to 30Vdc at about 60mA.

Thanks.. Tom... :slight_smile:

I think my confusion comes from the 3rd wire (Black) in the sensor which is my PNP signal i'm using as an input to the Arduino on Pin A0. That should have an accompanying ground so I tried hooking to the Blue and ground from the power supply/sensor together and then to the GND pin on the arduino. When I wire it in this manor I don't get any data displayed on the monitor.

This should be relatively straight forward but i'm struggling.

Hi,
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom.. :slight_smile:

I think you need to investigate the voltage levels that you can expect from the device. The datasheet shows:

PNP: HIGH = VS – ≤ 3 V / LOW = approx. 0 V

NPN: HIGH = approx. VS / LOW ≤ 2 V

Consider how that plays with the Arduino input.

https://www.lcautomation.com/dbdocument/20625/LUT3-620%20datasheet.pdf

It also looks like it's not analog, looking at this line:

"Output function - Light switching"

This is how I've currently got it wired, see pics. I found if I attach the ground from the external PS in pic 2 the sensor does not function properly. when I run the program wired in pic 1, and stream the data, it does not appear to be consistent with what I should be reading and the integers range cyclical from 0-1023 with no change in substrate in front of the sensor.

Thanks in advance for everyone's help.

int sensePin =0;

void setup() {
  analogReference(DEFAULT);
  
  Serial.begin(9600)
}

void loop() {
  Serial.println(analogRead(sensepin));
  delay(250);

}

Of course 1.gif won't work, you haven't connected the grounds. The other picture shows a situation where you may have been putting 20 volts on an input pin. You may have fried the input. You would need a voltage divider to fix that.

Also, read my lips, the sensor may not have an analog output.

"Switching output - PNP/NPN" !!!!!!!!!!!!

aarg:
Of course 1.gif won't work, you haven't connected the grounds. The other picture shows a situation where you may have been putting 20 volts on an input pin. You may have fried the input. You would need a voltage divider to fix that.

Also, read my lips, the sensor may not have an analog output.

"Switching output - PNP/NPN" !!!!!!!!!!!!

how would 20v be applied if the sensor only outputs 0-3v in any state?

I just assumed that outputting a voltage would allow me to assign an integer on an analog input based on the voltage. This couldnt be achevied on a digital input, can it?

The LUT3-620 is not an analog sensor. It has a digital output that changes at a set threshold. If VS=24V then the output could be 24V-3V = 21V.

Where do you get the output 0-3V? The data sheet says PNP output HIGH is Vs (supply voltage 24V) minus less than or equal to 3V. That makes the PNP output HIGH greater than or equal to 21V.

I misinterpreted the output voltage, thinking it was 0-3v. That makes sense now. So it seems that a voltage divider is in order to power it and likely a digital input with some resistors to restrict the input voltage. would that be a fair statement?

A voltage divider is apprpriate to drop a signal voltage. A voltage divider is not appropriate for droping a power supply voltage. Once you understand voltage dividers you will know why.