I am teaching myself electronics. I designed this circuit to use a photoresistor to trigger a transistor when I hit the photoresistor with a laser pointer. On the Arduino side, I want it to look like a push button. That worked so I wanted to add an led as visual feed back that the laser is hitting the target.

The only way I could figure how to do this was to add a 2nd transistor. It works, but is this the correct way? I don't want to use another pin on the Arduino.

In the pic, pin 11 is supplying the 5V and pin 8 is reading the port.

enter image description here

  • 1
    \$\begingroup\$ Please, use an actual schematic--this thing is very difficult to read. \$\endgroup\$ – Hearth May 16 '17 at 1:25
  • \$\begingroup\$ @Felthry Ok. I've created a schematic. (Hopefully it's the same - as a beginner I am more comfortable with the breadboard graphics.) The lines in blue are what I am adding. \$\endgroup\$ – Johnny Mopp May 16 '17 at 2:08
  • \$\begingroup\$ Oh my not only is the circuit is a mess, but you need to learn the basics of transistor amplification. The current through the collector and emitter is roughly equal to the current through the base and emitter times a certain amplification factor. If you put the load ie a LED on the emitter side of the transistor, then It pretty much loses the point of the transistor. \$\endgroup\$ – Bradman175 May 16 '17 at 2:34
  • \$\begingroup\$ Also can't you just simply hook up the LED with resistor to another arduino pin? \$\endgroup\$ – Bradman175 May 16 '17 at 2:37
  • \$\begingroup\$ @Bradman175 From what I understand there are 2 ways to use a transistor: amplifier or switch. I am trying to use switch mode for both these transistors. When there is no light on the photoresistor, there will be no current at the base (or very little). Then when the light hits it, the transistor switches on. Is that not correct? \$\endgroup\$ – Johnny Mopp May 16 '17 at 2:46

In this circuit, the centre voltage divider is creating a voltage between 5 to almost 0, where the amount of light shown on the photoresistor determines this. This voltage changes the amount of current going through the transistors, which switches them on or off. The LED will turn on when light is shown but it will also set the arduino pin to low, which is inverted to whether light is shown or not. So you may need to change your program a bit. You can omit that 10k resistor if you set your pinmode to INPUT_PULLUP. This circuits only uses one IO pin which is that unconnected node on the right. enter image description here Although I rather prefer MOSFETs, you don't need to use them.

  • \$\begingroup\$ Finally got around to building this circuit. Works well. Thanks. \$\endgroup\$ – Johnny Mopp May 19 '17 at 12:03
  • \$\begingroup\$ Also a bit of trivia here, it's possible that if you shine a specific amount of light on the LDR, you could make the LED shine without turning the IO pin to low (or the other way around). But since you're using a laser to turn it on and off, it doesn't matter here (assuming you don't intend to gradually change the brightness of it but rather like you said, a switch). Also next time, consider a phototransistor rather than a photoresistor. They are better and connects like a transistor but the base is controlled by light. \$\endgroup\$ – Bradman175 May 19 '17 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.