How to limit the current to my PCB board?

I have modify the ATX power supply unit from my old PC. That are 12V, 5V output, total over 20A. But my ATtiny PCB board only have 3 items: 3W LED, PIR sensor, BC337 transistor.

I plug my board to power supply, after about 5 mins, it got quite hot. ( I did not measure the temperature, but I think there is ~45 C @ ATtiny surface.

I think too much current input to the board, how can I limit the current. I think the PCB need about 120-200mA is enough, included the further items which are not presented now.

You do not limit the current. The device draws (consumes) whatever current it requires and if your components are overheating you are either have one or more of the following conditions :-
a) feeding the circuit with too high a voltage
b) applying a load that exceeds the design of the control components
c) you have a wiring error

please post your circuit diagram. You might be powering that 3W led through your mcu io pins which might be the problem.

There are BC337 NPN transistor between MCU & 3W LED :slight_smile:

There are BC337 NPN transistor between MCU & 3W LED

If the Arduino is getting hot, something is wired wrong.

Is there a resistor between the transistor base and the Arduino? The base-emitter junction is effectively a diode and if it's not current limited, you'll draw excess current from the ATmega chip, possibly damaging it.

Of course the LED is also a diode and must be current-limited. Normally, a special constant-current switching supply is used for LEDs of 1W or more. With "regular" LEDs you can use a resistor, but that's not efficient with high-power LEDs and you'd need at least a 5W resistor because the resistor will get HOT!

Hi Noobian, attached the schematic.

Hi DVDdoug, Means I need IC ULN2803A instead of using the NPN transistor ???

PS: for the first prototype, I used 1W LED instead of 3W LED.

DVDdoug told you about two resistors (resistor for transistor base and resistor for led current limiting). Do you see those resistors in your schematics?

BTW, if you power an 3W LED, even a blue or white one with 3.2V forward current, from 5V, something (either the current limiting resistor or the transistor in an opamp based CC supply) will have to dissipate almost 2W. Keep that in mind.
An alternative would be a switching CC supply. In my experience, those are better bought. Meanwell has the LDD series, but for a single 3W led they are overpowered. I am sure someone can point you to an IC.

Use a 220ohm resistor between ATtiny pin and base of the transistor.

Use a 33ohm (>=0.5watt) resistor in series with the LED.

The LDR/pot is drawn differently in both diagrams, and doesn't work the way it's drawn.
Read up about voltage dividers.

As suggested.

Tom... :slight_smile:

Thanks, DVDdoug, ElCaron, Wawa, TomGeorge. My detector was working over 2days without getting heat.

But I did not have 33R /1W, I used 47R 0.25W * 2 .