Hi all,
I am a total newbie and therefore apologies upfront for missing knowledge.
I need help with the Grove Relay, as it is not turning on a lamp.
I have the following setup:
- RaspberryPi 3
- Grove Base Hat for RaspberryPi (https://wiki.seeedstudio.com/Grove_Base_Hat_for_Raspberry_Pi/)
- Grove Relay (https://wiki.seeedstudio.com/Grove-Relay/)
- Grove Oled Display (https://wiki.seeedstudio.com/Grove-OLED_Display_0.96inch/)
I want to simply turn on and off a lamp for testing and knowledge building purposes in the first step.
- The OLED Display is working fine.
- The Relay LED blinks correctly, when tested with and without extension cable attached.
- The relay is connected to D5. I also tried D16 and PWM.
- The lamp is connected to an extension cable.
- The extension cable is wired to the relay.
- The extension cable is put into the socket.
- I live in Europe, 230 Volt and 50 Hertz.
- I tried two different relays, same behaviour for both.
- I checked the wiring without the relay. The lamp works.
Did I buy the wrong relay?
Did I wire it incorrectly?
Sorry but I have no idea of electrics and stuff. I think I need the most dumbest low bob help ever!
There is electricity on the relay, I got two minor electric shocks yesterday in the late evening.
Your help is highly appreciated!
Here is my Python code:
import time
import requests
from grove.grove_oled_display_128x64 import GroveOledDisplay128x64
from grove.grove_relay import GroveRelay
# OLED Display
display = GroveOledDisplay128x64()
# Relay Number 1
relay1 = GroveRelay(5)
# Temperature variable
temp = 22
# Humidity variable
humi = 90
# CO2 variable
CO2 = 1000
# IFTTT values
IFTTT_URL = xxxxxxxxxxxxxxxxxxxxxx - ifft works just deleted the sensible information
IFTTT_KEY = xxxxxxxxxxxxxxxxxxxxxx - ifft works just deleted the sensible information
count = 0
while True:
try:
# Getting current time
t = time.strftime("%H:%M", time.localtime(time.time()))
# Putting time to display
display.set_cursor(0, 0)
display.puts('Time:')
display.set_cursor(0, 6)
display.puts(t)
print("Time set")
# Putting temp to display
display.set_cursor(1, 0)
display.puts('Temp:')
display.set_cursor(1, 6)
display.puts(str(temp)+" C")
print("Temp set")
# Putting humi to display
display.set_cursor(2, 0)
display.puts('Humi:')
display.set_cursor(2, 6)
display.puts(str(humi)+" P")
print("Humi set")
# Putting CO2 to display
display.set_cursor(3, 0)
display.puts('CO2:')
display.set_cursor(3, 6)
display.puts(str(CO2)+" PPM")
print("CO2 set")
count += 1
if count == 10:
# Testing Relay Number 1
relay1.on()
time.sleep(10)
relay1.off()
time.sleep(1)
print("Relay 1 Test")
requests.post(IFTTT_URL + IFTTT_KEY, json = {'value1':temp, 'value2':humi, 'value3':CO2})
print("Uploaded to IFTTT sheet")
count = 0
except KeyboardInterrupt:
# Exit procedure for keyboard interrupt
relay1.off()
display.off()
print("KeyboardInterrupt")
exit(1)
except:
# Exit procedure for everything else
relay1.off()
display.off()
print("Except Exit")
exit(1)
Here are the pictures of the wiring and the information of the lamp: