1

I don't actually have to achieve this, it's more of an attempt to see what the best way to do this is. I'm sure the answer also differs depending on what circuitry you're trying to connect.

In this case, I plan on an Arduino (probably a Pro Mini or similar) that will control some RGB LEDs (via the WS2811 chip). If I wanted to add a second Arduino that would drive the LEDs if the first one failed (obviously very unlikely), I was wondering how I would do it. The WS2811 chip takes 5V, GND and data in.

My best attempt at a solution is using 3 relays which are SPDT. Connect the LEDs to the main Arduino via the normally open, which is controlled by that particular Arduino, and connect the LEDs to the backup Arduino via the normally closed, which is held open by the main Arduino. In the event of a failure, the main Arduino would lose connection to the LEDs while the backup would make a connection.

This probably isn't a very safe way of doing it (especially if the relay failed for example). Is there a way to do this?

The two Arduinos will be powered from two separate laptops.

2
  • 1
    You are also assuming that the Arduino pin will go LOW if it fails. Also, what if it fails because of a faulty power supply. Then after the power supply takes down the first arduino, it would then take out the second. I'd rather invest time in making the setup and software more robust. E.g. enabling the WatchDog-timer inside the Arduino.
    – Gerben
    Commented Dec 27, 2016 at 20:26
  • 3
    And is there a particular reason you think the relay will be more reliable than the Arduino? You still have a single point of failure, and now it's a device with moving parts.
    – Mark Smith
    Commented Dec 27, 2016 at 20:33

2 Answers 2

1

You first need to make a communication between both Arduinos and then you can control RGB led from any Arduino.

For the connection between both the Arduinos, you can make a serial port interface for doing this, you just need softwareserial.h library. Then you just need to connect the RGB LED to one Arduino. Then when you send a command from another Arduino to that one, the Arduino (Connected to RGB LED) can operate the LED according to the command.

0

You can try something like this:

Tie both arduino 5V to WS2811 chip VCC.

Tie both arduino GND to WS2811 chip GND.

Tie both arduino DATA LINE to WS2811 chip DATA LINE.

Tie an analog input pin from the backup arduino to chip DATA LINE.

Tie an analog input pin from the main arduino to chip DATA LINE.

Issue RS232 or some form of communications between the main and backup arduino.

Program the main arduino to control the data line. Program the second arduino to:

  • Sleep, if DATA LINE PWM is present. (Optional: Ask main arduino if operational)
  • If DATA LINE PWM is absent (you'll see this from analog input), ask main arduino if he is okay or if this is a fault
  • If no answer is received and PWM is absent, assume main arduino dead, start own PWM on DATA LINE. Also, send message to main arduino that the backup is currently online and he should not intervene.
  • If main arduino comes alive, he first checks if backup is operational (Also it's good to read if PWM exists). If message is received that backup is operational, send message to backup to shut off and take DATA LINE for self.
  • If no message is received and no PWM is present in DATA LINE, assume backup dead, take DATA LINE to self.

Further notes:

  • If you decide to use communications, make sure to use a handshake algorithm to prevent accidental interventions.

  • You can do this project without the communications between chips but it will depend on your project and will require some clever coding.

  • Make sure you create some clever time gaps on those messaging and reading stuff.

  • I would advise you to both use analog readings and communications because it is a sort of double check on seeing who is active at the moment. Communications will ease your code development and analog read is required in case of com line failure.

Good luck!

P.S. Don't just use relays like that. It will make debugging and code writing very difficult.

6
  • One other tip: add small resistors on the data outputs of each Arduino (in series) of maybe 100Ω or so. This will limit current through both GPIO pins in the event that you get both Arduinos driving the data line at once.
    – Majenko
    Commented Dec 27, 2016 at 21:53
  • I forgot to mention that the two Arduinos will be powered from different laptops. Does that matter? Commented Dec 27, 2016 at 22:04
  • As long as you connect their (the arduinos) GND lines, you should be fine. On this schematic though, arduino GND's are already connected so it is okay. Also, please consider Majenko's advice. Use resistors, capacitors etc. wherever necessary.
    – user29094
    Commented Dec 27, 2016 at 22:15
  • Surely it cannot be safe to supply the WS2811 with 5V from both Arduinos?! Commented Dec 28, 2016 at 22:32
  • I think it's safe enough if you put a series diode on that 5V supply of both arduinos. This will prevent reverse current on 5V pin. Add 220Ohm resistors in series to data line of both arduinos like Majenko says. This will prevent your pins of burnout if you make a coding mistake. About the GND, it is possible that there is static/DC electricity flow from one laptop from the other on the GND line. This can cause problems. Try to use one laptop if possible. If not, try to connect GND's before the arduinos with some good soldering. This is optional/case dependant, of course.
    – user29094
    Commented Dec 28, 2016 at 23:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.