Arduino-controlled external power supply to another microcontroller

Hi all,

I was wondering if you could suggest an Arduino-based solution for a problem of mine at least generally. I have a HiKey 960 board that I use to run continuous experiments. The board crashes intermittently a few times per day -- it switches off completely and can only be started by unplugging and plugging the external power supply. Debugging the application that causes the crashes is currently not feasible, so for now I want to have a remote control over the board's power supply.

The solution I have in mind is connecting HiKey's power supply to a breadboard with something like a relay and connecting the relay to the HiKey. The relay would be driven by an Arduino, that is connected to a PC. The PC is always connected to HiKey and could detect when the latter crashed; then it would send a signal to the Arduino, and the Arduino would close and open the relay.

The HiKey board is not cheap, so I wouldn't want to fry it. Do you think this would be a good and safe solution? If yes, could you advise which relay to choose and what the circuit should look like? Otherwise, could you recommend a better solution? I am mostly concerned with the hardware aspect of the project.

I have Arduino Leonardo R3; the HiKey's power supply is 12V and 2A.

Thank you in advance!

The simple solution would be to use a solid state relay that could be controlled by the Leonardo and which could turn on and off the power to your board.

You could use an electromechanical relay but the Leonardo I/O pins cannot provide enough current for the coil so you would need to get the Leo to control a transistor which controls the current in the relay coil.

...R

Robin2: The simple solution would be to use a solid state relay that could be controlled by the Leonardo and which could turn on and off the power to your board.

You could use an electromechanical relay but the Leonardo I/O pins cannot provide enough current for the coil so you would need to get the Leo to control a transistor which controls the current in the relay coil.

...R

Many thanks for this, Robin. Would the transistor need an external power supply to get the current that Leo cannot provide? Can I use the same one for both HiKey and transistor?

Could I use such relay for 12V 2A power supply? https://uk.rs-online.com/web/p/solid-state-relays/9061079/ Could you recommend a transistor?

That RS relay should work fine - sorry, my internet connection is misbehaving so I can't view the RS website at the moment to see if there is anything more suitable.

You generally don't need a transistor with a solid state relay.

With the RS part you have linked to I believe you will need a 470 ohm or 560 ohm resistor between the Arduino I/O pin and the control pin to limit the control current. Internally within the relay I think the input operates an LED.

...R

Understood about the resistor, thanks.

I just realised that I need a normally closed (NC) relay since I want the external power to be conducted by default until Arduino switches it off temporarily to reset HiKey. This link I posted is a normally open (NO) relay. I found two solutions here, I wonder if you could advise:

1) Buy an NC relay such as MPDCD3-B. NC relays seem to be more expensive — this one is 18 gbp vs NO’s 3 gbp.

2) Use an NO relay with an inverter curcuit like shown on Figure 1 here. The idea is to connect HiKey’s power supply not only to relay’s load pin, but to the control pin through a resistor as well, which would always keep it open. In parallel with the power supply to the control pin, I would connect a transistor controlled by Arduino. When Arduino opens the transistor, the power supply would redirect to the ground, thus opening the relay. Do you think this would be feasible?

Sorry for so many questions — I am quite bad with electronics, so I am afraid that I missed something and my curcuit will fry my office :)

It would be a lot cheaper to use an electromechanical relay. Most of the have both NC and NO contacts.

Silly me, I forgot - you can get these relay modules that work directly with an Arduino. Lots of people supply them. (I even have a few of them on my desk behind this laptop!)

...R

It depends. If you power the Arduino from HiKey's power supply, it's always working while power is available, and you can implement NO/NC in software.

With separate power supplies you cannot turn on the relay while the control power is off. I.e. a transistor is useless if not powered. In this case you'll need a NC or SPDT relay, be SSR or old school.

DrDiettrich, thanks!

Robin2, this looks like exactly what I need! A few follow-up questions: I am thinking of buying a multichannel relay for future projects, and am a bit confused in regards to the separate power supply for the coil, since this tutorial mentions that powering the coil with Arduino's 5V can damage the Arduino. The 1-channel relay has no JDVcc and no separate Ground, the 2-channel relay has both JDVcc and a separate Ground, and the 4-channel relay has JDVcc, but no separate Ground.

1) Is it safe not to use separate power supply for a 1-channel relay?

2) For multi-channel relays, is it safe to use the HiKey's power supply in parallel for both the coil and the HiKey board?

3) For a 4-channel relay, would I need to connect coil's power supply Ground to Arduino's Ground?

The purpose of the jumper is to allow you to electrically isolate the relay outputs from the inputs. It would be wise to do that if the relay was handling dangerous mains voltages. For low voltage operation I don't think it is necessary.

For one or two relays I would see no problem powering them from an Uno's 5v pin.

In the project I am building I am using the 4-channel relays and both the relays and the Atmega 328 will be powered from the same 5v supply - but the 5v for the relays will not be coming through the Atmega 328.

I had not realized the single channel relay board is different.

There is some additional information on the HobbyComponents Support Forum

Or send them an email. They are very helpful.

...R

Robin2, much appreciated!