element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum MQTT and three way switches
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 7 replies
  • Answers 5 answers
  • Subscribers 667 subscribers
  • Views 1140 views
  • Users 0 members are here
  • rasberry_pi_3_b_plus
  • raspberry_pi
Related

MQTT and three way switches

andrequeiroz.com
andrequeiroz.com over 5 years ago

Hello, I am developing a lighting service for my home. I am using raspberry3 + 8 channel relay card + mqtt, everything works fine but I would like to add three way switches. My question is how to update the status of lights in mqtt if this is triggered by the switch?

  • Sign in to reply
  • Cancel
  • jw0752
    0 jw0752 over 5 years ago

    Hi Andre,

     

    Can you monitor the voltage at the light itself?

     

    John

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • andrequeiroz.com
    0 andrequeiroz.com over 5 years ago in reply to jw0752

    Hello John, I had not thought of that.

    Is there any way to do this at low cost?

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • clem57
    0 clem57 over 5 years ago

    Take a look at https://www.youtube.com/watch?v=GEJCk-Dr3BQ . They talk about many thing including 3 way switch.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • jw0752
    0 jw0752 over 5 years ago in reply to andrequeiroz.com

    Hi Andre,

     

    I would need to know more about your system and the voltages involved to give you a correct answer. The three way light switch setup gives you off and on control of a light from two positions but the light itself remains binary. It is either on or off. I am not familiar with how the mqtt senses but there is certainly a way for us to interface it to the light. Is the mqtt for this circuit currently sensing a voltage? Is it the same voltage as the light? Draw a schematic of your circuit for this light and if I can't give you a definitive answer someone else will be able to.

     

    If you are putting the 3 way switching in the software of the Raspberry so the you continue to use the same relay for the light and just use the second (3way) switch location to tell the RP the position of that switch then I would suspect that your current mqtt sensing would remain unchanged.

     

    If you are putting the 2nd (3way) switch in the light circuit then also be aware that the relay on your relay board will need to have a SPDT set of contacts.

     

    John

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • andrequeiroz.com
    0 andrequeiroz.com over 5 years ago in reply to clem57

    I think that would not be the best solution. because the costs are high and would have many devices connected to wifi.

    I was thinking of a board with addressable channels. this would be linked to the switches and the raspberry.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • ravi_butani
    0 ravi_butani over 5 years ago

    instead of using mechanical switch to control the load directly, use it as a digital input of control system (Pi) than you can read the status as well

    • Cancel
    • Vote Up +5 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • andrequeiroz.com
    0 andrequeiroz.com over 5 years ago in reply to ravi_butani

    Good idea ravi, would you have to use multiple digital input on a port? because the relay card has 16 channels, and if you use a digital input by gpio I think that gpio is missing.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube