# Controlling a relay using a raspberry pi

**URL:** <https://forum.core-electronics.com.au/t/controlling-a-relay-using-a-raspberry-pi/3093>\
**Category:** Product Questions\
**Created:** [12 July 2018 01:24 UTC](https://forum.core-electronics.com.au/t/controlling-a-relay-using-a-raspberry-pi/3093 "2018-07-12T01:24:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nathan9088](https://avatars.discourse-cdn.com/v4/letter/n/d07c76/32.png) [@nathan9088](https://forum.core-electronics.com.au/u/nathan9088)\
**Post date:** [12 July 2018 01:24 UTC](https://forum.core-electronics.com.au/t/controlling-a-relay-using-a-raspberry-pi/3093/1 "2018-07-12T01:24:17Z")

</div>

Hi, I purchased a 5V Single Channel Relay Module 10A (SKU: CE05137) and am trying to get it working o a raspberry pi 3. I connected 5v from raspberry to VCC, GND to GND and GPIO 17 to IN.  
I then ran a program that turned it on and off but it just comes on. I replace the relay with a LED and ran the program and the LED turned on and off as expected.  
Any help please  
Program is below

import time

import RPi.GPIO as GPIO  
GPIO.setwarnings(False)

GPIO.setmode(GPIO.BCM)  
GPIO.setup(17, GPIO.OUT)  
while True:  
GPIO.output(17, GPIO.LOW)

```
time.sleep(10)

GPIO.output(17, GPIO.HIGH)

time.sleep(10)

```

GPIO.cleanup()

---

<div class="post-metadata">

**Author:** ![Clinton](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/clinton/32/1515_2.png) [@Clinton](https://forum.core-electronics.com.au/u/Clinton)\
**Post date:** [12 July 2018 03:15 UTC](https://forum.core-electronics.com.au/t/controlling-a-relay-using-a-raspberry-pi/3093/2 "2018-07-12T03:15:05Z")

</div>

Hi Nathan

I think the problem is that the GPIO pins on the Raspberry Pi are 3.3V and the relay requires a 5V input. The easiest way forward would be to put a [logic level converter](https://core-electronics.com.au/breakout-boards-and-modules.html#LogicConverters_985) between the Pi and the Relay.
