Good morning. I'm stuck with a problem I would ask some assistance on. My project includes multiple laser and receivers. I've obtained some assistance from an outside source (not here) on writing some code. When I upload it, no lasers come on at all. The receiver power light comes on. If I revise it for only one laser, the laser activates. I've gone through the process of changing the code to each separate laser/receiver number and both activate, when it's programmed for one only, which tells me the pin coding is correct. I'm using the Arduino UNO board, with KY-008 lasers and matching receivers. I would "assume" the UNO board is capable of handling multiple laser/sensor units, which leads to believe the code is somehow not allowing it to sync. Here is what I have on the code at this time. I've verified it via the IDE program it is formatted correctly. No errors come up on the verifiation process. Suggestions on where to look? Thanks.
// setup the pins here
int LED = 5;
int Laser1 = 12;
int Laser2 = 8;
int LaserDetector1 = 9;
int LaserDetector2 = 13;
int Buzzer = 6;
void setup() {
pinMode(Laser1, OUTPUT);
pinMode(Laser2, OUTPUT);
pinMode(LaserDetector1, INPUT);
pinMode(LaserDetector2, INPUT);
pinMode(LED, OUTPUT);
digitalWrite(Buzzer, OUTPUT);
Serial.begin (9600);
}
void loop()
{
// Read the input pins
int LaserDetector1 = digitalRead(LaserDetector1);
int LaserDetector2 = digitalRead(LaserDetector2);
// Check whether all the lasers are obstructed
if (LaserDetector1 == LOW && LaserDetector2 == LOW) {
// Turn on the LED
digitalWrite(LED, HIGH);
// Wait 2 seconds
delay(2000);
// Turn on the buzzer
digitalWrite(Buzzer, HIGH);
// Wait 5 seconds
delay(5000);
// Turn off the LED and buzzer
digitalWrite(LED, LOW);
digitalWrite(Buzzer, LOW);
} else if (LaserDetector1 == LOW || LaserDetector2 == LOW) {
// Turn on the LED
digitalWrite(LED, HIGH);
// Wait 2 seconds
delay(2000);
// Turn off the LED
digitalWrite(LED, LOW);
// Turn off the LED and buzzer
digitalWrite(LED, LOW);
digitalWrite(Buzzer, LOW`
`else if (LaserDetector1 == LOW || LaserDetector2 == LOW) {
// Turn on the LED
digitalWrite(LED, HIGH);
// Wait 2 seconds
delay(2000);
// Turn off the LED
digitalWrite(LED, LOW);
}
}
what do you want your code to do with the lasers, assuming it can turn them on (answered above)? what is the purpose of the receivers? what are you planning to do once you get this code to work?
I'm working on a project involving 2 vertical lasers/receivers and 2 horizonal lasers and receivers. The distance between the laser and receiver will be approximately 24" apart but the laser placement will be approximately 8" apart. See attachment below. This will form a small grid where the 4 lasers intersect in the middle. If something breaks both a horizonal AND veritical together, a buzzer or light will come on. If only a veritical or horizontal beam is broken, no signal will occur.
I didn't think about using the other thread. I revised my original thoughts on what I was wanting and considered it a different project. Just didn't think about it. Thanks.
Good day to all. As background info, I previously posted about a personal project involving multiple vertical and horizonal lasers I have been working on for awhile. The moderators closed the earlier discussion due to no activity in responses, which is why I created this new one. Basically, my project involves multiple lasers, where the beams intersect each other and if something blocks it, the programming turns on a light. I'm using a green laser 532nm 10mv 5v and for the sensors, Non-Modulator Tube Laser Receiver Detection Module Relay Switch. The device has 9 horizonal lasers and 8 vertical lasers. In the garage, it works 100% all the time and accurately. It's when I set it up outside, the sun (UV rays?) deteriorates the connectivity from occurring. I've tried putting a canopy over the structure but still have connectivity issues. Move it back inside and all is good. Would a sensor with a potentiometer allow better connectivity where there is sunshine? Both the lasers and sensors are enclosed in a wood frame, so only the beam is exposed to sunlight. Below are pics of the lasers, sensors and structure. The distance horizontally between the laser and sensor is approx 8'. The distance vertically is approximately 7'. Any laser sensor suggestions to try? When the device is outside, if I block the beam anywhere in the middle, the programming doesn't show the beam being disrupted. If I cover the hole completely with my hand, the beam disconnection registers. I also do not need to see the laser beam in the sunlight. I need to have connectivity only. There was a post I saw on another inquiry suggesting a PLL chip. How would this work?
I've asked the moderator to reopen the topic, and merge this with the previous thread.
Could be any wavelength that the detector receives. To avoid this, most people would modulate the laser and/or use narrow 532 nm bandpass filters in front of the receiver.
10 mW is 20 times MORE power than allowed for free eyesight.
You have to make sure that nobody ever - not even a small head young child is able to look into the laser-beam!
Otherwise you have to make sure that everybody that comes close to these lasers wears special glasses with a 532nm-filter that reduces the laser-beam intensity down to 5%.
This is 243 cm. How would you ever protect persons from looking into the beam??
And you want to use this device outside???
Quoting the laser security fact sheet
Class 3B lasers are intermediate power (CW 5-500 mW or pulsed 10 J/cm²) devices. Some examples of Class 3B laser uses are spectrometry, stereolithography, and entertainment light shows. Direct viewing of the Class 3B laser beam is hazardous to the eye and diffuse reflections of the beam can also be hazardous to the eye. Avoid viewing the Class 3B laser beam directly
You should hurry up to describe the purpose of these lasers. So that the community can help you to find a non-hazardous solution for the final purpose !
Stefan
Your response is shocking since you have little to no knowledge of how these lasers are being used. Since this is a forum to "gather" information, a simple request of how the lasers are being used would have been appropriate and then offer any additional information on the best way to safeguard. But demanding an immediate response and threatening to close all communications if I didn't meet your timeline, is appalling. If this is the way Arduino permits experts like you to respond and assist others, I'll find another way to get assistance. Oh, as additional information, the lasers are confined to a structure with the lasers and sensors approximately 8' apart. The structure is cordoned off so no one can enter the area and look into the beam. The beams are being used for training and to identify an object as it penetrates a defined zone area, within a grid. The object is a man made object. All safety precautions are in place. But of course you didn't know that before you replied. I apologize to the forum for my response but I would suggest you set standards on how your experts ask questions and before they "shoot from the hip" before knowing the facts. You may close this question out and delete my account.
Well one of the most basic rules that were presented to you directly after registering is that you should provide detailed information about your project.
On such a public forum you have all kinds of people asking very very different things.
Including people that have no knowledge about electronics or programming etc.
And including people that try to do really dangerous things and people that are not aware of what dangers they create.
So from the few informations that you have given there was a possability that your prject could be dangerous. Hence my posting. It is up to the moderators to close a thread. They would only close a thread if it is really evident that somebody wants to do something that is against forum-rules. And moderators would ask by private message that you should explain the project.
On the other side: you posted no informations about your safety-precautions and presented a project publicly that requires safety-precautions to be really safe.
You can buy such lasers from china with even more wattage without anybody asking for beeing an expert how to handle such lasers.
And there is a chance that some rather limited educated people think "cool project I want to do it too!" and building / using such lasers without knowing about the dangers.
And these are the reasons why I posted information about the dangerness of such lasers.
Me as a simple user I can't delete an account. If you think my posting is too harsch you can flag my post to get the attention of a moderator. Then the moderaror will decide what to do if I should modify the text of my posting or if a moderator will delete my posting.
Your sensor is very sensitive to infrared, so it's not surprising that you have trouble in the sun. It also has a very wide beam angle that make things worse.
You might try connecting a 470 ohm resistor between Vcc and OUT, this will decrease the overall sensitivity. If that does not work then you need to look for a more appropriate sensor and/or LASER-sensor combination.