Thew textbook circuit for driving a relay with a transistor is the following, Circuit A p821 of [_The Art of Electronics_](https://en.wikipedia.org/wiki/The_Art_of_Electronics), 3rd ed, Horowitz and Hill, one of the most influential textbooks. The input gate is your PIR sensor; the load is your relay and its diode. You can use a _huge_ range of NPN transistors in this position, including the BC547 you mention, and also the extremely common [2n2222](https://en.wikipedia.org/wiki/2N2222). The resistor of 1K shown in the example depends on the PIR sensor, which we don't know much about. [![enter image description here][1]][1] <!-- Begin schematic: In order to preserve an editable schematic, please don't edit this section directly. Click the "edit" link below the image in the preview instead. --> ![schematic](https://i.sstatic.net/G1sXz.png) <!-- End schematic --> [1]: https://i.sstatic.net/VZLn8.png