# Timer for lights

**URL:** <https://forum.xod.io/t/timer-for-lights/348>\
**Category:** Uncategorized\
**Created:** [January 1, 2018, 11:38pm UTC](https://forum.xod.io/t/timer-for-lights/348 "2018-01-01T23:38:37Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![alessandrogiannini](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/alessandrogiannini/32/931_2.png) [@alessandrogiannini](https://forum.xod.io/u/alessandrogiannini)\
**Post date:** [January 1, 2018, 11:38pm UTC](https://forum.xod.io/t/timer-for-lights/348/1 "2018-01-01T23:38:37Z")

</div>

Hi everyone! I need a light to be turned on for a certain amount of hours, and then off for another amount of hours, how can I achieve this?

Thank you.

---

<div class="post-metadata">

**Author:** ![nkrkv](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/nkrkv/32/8_2.png) [@nkrkv](https://forum.xod.io/u/nkrkv)\
**Post date:** [January 2, 2018, 12:33pm UTC](https://forum.xod.io/t/timer-for-lights/348/2 "2018-01-02T12:33:51Z")

</div>

Hello and welcome!

You can use a [`square-wave`](https://xod.io/libs/xod/core/square-wave/) node to cycle on and off phases. Use [`time-to-duty`](https://xod.io/libs/xod/core/time-to-duty/) to set up its `DUTY` value. In its turn, `Ton` will define light “on” time (in seconds) and `Toff` defines off-time. One hour is 3600 seconds 😉

If you still have questions, feel free to ask.

---

<div class="post-metadata">

**Author:** ![alessandrogiannini](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/alessandrogiannini/32/931_2.png) [@alessandrogiannini](https://forum.xod.io/u/alessandrogiannini)\
**Post date:** [January 2, 2018, 6:10pm UTC](https://forum.xod.io/t/timer-for-lights/348/3 "2018-01-02T18:10:13Z")

</div>

Thank you for the reply. Yes I have some other questions:

- Because I am using a lot of digital pins I don’t have enough space for a classic lcd so I used a i2c module, if I put the wrong addr is it going to damage the i2c module?
- I want to make a menu in the lcd that allows (when a button is pressed) to switch between views with different data, how do I do that?
- If I use a 16x3 module how can I have access to the 3rd line?

Thank you so much for helping me and sorry for all of these questions but I know only the basics of electronics.

---

<div class="post-metadata">

**Author:** ![nkrkv](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/nkrkv/32/8_2.png) [@nkrkv](https://forum.xod.io/u/nkrkv)\
**Post date:** [January 3, 2018, 1:45pm UTC](https://forum.xod.io/t/timer-for-lights/348/4 "2018-01-03T13:45:34Z")

</div>

> [@alessandrogiannini](#):
>
> if I put the wrong addr is it going to damage the i2c module?

No, absolutely not. The worst thing going to happen is you will not see the text.

> [@alessandrogiannini](#):
>
> I want to make a menu in the lcd that allows (when a button is pressed) to switch between views with different data, how do I do that?

One possible way is to have [`if-else-string`](https://xod.io/libs/xod/core/if-else-string/) nodes right before the LCD node. Another solution is to have multiple LCD nodes that refer to the same display, but have [`gate-string`](https://xod.io/libs/xod/core/gate-string/) nodes before each one and keep only a single gate pair open.

> [@alessandrogiannini](#):
>
> If I use a 16x3 module how can I have access to the 3rd line?

😮 Do they exist? Thats not directly possible with already existing nodes, but you can copy implementation of the 16×2 and make small adjustments (add an input and few lines in C++) to make your own `text-lcd-16x3-i2c` node.

---

<div class="post-metadata">

**Author:** ![dox](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/dox/32/424_2.png) [@dox](https://forum.xod.io/u/dox)\
**Post date:** [January 3, 2018, 4:49pm UTC](https://forum.xod.io/t/timer-for-lights/348/5 "2018-01-03T16:49:22Z")

</div>

@alessandrogiannini:

You can try this:

Add library --\> dox/lcd-i2c

I found a 16x3 Display with SPLC780D Controller. This could be compatible to standard HD44780 controller. No guarantee that it will work. I am not a programmer. This is just a modification of the existing nodes.

---

<div class="post-metadata">

**Author:** ![alessandrogiannini](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/alessandrogiannini/32/931_2.png) [@alessandrogiannini](https://forum.xod.io/u/alessandrogiannini)\
**Post date:** [January 3, 2018, 6:28pm UTC](https://forum.xod.io/t/timer-for-lights/348/6 "2018-01-03T18:28:59Z")

</div>

Thank you for the detailed answers.  
Is it possible to have access to the serial monitor?

---

<div class="post-metadata">

**Author:** ![nkrkv](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/nkrkv/32/8_2.png) [@nkrkv](https://forum.xod.io/u/nkrkv)\
**Post date:** [January 3, 2018, 10:41pm UTC](https://forum.xod.io/t/timer-for-lights/348/7 "2018-01-03T22:41:17Z")

</div>

> [@alessandrogiannini](#):
>
> Is it possible to have access to the serial monitor?

Sure. Use `console-log` node and upload with “Debug after upload” checkmark set.

---

<div class="post-metadata">

**Author:** ![alessandrogiannini](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/alessandrogiannini/32/931_2.png) [@alessandrogiannini](https://forum.xod.io/u/alessandrogiannini)\
**Post date:** [January 3, 2018, 11:05pm UTC](https://forum.xod.io/t/timer-for-lights/348/8 "2018-01-03T23:05:14Z")

</div>

How do I convert a analog signal in a string?

---

<div class="post-metadata">

**Author:** ![nkrkv](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/nkrkv/32/8_2.png) [@nkrkv](https://forum.xod.io/u/nkrkv)\
**Post date:** [January 4, 2018, 10:20pm UTC](https://forum.xod.io/t/timer-for-lights/348/9 "2018-01-04T22:20:49Z")

</div>

Simply link your number output (from an `analog-input`) to a string input (like `L1` on `text-lcd` or `if-else-string`) and magick will happen. If you’re not satisfied with the magick, use the [`format-number`](https://xod.io/libs/xod/core/format-number/) node.

---

<div class="post-metadata">

**Author:** ![coradias](https://avatars.discourse-cdn.com/v4/letter/c/b4bc9f/32.png) [@coradias](https://forum.xod.io/u/coradias)\
**Post date:** [February 2, 2018, 12:52pm UTC](https://forum.xod.io/t/timer-for-lights/348/10 "2018-02-02T12:52:59Z")

</div>

Hi…if you have metal halide lights a cheap timer will fail at some point as the ballast draws a lot of current for a split second at start up. a heavy duty timer may be a consideration. Otherwise go for a cheap one.

[heavy copper pcb](https://www.7pcb.com/blog/heavy-copper-pcb.php)
