I'm trying to build a watering system with moisture sensors and a pump.
Following this build
I don't have the same transistor, and i have a different pump.
I tried to replace the transistor with "PNP Transistor(8550)". But the voltage when turned on was 4.5v, instead of 5v. So my pump does not have enough power. I have very little knowledge about how transistors work. What transistor do i need to keep arduinos 5v current? The pump works fine plugged directly to arduinos 5v pin
You could almost use any other transistor as long as it's NPN And you NEED to add a diode across the motor. Just Google "arduino transistor motor".
But first, what is that motor? In general it's a bad idea to power a motor from the 5V of the Arduino. So link to the article.
With the PNP you might switch it as well but you need to switch to high side driving. And of course the transistor must be able to handle the current and the Arduino be able to provide it.
Why do i need to add a diode? is it to save the motor from taking damage? I read briefly about diodes right now and it seems like they only allow current in one direction.
Why is it a bad idea to power a motor from Arduinos 5V?
Here is the build guide (youtube)
Also, can you explain why the voltage dropped down from 5V to 4.5V after the NPN transistor? What is causing my pump to not function? The diode? How come it works if plugged directly to 5V and ground (if i skip the transistor)
Alright, 90mA @ 6V China spec. So I would use at least a 200mA transistor to drive it. And it's on the boarder of what the Arduino can deliver connected to USB (1. because of the inline fuse with tyhe USB, 2. the USB spec of 200mA max). Connected to 12V that is possibly to much (because the Arduino needs to burn the excess of voltage in heat in the regulator).
Did you try to Google it? It protects the transistor. For more info, try the start of this line
Glutch:
Also, can you explain why the voltage dropped down from 5V to 4.5V after the NPN transistor?
No, because you said you used a PNP... But even connected right, there will always be a little voltage drop. Nothing is perfect in the real world.
Glutch:
Why do i need to add a diode? is it to save the motor from taking damage? I read briefly about diodes right now and it seems like they only allow current in one direction.
The diode protects the circuitry (Arduino) from the motor shutoff current. The diode must be installed in the correct orientation.
Glutch:
Why is it a bad idea to power a motor from Arduinos 5V?
The 5V supply has a limited capacity. It can handle the Arduino and a few LEDs or an LCD. A motor draws much more current. Which lowers the 5V supply line. This is not good.