Alright, our final video for Chapter 2, and it's an important one, because if you get this wrong, you can damage your Pico very easily. We aren't going to be running any code or wiring anything up, so just sit back, relax, and let's have a talk about power.
We just talked about powering your Pico, which is the easy one, but now we're going to talk about powering the things connected to your Pico, how to source power from your Pico. The two most important things when it comes to powering your devices is voltage and current, remembering that voltage is like electrical water pressure, and current is like electrical flow rate.
First, let's talk about the three main places on the Pico that you can source power from, and then go over some scenarios of powering some different components. The simplest of them all is the 3V3 OUT pin, which is the one that we connected to the power rails earlier in the chapter, and we've been sourcing all of our power from there so far. This pin will output 3.3V and up to 300mA of power. That's not an incredible amount, but it's good enough for most of your 3.3V devices.
The VBUS pin is another place to source power from, but it's a bit more complicated than VSYS. VBUS kind of hijacks power coming from the USB, so you will only have power on VBUS if your Pico is plugged in with USB, and that's going to give you a nice 5V, and if you don't plug it in with USB, you're going to get nothing out of it. The amount of current it can supply also depends on what you plug the USB into. This phone charger, for example, has a 5V 1A output, we can read it on the label, so you can get up to 1A from VBUS if you plugged your Pico into it. If I plugged it into this 2A battery bank, VBUS will supply up to 2A of current. But this is not an infinite power supply glitch, there is an overall limit of about 2A of current regardless of what you plug the Pico into. So let's say if this battery bank had 3A of current that it could output, I could only safely pull about 2A through VBUS. So VBUS is going to supply 5V when plugged into USB, and will have however much current the USB source can supply, with a continuous maximum of 2A overall.
The final one is from the GPIO pins themselves, which we have been using as well. These aren't a typical power supply, and I wouldn't choose to power things off of them, but when we plug things like our LED and resistors into them, we are technically sourcing power from the GPIO pins themselves. We know what voltages we can supply with digital and analogue outputs, but the pins themselves can only output a maximum of 12mA of current, 1A is 1000mA, so 12mA is 0.012A, which is tiny in comparison to what you can source from VBUS. And so the GPIO pins should only be used for things like these simple LEDs and buzzers, and only very low powered components that you directly drive with the GPIO pins.
Now for all the power sources I've mentioned, the important things to remember are the voltage and the maximum current. If I had something that I wanted to power from one of these sources, I have to ensure, and here's the rule of thumb, that the voltages match, and that the thing I'm powering uses less current than the maximum current that the source can provide.
Alright, that's a lot of information, so let's go through one component at a time and see where we would draw power from the Pico to power that component. This is a display module that we can plug into the Pico. It has two signal pins that we will learn how to use in a later video, and it also has a ground and VCC pin that we will use to supply it with power. I've gone and checked the documentation, and it says that it needs 3.3 volts. So the 3V3 out pin is a good choice to power it as we want the voltages to match. But we also need to check its...The documentation also said that it draws up to 20 milliamps of current. The 3V3 out pin can supply up to 300 milliamps of current, so we have plenty of milliamps to spare, and it's perfectly safe to use this as a power supply for the display.
This is a little array of LEDs in a rainbow, and this device can be powered with anything between 3.3 and 5 volts. You will find that it is very common for components to have a voltage range that it can be powered with, instead of an exact voltage. 3.3 volts means that we could use the same 3V3 out as before, because the voltages match. But this LED matrix can draw up to 4, maybe even 500 milliamps of power at full brightness. And 3V3 out has a maximum current output of 300 milliamps, so we will probably damage the Pico if we tried to power one of these off of 3V3 out.
A better choice would be to use a VBUS, which can provide up to 5 volts and 2 amps, or 2000 milliamps of current. The voltage ranges match, and we are under VBUS's maximum current.
Let's say we wanted to power this servo here. It has 3 wires, 2 of them supply power to the servo, and the other one takes a PWM signal to control it. This signal wire doesn't supply power to the servo, so we can just happily plug it into one of our GPIO pins. And the servo can take any voltage between 4.8 and 6 volts. We're going to have the Pico plugged in with USB, so the 5 volts from VBUS will be suitable to power this as the VBUS matches the voltage range of the servo. Ground to ground, and then the positive terminal of the servo to VBUS, and that works nicely.
That servo can draw up to 600 milliamps, or 0.6 amps of current. Right now, the Pico is plugged into a 1 amp USB power source, so VBUS will provide 1 amp of current, and we'll have 0.4 amps to spare. If I wanted to plug in a second servo though, it would still use 5 volts, but the current draw would double. These two servos combined now need 1.2 amps, but because our USB power source is only 1 amp, VBUS can't provide enough power. To fix this, I could just plug it into a more powerful USB source, like this 2 amp battery bank here, or find a USB wall charger that can supply up to 2 amps.
We have been powering the LED and resistor off of our GPIO pins. They will happily run off 3.3 volts, and will draw up to 5 milliamps of power, with the way we have them wired up. Our GPIO pins can happily supply 3.3 volts as we know, and up to 12 milliamps of power, so we have about 7 milliamps to spare, and we're all good here. For things like LED or buzzers, powering them directly off of the GPIO pins is perfectly fine as these components consume a tiny amount of power. It's always worth double checking though that they use less than 12 milliamps of power, you don't want to destroy one of your Pico's pins.
What the GPIO pins aren't good for is powering things like this solenoid or motor here, even this really small one. Both of them can run off of 3.3 volts, but they draw much more current than 12 milliamps. This solenoid here draws up to 500 milliamps, and this motor here, even this really, it's really small motor, this still draws up to 800 milliamps of current. So how do we power these? Both of these take 5 volts, and can be happily powered off of a VBUS like so. This is spinning and working, you're going to have to trust me on that.
However, it just spins continuously and we have no control over it. The problem is, I want to control the speed of it, but if we can only control things with code through GPIO pins, but the thing that we want to control draws too much power for those pins, what do we do? Well, we're going to need to use a driver or controller board. These boards let you use the power from another power source like VBUS, but also let you plug a GPIO pin from thePico into it. So you can write code to control the motor through that GPIO pin, but it takes power from somewhere else that can supply enough current. This course is not going to show you how to use these driver boards because there are thousands of them out there to choose from, and everyone has a slightly different setup. We just want to make sure that you're aware of them and why you would use them.
Don't worry though, because they're usually really straightforward to use, and you'll be able to find many tutorials and guides on how to use some of the more popular ones out there. And one of the first things you'll probably use one of these for is controlling motors to make like a little car or a line following robot or something like that.
All right, long video with lots of information, I apologize, but we have one more thing and it's really easy. You need to ensure that the connections between your components can support the current that you are pushing through them. This is a much bigger servo that can draw up to about two amps of current, and I've got it connected to VBUS with a two amp power supply through USB. It's all fine, but these jumper wires here can only support up to about one amp of current. These ones are on the thinner side, you can get thicker ones that can support two amps.
If I were to put this servo under full load and draw two amps continuously, these wires would probably start to heat up and melt, and maybe even start a fire if I draw that much current for a really long period of time. A period of time is in like five minutes even, that's how long it might even take. So I would need to ensure that the ground and positive terminals of my servo are connected with wire that is rated up to two amps. The signal one is fine because it's a signal wire, it doesn't use much power.
The other thing to watch out for is the breadboard itself, it has a current limit as well, up to about two amps. It's all kind of a weakest link in a chain sort of deal, which going from the power source to the component, all those chains and all those links have to be rated to that current.
Well, that was a big video, and there is an incredible amount of components out there, all needing different voltages and currents, and you'll usually need to check data sheets or website listings to find that information. If you're ever unsure, it might be worth checking with somebody who knows what's up, or feel free to drop a forum post with your power-related questions on our site, we're always happy to help.
So that's it for this video, but four key takeaways. One, when powering components off of the Pico, you must ensure that the voltages match and that the components draw less current than the source's maximum current output. Two, 3V3 out provides 3.3 volts and up to 300 milliamps of current. Three, when the Pico is plugged in via USB, VBUS provides five volts and however many amps the USB can provide, with a hard limit of up to two amps. And four, the GPIO pins of the Pico are only suitable for powering small components like LEDs, as they can only supply up to 12 milliamps of power.
Makers love reviews as much as you do, please follow this link to review the products you have purchased.