# Timer and switch

**URL:** https://discourse.nodered.org/t/timer-and-switch/49758
**Category:** General
**Created:** [15 August 2021 18:03 UTC](https://discourse.nodered.org/t/timer-and-switch/49758 "2021-08-15T18:03:36Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Casper3101](https://avatars.discourse-cdn.com/v4/letter/c/a9adbd/32.png) [@Casper3101](https://discourse.nodered.org/u/Casper3101)
#### Post date: [15 August 2021 18:03 UTC](https://discourse.nodered.org/t/timer-and-switch/49758/1 "2021-08-15T18:03:37Z")

</div>

Can someone please help. I am new to all this. I am trying to create a simple circuit. What I am after is for a timer to activate a relay at 10pm for my father in laws bedside lamp. Along side this I need a push button that turns off the light but also turns it back on shoud he need it during the night. Please help. 😔

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [15 August 2021 18:19 UTC](https://discourse.nodered.org/t/timer-and-switch/49758/2 "2021-08-15T18:19:23Z")

</div>

Hi, welcome to the forum.

Some questions...

1. What hardware will node-red run on?
2. How is this relay connected and how is it activated?
3. What type of button will you have? How is it connected?

* * *

PS: As you are new to "all this", I recommend watching this playlist: [Node-RED Essentials](https://www.youtube.com/playlist?list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6). The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

---

<div class="post-metadata">

### Author: ![Casper3101](https://avatars.discourse-cdn.com/v4/letter/c/a9adbd/32.png) [@Casper3101](https://discourse.nodered.org/u/Casper3101)
#### Post date: [15 August 2021 18:38 UTC](https://discourse.nodered.org/t/timer-and-switch/49758/3 "2021-08-15T18:38:13Z")

</div>

Sorry for being so vague. I am running node red on a raspberry pi 3+. The relay is activated via the gpio pins and I am using a straight forward push button also going to the gpio pins

---

<div class="post-metadata">

### Author: ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)
#### Post date: [16 August 2021 02:42 UTC](https://discourse.nodered.org/t/timer-and-switch/49758/4 "2021-08-16T02:42:33Z")

</div>

Can i suggest to you as you are new with all of this that you might want to simplify this a little and also make it easier for your Father to manage ?

Get one of the Sonoff wall plugs - you can set a schedule to turn the lamp on and off with this plug and can also use the wall switch to control it

> **[IW100/IW101 Wi-Fi Smart Power Monitoring In-Wall | SONOFF Official](https://sonoff.tech/product/smart-wall-swtich/iw100-iw101/)**
>
> Power Metering Always know how much electricity is used, CVS data tables can be exported with just one tap.

Craig

---

<div class="post-metadata">

### Author: ![grant1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/grant1/32/49890_2.png) [@grant1](https://discourse.nodered.org/u/grant1)
#### Post date: [16 August 2021 02:45 UTC](https://discourse.nodered.org/t/timer-and-switch/49758/5 "2021-08-16T02:45:36Z")

</div>

How are you presently activating the gpio pins on the RPi? I presume Python code or something? I have found that using Pi plates [like this one for $42](https://pi-plates.com/relayr1/) which have all [the nodes that enable communication](https://flows.nodered.org/node/node-red-contrib-pi-plates) are the easiest way for me to get Node-RED to work with the gpio on the pi.

But there are literally dozens of ways to accomplish what you are asking.

---

<div class="post-metadata">

### Author: ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)
#### Post date: [16 August 2021 05:59 UTC](https://discourse.nodered.org/t/timer-and-switch/49758/6 "2021-08-16T05:59:42Z")

</div>

Another option might be to purchase one of the many smart bulbs (they come in different fittings).  
This one has a remote and can also be controlled by Alexa. So your father could control it by the remote and/or Alexa (assuming you have one).

> **[Makion WiFi Smart Light Bulb B22 Bayonet 60W Equivalent,Dimmable RGBCW...](https://www.amazon.co.uk/Makion-Equivalent-Dimmable-Multicolor-Required/dp/B07WCFR9FJ)**
>
> Great prices on your favourite Home brands, and free delivery on eligible orders.

In your original description you said you were using a GPIO pin to operate a relay.

**Please take extreme care if you are using a relay to switch "mains" electricity.  
Make sure there is NO possibility to touch any connections - as mains can kill.**

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [30 August 2021 06:00 UTC](https://discourse.nodered.org/t/timer-and-switch/49758/7 "2021-08-30T06:00:03Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
