Go Down

Topic: Switching a laser on/off from digital pin (Read 3354 times) previous topic - next topic

Grumpy_Mike

Quote
and it's only outputting 2.28V when connected to GND and pin12 (set to HIGH). Do I need a resistor or something?


So you connect pin 12 to ground and set it to high?

Another pin bites the dust.

tkbyd

Quote
Funny thing was that I measured the current the laser was drawing when connected to the digital pin


People frequently say things exactly the way you have said it.... but they really shouldn't... it gives beginners no end of incorrect ideas.

The laser doesn't really "draw" current.

The current you get is what you get. What you get depends simply on the voltage the circuit is sustaining.... a BIT like the water pressure behind the spinkler on your garden hose... although that old analogy is fraught with things to confuse the beginner, too.... and on the "resistance" of whatever path(s) is/(are) available for the electricity to flow though. High voltage. low resistance? You WILL get high current.

"Resistance", in the world of digital electronics gets tricky in places, too. For instance, an LED doesn't have a simple resistance, and a transistor is REALLY not "simple" "resistance"... but even so, everything, with qualifications, boils down to resistance. You can say that more elegantly by talking about "effective resistance". The trick is learning where the effects come from, and how they work!

If it was easy, would it be any fun?

But it is most fun when the components you are working with haven't been fried, and until you know more it is sometimes hard to tell....

markqvist

Quote
So you connect pin 12 to ground and set it to high?


Measured between positive on voltage regulator and ground on board, with voltage regulator connected to pin 12 and GND of course, I'm not _that_ stupid ;)

Quote
The laser doesn't really "draw" current.


Correction accepted :)

Quote
If it was easy, would it be any fun?


Exactly. The last two days of tinkering, reading, failing, reading, asking, tinkering and eventually having a bit of success have been some of the most educative and fun in a while :) When I started this project my electronic knowledge was limited to building mobile soundsystems, so moving into this realm has definitely been a new and exciting world for me.

What I'm hoping to build in the end is a XY laser scanner controlled from a programmable MIDI controller (via a computer). It's quite a "daunting" project for someone as green in electronics as I am, but hey, no challenge no fun.

I ended up going with a NPN transistor and two voltage regulators, going from 12V to 5V to 3V, since that was what I had on hand :) The high current 3V is then controlled with the NPN transistor from a digital pin on the board. I've currently got one stepper motor (hooked up through an Adafruit Motor Shield) controlling a mirror, which the laser is reflected through.

Here's a few photos:









Go Up