MoustacheKitten
Posts: 1
Joined: Thu Jul 25, 2019 4:49 pm

Light Automation

Thu Jul 25, 2019 4:57 pm

Hi all.

I am new to raspberry pi. Myself and my parents are going away in december. We would like to put up a system that would automatebthe lights to go on at a certain time at night and then go off in the morning. Also then leave the automation and be able to switch the lights on/off manually. I have read a few forums and watched a few videos. I sort of understand the connections for the pi and relays. What pi would be used in such example?

Thanks

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12357
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Light Automation

Thu Jul 25, 2019 5:02 pm

No PI!

Just buy a regular mains timer, either electronic, or electromagnetically.

Image

why would you want to re-invent the wheel, unless as an exercise.

if you insist in using an RPI, any PI will do (or an Arduino).

driving the relay is probably the most problematic part, the common pitfall sticky has some tips:
https://www.raspberrypi.org/forums/view ... 91&t=83372

drgeoff
Posts: 9902
Joined: Wed Jan 25, 2012 6:39 pm

Re: Light Automation

Thu Jul 25, 2019 5:32 pm

MoustacheKitten wrote:
Thu Jul 25, 2019 4:57 pm
I sort of understand the connections for the pi and relays.
"Sort of understand" is not sufficient. Using relays to switch mains requires that you fully understand theory and practice. Loss of property, limb and even life is easily possible if you do not.

PhatFil
Posts: 1428
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: Light Automation

Thu Jul 25, 2019 7:23 pm

all sorts of home automation options are available to you if the 'away timer' is just an excuse to play with your pi.
you can wire everything up to your pi, but the advice above regarding mains power should be taken seriously

the route i took involves using off the shelf smart sockets and reprogramming them to replace the manufacturers firmware which generally requires a phone app that need permission to do everything just to talk to the socket..

while i do have to open most devices and solder connecting pins or wires to the pcb i do this without them plugged into the mains power.. (some can be rewritten OTA)

My Pi is used to host the communications system (Mqtt Broker) and the software i use to set up automatic responses and provide a gui interface Node Red

rather than code my own firmware to replace the stock systems i use tasmota a very full featured firmware aimed squarely at smart devices.. https://github.com/arendst/Sonoff-Tasmota/wiki

this gives me the ability to include input from any device my pi can talk to via wifi, bluetooth or physically connected via usb or gpio to determine what gets turned on and off automatically.

Other home automation systems you can use on your pi include domotitcz, and Home Assistant each with their own large friendly support communities

evansusu
Posts: 21
Joined: Sat Apr 13, 2019 5:06 am

Re: Light Automation

Fri Jul 26, 2019 7:00 am

https://www.thegeekpub.com/16187/contro ... pberry-pi/
Hi Guys, I followed this tutorial to light up a WS2812b led strip with 60 LEDS using a raspberry pi. Unfortunately it doesn't work.

'import board
import neopixel
pixels = neopixel.NeoPixel(board.D18, 60)

pixels[0] = (255, 0, 0)

After running it, I got this error in the images Image
Attachments
IMG_1463.JPG
IMG_1463.JPG (243.78 KiB) Viewed 349 times

PhatFil
Posts: 1428
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: Light Automation

Fri Jul 26, 2019 1:00 pm

Did you try running with sudo as suggested? that is prefixing the command to run your script with sudo *Super User DO"?

its easier to read if you cut and paste text into either a quote or code block in your posts, photo's of screens are tricky to read.. and code as message text doesn't stand out.

drgeoff
Posts: 9902
Joined: Wed Jan 25, 2012 6:39 pm

Re: Light Automation

Fri Jul 26, 2019 3:04 pm

@evansusu

Please do not hijack threads which have no relevance to your problem. There is no extra fee to start your own topic.

Return to “Automation, sensing and robotics”