you need to use at least a transistor say tip110
https://www.onsemi.com/pdf/datasheet/tip110-d.pdf
and stm32 can drive the base of that transistor.
for tip110, you could lose as much as 2.5v across the transistor and say you are trying to drive with 5v, you have lost close to 1/2 of it.
there are also lower power ones like 2n2222
https://www.onsemi.com/pdf/datasheet/p2n2222a-d.pdf
these don't drive as much currents but it has a lower saturation voltage and only needs much lower turn on voltage
stm32 can drive them at the base
or you can use a mosfet like ao3400
http://www.aosmd.com/pdfs/datasheet/ao3400.pdf
stm32 can drive the gate of that mosfet
plenty of tutorials out there
https://learn.sparkfun.com/tutorials/transistors/all
https://www.allaboutcircuits.com/textbo ... witch-bjt/
https://electronicsclub.info/transistorcircuits.htm
some of the transistors are pretty low cost you could try searching for them on octoparts, ebay, aliexpress, amazon etc