Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Hardware
  3. Controlling existing relays

Controlling existing relays

Scheduled Pinned Locked Moved Hardware
54 Posts 9 Posters 30.8k Views 6 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    twosh
    wrote on last edited by
    #45

    Thanks for the suggestion, @Sparkman !
    I have just the radio connected for now, but still getting that "version mismatch"-error. I will try getting a separate 3.3v power to the radio tomorrow and see if that would help.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      twosh
      wrote on last edited by twosh
      #46

      @Sparkman
      I tried powering the Megas radio from a Nanos 3.3V pin and GND. The Nano is working fine as a sensor by itself, so I guess the radio gets enough power from it. However, this way I only got "check wires" from the Mega... :(

      Just a thought; if it helps, I'm defining these pins for the Mega in my sketch, but I don't see how that could affect this particular problem...

      const int relayPin[] = {22, 23, 24, 25, 26, 27, 28, 29};
      const int currentPin[] = {A0, A1, A2, A3, A4, A5, A6, A7, A8, A9};
      
      SparkmanS 1 Reply Last reply
      0
      • T twosh

        @Sparkman
        I tried powering the Megas radio from a Nanos 3.3V pin and GND. The Nano is working fine as a sensor by itself, so I guess the radio gets enough power from it. However, this way I only got "check wires" from the Mega... :(

        Just a thought; if it helps, I'm defining these pins for the Mega in my sketch, but I don't see how that could affect this particular problem...

        const int relayPin[] = {22, 23, 24, 25, 26, 27, 28, 29};
        const int currentPin[] = {A0, A1, A2, A3, A4, A5, A6, A7, A8, A9};
        
        SparkmanS Offline
        SparkmanS Offline
        Sparkman
        Hero Member
        wrote on last edited by
        #47

        @twosh What happens if you remove those lines or comment them out? I have used a Mega with an NRF24 successfully before with the NRF powered from the 3.3v source on the Mega, but I didn't have any sensors connected. I would try a very simple sketch first to see if that works.

        Cheers
        Al

        1 Reply Last reply
        0
        • T Offline
          T Offline
          twosh
          wrote on last edited by twosh
          #48

          Thanks @sparkman for once again nudging me in the right direction!
          I went trough the code in my sketch a couple of times commenting out various sections and suddenly the sensor started functioning correctly. So I checked that function closely and noticed that I was out of bounds in a for-loop. that stupid NUMBER_OF_CURRENT_PINS +1 . That +1 had accidentally stayed there from an early version of the sketch. Correcting that, my sketch seems to load without problems - go figure! :P

          1 Reply Last reply
          0
          • J Offline
            J Offline
            jemish
            wrote on last edited by
            #49

            how can I control fan speed using light dimmer sketch in openhab?

            SparkmanS 1 Reply Last reply
            0
            • T twosh

              Great, thanks for the clarifications @Sparkman !

              Being able to measure power would of course be a nice bonus! I'll think about it. I have another question (of course... :) ).

              The Nano and Pro mini have only 6 analogue inputs, I would be having need for 8... Would I need to use two arduinos or is there any other way?

              Best,
              Tim

              P Offline
              P Offline
              phil pritchard
              wrote on last edited by
              #50

              @twosh said:

              Great, thanks for the clarifications @Sparkman !

              Being able to measure power would of course be a nice bonus! I'll think about it. I have another question (of course... :) ).

              The Nano and Pro mini have only 6 analogue inputs, I would be having need for 8... Would I need to use two arduinos or is there any other way?

              Best,
              Tim

              Have you thought of sticking a hall effect sensor to the outside of the relay. Or in the magnetic flux.

              Phil

              T SparkmanS 2 Replies Last reply
              1
              • P phil pritchard

                @twosh said:

                Great, thanks for the clarifications @Sparkman !

                Being able to measure power would of course be a nice bonus! I'll think about it. I have another question (of course... :) ).

                The Nano and Pro mini have only 6 analogue inputs, I would be having need for 8... Would I need to use two arduinos or is there any other way?

                Best,
                Tim

                Have you thought of sticking a hall effect sensor to the outside of the relay. Or in the magnetic flux.

                Phil

                T Offline
                T Offline
                twosh
                wrote on last edited by
                #51

                @phil-pritchard No, not really. As I've mentioned tinkering with hardware is new to me so I don't actually have any knowledge of what exists and whats possible from that side of the table. Would you like to expand on your thoughts? :)

                I've ordered a bunch of these hall effect sensors: http://www.ebay.com/itm/221649135732?rmvSB=true

                G 1 Reply Last reply
                0
                • J jemish

                  how can I control fan speed using light dimmer sketch in openhab?

                  SparkmanS Offline
                  SparkmanS Offline
                  Sparkman
                  Hero Member
                  wrote on last edited by
                  #52

                  @jemish said:

                  how can I control fan speed using light dimmer sketch in openhab?

                  You may want to start a new thread as your question is a bit off-topic to the discussion.

                  Cheers
                  Al

                  1 Reply Last reply
                  0
                  • P phil pritchard

                    @twosh said:

                    Great, thanks for the clarifications @Sparkman !

                    Being able to measure power would of course be a nice bonus! I'll think about it. I have another question (of course... :) ).

                    The Nano and Pro mini have only 6 analogue inputs, I would be having need for 8... Would I need to use two arduinos or is there any other way?

                    Best,
                    Tim

                    Have you thought of sticking a hall effect sensor to the outside of the relay. Or in the magnetic flux.

                    Phil

                    SparkmanS Offline
                    SparkmanS Offline
                    Sparkman
                    Hero Member
                    wrote on last edited by
                    #53

                    @phil-pritchard said:

                    Have you thought of sticking a hall effect sensor to the outside of the relay. Or in the magnetic flux.

                    Phil

                    The relays are latching relays, so there would only be magnetic flux present for short durations. You would have a pulse when the light was turned on and one when the light was turned of, so you would have to find a way to count these pulses to know what state the light was in. The risk is that you would miss one and then be out of sync.

                    Cheers
                    Al

                    1 Reply Last reply
                    0
                    • T twosh

                      @phil-pritchard No, not really. As I've mentioned tinkering with hardware is new to me so I don't actually have any knowledge of what exists and whats possible from that side of the table. Would you like to expand on your thoughts? :)

                      I've ordered a bunch of these hall effect sensors: http://www.ebay.com/itm/221649135732?rmvSB=true

                      G Offline
                      G Offline
                      gizzmo
                      wrote on last edited by
                      #54

                      @twosh any update on your project?
                      I have exact the same setup, would love to see your code :-)

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      16

                      Online

                      11.7k

                      Users

                      11.2k

                      Topics

                      113.0k

                      Posts


                      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • MySensors
                      • OpenHardware.io
                      • Categories
                      • Recent
                      • Tags
                      • Popular