Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Single cheap relay with Uno

  1. #1
    Join Date
    Oct 2018
    Posts
    20
    Post Thanks / Like

    Default Single cheap relay with Uno

    Hi Folks,

    I've been gathering a number of pixels and controllers for my light show, and I realized I want to have a single strand of analog multi-colored lights to join in the fun (mostly because I found them in the garage).
    I already have an Arduino Uno + a cheap relay that came with the Uno kit (rated for 120v and 15A...so it says).

    Is there an available Arduino sketch to get this talking with Vixen so that I can make the lights blinky on cue?

    Thanks,
    Mac

  2. #2
    Join Date
    Dec 2014
    Location
    Southern California
    Posts
    899
    Post Thanks / Like

    Default Re: Single cheap relay with Uno

    Lookup Victor_PV sketch
    Kevin

  3. #3
    Join Date
    Dec 2012
    Location
    Newtown CT
    Posts
    4,082
    Post Thanks / Like

    Default Re: Single cheap relay with Uno

    Mechanical relays can only do on/off. If you want to dim them you will need an SSR adn a ZeroCross detector as well.


    2020 Full sized show reworked for the new location. Only adding (famous last words) 13 RBLs that I finally got converted to using pixels
    2019 - Just moved into a new home (yet another change of plans). Will be dim but not dark. Too much to do at the new place to leave time for a show. Dim show (3000 pixels) had regular visits most nights.
    https://www.youtube.com/channel/UCyX...ttrsZNARkUce0Q

  4. #4
    Join Date
    Oct 2018
    Posts
    20
    Post Thanks / Like

    Default Re: Single cheap relay with Uno

    Quote Originally Posted by kev View Post
    Lookup Victor_PV sketch
    Thanks. Any chance you could provide a link? I've been searching since last night and have only ran into off the wall versions and Victor PV Mods.



    Quote Originally Posted by MartinMueller2003 View Post
    Mechanical relays can only do on/off. If you want to dim them you will need an SSR adn a ZeroCross detector as well.
    Thanks. For now, on off functionality works fine.

  5. #5
    Join Date
    Oct 2014
    Location
    Sauk City, WI USA
    Posts
    1,206
    Post Thanks / Like

    Default Re: Single cheap relay with Uno

    Here is complete code for a serial attached arduino with explanations. It is more than you need but you can easily adjust it for one output.
    https://www.diychristmas.org/wiki/in...chanical_relay

  6. #6
    Join Date
    Dec 2014
    Location
    Southern California
    Posts
    899
    Post Thanks / Like

    Default Re: Single cheap relay with Uno

    Victor_PV sketch can be found here - http://doityourselfchristmas.com/for...th-Random-mode
    Kevin

  7. #7
    Join Date
    Oct 2018
    Posts
    20
    Post Thanks / Like

    Default Re: Single cheap relay with Uno

    Quote Originally Posted by MikeKrebs View Post
    Here is complete code for a serial attached arduino with explanations. It is more than you need but you can easily adjust it for one output.
    https://www.diychristmas.org/wiki/in...chanical_relay
    Thanks. I'm working my way through this code and am completely lost in the header. I pretty much get everything else, but I don't understand that piece. I changed my pins from int channels[] = {2, 3, 4, 5, 6, 7, 8, 10} to int channels[] = {27, 37, 38, 39} (I'm actually working with an old Energia Launchpad microcontroller, so the pins are a bit different). So how does changing my pins change the header? I don't this header !"# or the ASCII code reference.


    Quote Originally Posted by kev View Post
    Victor_PV sketch can be found here - http://doityourselfchristmas.com/for...th-Random-mode
    Thank you. I'm also working my way through that code. It won't work on the Energia microcontroller that I mention above because of the WatchDogTimer in the AVR code, but I will be using it for another relay project on my UNO.

  8. #8
    Join Date
    Oct 2014
    Location
    Sauk City, WI USA
    Posts
    1,206
    Post Thanks / Like

    Default Re: Single cheap relay with Uno

    The header is set in Vixen. It helps to sync your show so the controller (Arduino) knows when to start with channel 1. Vixen will send the header bytes on each packet of data. The code looks for the header and then goes and gets the next X bytes and then turns on the SSR.

    I thought you had a one channel relay? The pins would be set for whichever output you will be using to control the relay. In this case, you would only have one pin defined. In your case, you are defining 4 outputs which is fine if you have 4 relays.

  9. #9
    Join Date
    Oct 2018
    Posts
    20
    Post Thanks / Like

    Default Re: Single cheap relay with Uno

    Quote Originally Posted by MikeKrebs View Post
    The header is set in Vixen. It helps to sync your show so the controller (Arduino) knows when to start with channel 1. Vixen will send the header bytes on each packet of data. The code looks for the header and then goes and gets the next X bytes and then turns on the SSR.
    Ugh...I don't know what any of that means. Well, I don't know what most of it means. I know you don't have all night to explain concepts to an old fool, but I'm hoping you can at least point me in the right direction for some of this. Maybe a YouTube series? Logically, this is how I expect it to work. This is probably completely wrong, which is why I'm struggling.

    From Vixen
    Actual Header in Setup --> >>1, 2, 3<<
    If you turn on blinkylight1, send header 1
    If you turn on blinkylight2, send header 2
    If you turn on blinkylight3, send header 3

    From Arduino / Microcontroller

    If header sends 1, digitalwrite relay 1 (pin 1) to high.
    If header sends 2, digitalwrite relay 2 (pin 2) to high.
    If header sends 3, digitalwrite relay 3 (pin 3) to high.

    There would, of course, be more to write pins to low, but you get the point. Can you illustrate how this works in super simple terms like what I wrote above? I'm a mechanical guy, and I'm afraid if I don't figure this out soon I'll be fixing it with my hammer.

    Quote Originally Posted by MikeKrebs View Post
    I thought you had a one channel relay? The pins would be set for whichever output you will be using to control the relay. In this case, you would only have one pin defined. In your case, you are defining 4 outputs which is fine if you have 4 relays.
    It is just a single relay. I ended up changing that to a single channel, which makes me think I should just remove the array entirely.

  10. #10
    Join Date
    Oct 2018
    Posts
    20
    Post Thanks / Like

    Default Re: Single cheap relay with Uno

    So, I made it work. Yes, I'm a rookie. I forgot to match the Baud rate.

    However, I would still be super appreciative if you could provide me an explanation of how sending a text header of this !"# somehow gets read by this const int CONTROLLER_HEADER[3] = {33, 34, 35}; when we're just dealing with on/off states. I don't want to walk away with this working only to ask this question again in three months (as I did about six months ago).

    Thanks again,
    Mac

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •