0

Motor Shield 2.3 & npn transistor
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Motor Shield 2.3 & npn transistor

by chimerical26 on Sat Feb 13, 2021 9:21 pm

I have a setup as laid out in the image (
Stepper & LED.jpg
Stepper & LED.jpg (292.63 KiB) Viewed 101 times
). The LED works fine when it's always on but I want to be able to control it with the Arduino and an NPN transistor (S8050). I believe that I can use the connection points on the motor shield to access the unused digital i/o. The power for the LED is coming from the same source as the motor (12v DC) and is being stepped down to 4v by the two buck converters (two to reduce heat). The instruction that I am following (DroneBot workshop) for the transistor seems to suggest that I connect the negative of the power source and the emitter of the transistor to the ground of the Arduino. The base of the transistor connects to whatever digital i/o pin I'm using. The collector connects to the negative of the LED and the positive of the power source connects to the positive of the LED.
In the tutorial he doesn't have the added complication of a Motor Shield and I know that a wrong move could fry things. I have heard that everything should have a common ground and I don't know with this setup if I should be using the ground of the Arduino because the grounding of the stepper motor has me confused. I just really would rather not destroy anything (again...).
Can anyone offer advice?
Thank you.

chimerical26
 
Posts: 9
Joined: Sun Jan 24, 2021 11:20 pm

Re: Motor Shield 2.3 & npn transistor

by adafruit_support_bill on Sun Feb 14, 2021 8:21 am

Those connections sound right - although you typically need a resistor to limit the base current on the transistor.
https://www.evilmadscientist.com/2013/base-resistor/

All grounds on the shield are common. So connecting to the shield ground is effectively also connecting to the Arduino ground.

adafruit_support_bill
 
Posts: 81531
Joined: Sat Feb 07, 2009 10:11 am

Re: Motor Shield 2.3 & npn transistor

by chimerical26 on Sun Feb 14, 2021 6:08 pm

Thank you. This all seems to have worked perfectly. I decided to use a 50k ohm potentiometer to figure out the correct base resistance by starting at 50k ohm and turning it down until the transistor turned on but it turned on at 50k ohm. I didn't think it would.... hopefully I have it all correct. Do you think a 50k resistor would be correct in series on the base or have I connected something up wrong. As I say I think everything is working fine but I don't trust my knowledge when it comes to resistors.

chimerical26
 
Posts: 9
Joined: Sun Jan 24, 2021 11:20 pm

Re: Motor Shield 2.3 & npn transistor

by adafruit_support_bill on Sun Feb 14, 2021 8:24 pm

The collector/emitter current is proportional to the base/emitter current. If it works at 50K, then you should be fine.

adafruit_support_bill
 
Posts: 81531
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.


cron