I'm (hopefully) going to make a musical instrument with lasers instead of strings for my final school project.
I will use 8 lasers and 8 LDRs. All lasers will have a dedicated LDR they are pointing at, and if the contact is interfered, a MIDI signal will be generated. I just drew the schematics: .
I don't have an awful lot of experience with (complex) electronics, and I'm hoping you could give me some advice/corrections.
As you can see I will have two circuits, one for the lasers and one for the LDRs and the arduino. The lasers (20mw green diodes) use 3v and 250mA, and I want to be able to plug it into a wall sockets, hence the transformer.
Get it wrong, and they could be the last things you see clearly!
They wont be pointing towards people, but on an LDR, so once installed it's completely safe.
Something else: Is my drawing correct? I was wondering if it is possible to just draw the cable through all the cables after the LDRs, and connect it to the ground (like i've drawn)
I don't think the drawings is correct. You need 8 resistors in series with LDR to form a voltage dividers, than connect middle point to digital input. Probably, you could activate internal pull-up resistors for this, than LDR would be between input and ground (not +5V).
The powering lasers using transformer is also not gonna work right, lasers would light up for short period of time, so your LDR would constatnly read 50/60 Hz square wave, not saying that forward peak current should be limited somehow.
FYI a LDR has much slower response than a phototransistor or photodiode. If you're moving your hand through the beams slowly it won't be an issue, but it would be possible to move your hand through quickly enough to miss the signal.
I'd also suggest adding a way to switch the lasers on/off so you can calibrate your sensors. Turn the lasers off, take a reading, turn them on, take a reading, then set your threshold somewhere in between.
Magician:
I don't think the drawings is correct. You need 8 resistors in series with LDR to form a voltage dividers, than connect middle point to digital input. Probably, you could activate internal pull-up resistors for this, than LDR would be between input and ground (not +5V).
The powering lasers using transformer is also not gonna work right, lasers would light up for short period of time, so your LDR would constatnly read 50/60 Hz square wave, not saying that forward peak current should be limited somehow.
Thanks for the feedback, I'll look into the resistors, although I doubt I will need them (check out the link above)
Also, why would the lasers not work? If the transformer turn 220v AC into 24v DC, it should work, right?
Also, why would the lasers not work? If the transformer turn 220v AC into 24v DC, it should work, right?
As well as the fact you are feeding it with AC, there is nothing to limit the current. You will blow all the lasers.
Driving a laser is far more complex than this see:-
See this for how to do it. http://www.repairfaq.org/sam/laserdps.htm
I'll look into the resistors, although I doubt I will need them (check out the link above)
Not sure you are looking at the same drawing, but picture in the "Analog voltage reading method" section shows 10k resistor in series with LDR.
Also, why would the lasers not work? If the transformer turn 220v AC into 24v DC, it should work, right?
Wrong, transformer outputs 24 AC, according to your drawings.
At the bottom of the page it says: "BONUS! Reading photocells without analag inputs". As I've stated, I will use digital pins, not analog ones, because I won't have enough of those. According to the drawings, I'll just need 0.1 uF ceramic condensators.
About the transformer: I now see my drawing was wrong. I've been searching, and found this: http://www.security-systems.nl/377-Diversen/220V/110V-50Hz/60Hz-24V-DC-250mA-Power-Supply.html.
But as Grumpy_Mike has said, it probably wont be that easy to power the lasers, since they will blow up at a current peak.
not analog ones, because I won't have enough of those
You can use a 4051 to multiplex more analogue inputs. Reading an analogue signal with a digital pin will take too long for you in this situation.
Look at this project for how to use a 4051:- http://www.thebox.myzen.co.uk/Hardware/MIDI_Footsteps.html
not analog ones, because I won't have enough of those
You can use a 4051 to multiplex more analogue inputs. Reading an analogue signal with a digital pin will take too long for you in this situation.
Look at this project for how to use a 4051:- MIDI Footsteps
A multiplexer can only read a single signal at a time. It would be nice if I'm able to read multiple signals, so I can hit multiple "strings" (lasers) at a time. Is there any other way that will have quick response time, other than buying an Arduino Mega?
You missunderstand, you can't read more than one signal at a time on an arduino, even a mega. There is only one analogue to digital converter and a multiplexer inside the chip. For what you are doing you will not notice any extra delay from an external multiplexer.