I am following this tutorial for controlling lights with a Pi.

I have little knowledge of electronic circuit building.

I bought the following for setting up the connection :

Raspberry Pi model B with memory card preloaded with an OS.
Bc547 Transistor.
5V SPDT relay.
1N4001 diode. 
9V battery.

This is the photo of the parts enter image description here

This is the circuit schematic:

enter image description here

I am confused about building this circuit because I missed out some components when ordering the parts, which were not mentioned in blog post. But must be obvious from others' perspective. These components are marked in red :

enter image description here

Here the components are connected like this:

enter image description here

I need help in how to setup this circuit like this with a Raspberry Pi.

  • You need the part numbers of those missing items?Do you have any URL of any online electronic components website in your country so that I can figure out the parts for you or any equivalent one. Commented May 16, 2017 at 2:09
  • @thewaywewere this website provides electronic components electroncomponents.com/ Commented May 17, 2017 at 6:09
  • See my answer to your question. By the way, please spend some time to read this "What should I do when someone answers my question?" Commented May 17, 2017 at 9:32
  • Great! Presumed you have made it works. :) Commented May 20, 2017 at 6:43

3 Answers 3


The illustration below showed the wiring of the relay module and the GPIO3 of the RPI 26-pin GPIO headers.

Relay Board Wiring Diagram

Missing Components (with URLs linked to http://www.electroncomponents.com):

Item 1: It's the screw terminal for connecting device under control to the relay. The equivalent is a "3pin TBC Connector - Screw Terminal". (There is no 2pin available.)
Item 2 & 3: They are the 2.54mm pitch connector for connecting to GPIO headers in PRI. The equivalent is "2pin Polarized wired Connector : Relimate Connector (2 pin - male + female)"
Item 4: Which is the 9V battery cap that you have bought.
Item 5: The GPIO header in your RPI board.

Follow the wiring diagram above, you should be able to bring up the relay module through jumper wires in the breadboard. That's all you need to do on the hardware side. Beware the GPIO pin number you used as it needs to be programmed in your code to get it controlled.

  • i will be waiting for my order to come , will get back to you once i receive my order :) Commented May 18, 2017 at 11:06

It looks like you only missed the connection stuff. In your bottom picture, the piece on top is just a screw connector for output... just solder the wires in unless your can find one locally. The tiny part (the one in the middle) in the picture above it is just a riser (You would solder that to the board and then solder the wire to in), again, just solder the wire to the board. The thing at the top is a connector (and wires) to whatever the author connected to... again, a couple of piece of wire and a bit of solder should fix your right up.

  • other then schematic diagram , the first photo from top is what I have and other two photos is what the blogpost author has done. Can you please guide how to do it with breadboard ? Commented May 17, 2017 at 6:12
  • With a breadboard, on each side, every hole on each row is connected to each hole on the same row. Generally, you would use wire (like the wire inside network cable) for connections between components. Commented May 17, 2017 at 13:34

Here is a picture of the wiring needed to wire the breadboard with the diagram components.

1: Breadboard wiring

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.