Help needed please!

Adafruit's tiny microcontroller platform. Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
mariomillerjr
 
Posts: 9
Joined: Fri Oct 29, 2021 8:52 am

Help needed please!

Post by mariomillerjr »

Hello every one. I’m not sure if I’m even posting this in the right section, but I’m fairly new to all of this. For my project I have two LED’s that I want connected to the same power source, but I want each one to be activated by its own switch. It’s for a nerf Stryfe blaster mod. I’ll have one LED that’s activated by a lever switch when the magazine is inserted and another LED that’s activated by a Hall effect sensor to indicate when the darts have run out. I want them to be connected to the same power source.. how can I go about doing this as simple and compact as possible?

User avatar
adafruit_support_bill
 
Posts: 88142
Joined: Sat Feb 07, 2009 10:11 am

Re: Help needed please!

Post by adafruit_support_bill »

Connect each anode to your positive power supply via a current limiting resistor.
Connect the cathode of one to ground via the lever switch.
Connect the cathode of the other to the output of your Hall sensor.

User avatar
dastels
 
Posts: 15820
Joined: Tue Oct 20, 2015 3:22 pm

Re: Help needed please!

Post by dastels »

First, read this if you haven't yet: https://learn.adafruit.com/all-about-leds.

Now to use the LEDs in your situation.

Slightly different from Bill's response, but electrically equivalent. The main point is that you have two circuits of a LED, a resistor, and a switch between the positive and ground of your power source.

Connect the anode (the positive side) of each LED to the + side of your power source. Connect a resistor to the cathode (negative side) of each LED to one side of a resistor (each LED will need it's own resistor, the value of which will depend on the voltage of your power source and the LED). Connect the other side of each resistor to one side of one of the switches and the other side of each switch to the ground (negative) side of the power source. Now activating the switches will light the associated LED.

Dave

User avatar
mariomillerjr
 
Posts: 9
Joined: Fri Oct 29, 2021 8:52 am

Re: Help needed please!

Post by mariomillerjr »

. Each LED is 3 volts, so I have them connected to a 6 volt power source. While I have you here, what resistor would you recommend for that? honestly, I’ve always had trouble when using resistors as I find it a bit confusing lol.

User avatar
dastels
 
Posts: 15820
Joined: Tue Oct 20, 2015 3:22 pm

Re: Help needed please!

Post by dastels »

It's explained in the guide I linked to.

Dave

User avatar
mariomillerjr
 
Posts: 9
Joined: Fri Oct 29, 2021 8:52 am

Re: Help needed please!

Post by mariomillerjr »

In this case what exactly is the job of the resistor and how does wiring them up make the circuit work the way I’d like it to?

User avatar
mariomillerjr
 
Posts: 9
Joined: Fri Oct 29, 2021 8:52 am

Re: Help needed please!

Post by mariomillerjr »

Is there a way to do it without using resistors?

User avatar
adafruit_support_bill
 
Posts: 88142
Joined: Sat Feb 07, 2009 10:11 am

Re: Help needed please!

Post by adafruit_support_bill »

You need something to limit the current through the LED to avoid damage. A resistor is the simplest way to do it. And there are dozens of easy-to-use resistor calculators on-line:
Here is one: https://www.make-it.ca/led-dropping-res ... alculator/

User avatar
dastels
 
Posts: 15820
Joined: Tue Oct 20, 2015 3:22 pm

Re: Help needed please!

Post by dastels »

You could use a power source that's the same as the forward voltage of the LEDs. The Resistor serves to "absorb" the excess voltage at the current required by the LED.

Dave

User avatar
mariomillerjr
 
Posts: 9
Joined: Fri Oct 29, 2021 8:52 am

Re: Help needed please!

Post by mariomillerjr »

I really appreciate all the help! Here’s another question? Is it possible to code and program this with a trinket? Or if not a trinket, something else?

Locked
Please be positive and constructive with your questions and comments.

Return to “Trinket ATTiny, Trinket M0”