Ok, I don't know anything about transistors, and my knowledge about electronics is basically limited to U = R . I
and Don't put this cooper wire in the 200V outlet if you wanna live
.
I read several articles/tutorial/stackexchange posts about this question, without understanding how I could apply this to my situation.
My situation :
- I have 3 wires :
- A ground
- A +5V direct current
- A digital output, sending either 0V or +3.3V depending on what my Raspberry Pi's code is currently doing.
- I have a solenoid
- I want my solenoid to receive +5V when my digital output sends +3.3V, and 0V when my digital output is sending 0V.
If I understand correctly, it seems that I could use a transistor to achieve this. And I have a vague idea of what my electrical network should look like, something like :
- Collector plugged on +5V
- Base plugged digital 0V/+3.3V
- Emitter plugged to solenoid
- Other end of soneloid plugged to ground.
(Am I wrong ?)
The most mysterious mysteries are :
Which particular transistor should I use ? Right the only ones I have are little, blacks, with
2N 3904 -H48
written on them (no idea about what it means).Should I add a resistor some where, like ... to prevent things to burn ?
- Is transistor really what I need ? Or am I totally wrong on this point ?