Arduino Mega Capability

Hello,
I am in the process of creating a tv lift cabinet for my bedroom. I have quite a few functions I want the arduino to perform with the cabinet/tv.

-I have a 12 volt motor which I will be using relays to control. I need to control several relays as it is a DC motor and I need to reverse the wires to reverse the motor direction. I will end up using the 2 relay shield with a NC and NO connection to achieve this and would like a third relay to shut off the 12 volt power supply when the motor is not in use.

-I will be hooking up two limit switches to the arduino to communicate the tv lift cabinets current position.

-A TFT touchscreen for control and status.

-IR receiver to receive signals from a spare remote control and relay them to the tv.

-IR LED to emit IR for the tv to receive (this needs to be done as I do not have a remote that works with the tv currently).

-NRF24L01 transceiver module. To get around having to get another cable box (and pay for it).. I am splitting the hdmi going to the living room tv and running a 50 ft hdmi to the bedroom tv. So I don't have to go to the living room to change channels every time I would like to send the IR information received by the IR receiver in the bedroom to another arduino in the living room and bounce the signal to the cable box.

My concern is that I will not have enough pins, memory,power from arduino, etc. to achieve all this through one arduino.

Summary

arduino mega
-NRF24L01
-IR LED
-IR Receiver
-2 limit switch inputs
-at least 3 relays

Can it be done or am I going to have to have a master arduino sending commands to several other arduinos?

Thanks for any help,
-C

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html

Can you please tell us your electronics, programming, Arduino, hardware experience?

Thanks.. Tom... :slight_smile:

cj8990:
-I have a 12 volt motor which I will be using relays to control. I need to control several relays as it is a DC motor and I need to reverse the wires to reverse the motor direction. I will end up using the 2 relay shield with a NC and NO connection to achieve this and would like a third relay to shut off the 12 volt power supply when the motor is not in use.

You normally need four relays in H-bridge configuration to change polarity. Those same relays can completely cut the power to the motor if needed.

Furthermore you should add something like a solenoid lock to secure the lift in the top position, so it can't come down by itself.

My concern is that I will not have enough pins, memory,power from arduino, etc. to achieve all this through one arduino.

So far it sounds like a single Uno can handle this easily. I don't see the need even for a Mega.

an Arduino mega should have sufficient IO capability to support your project
using sperate programs to implement functions to control and test each each IO device
once operational you can combine the functions into a complete system checking each device as you add it to the system

You normally need four relays in H-bridge configuration to change polarity

Or one DPDT relay to perform the polarity swapping, and one for the on/off control.

When changing direction, stop (turn off the supply), let the motor spin down, then reverse the polarity and power on again. The supply relay COULD be a PWM FET to provide speed control as well.
Also consider a protection diode BEFORE the polarity relay - so the DC source is not hit withback EMF spikes.

True, this works, but you have to make very sure those two relays switch at the exact same time (at least to the millisecond) so they don't ever cause a short. With a four-relay H-bridge (or four MOSFETs, or a single IC) that's much easier to assure.

...but you have to make very sure those two relays switch at the exact same time (at least to the millisecond) so they don't ever cause a short.

Not exactly... or at all...
Turn the *supply relay off, then do whatever you want with the *direction relay (there is no power on the direction relay contacts or the motor, and no EMF path back to the supply#)...
Then reapply power when you need to drive the motor fwd or backward as desired.
No timing conflicts, unless you leave the power on and mash the motor into reverse - and that can happen with an h-bridge (possibly more easily).
Best practice suggests someone is monitoring the motor state, and only applies power when it’s stopped - or as good as.

If we want to be clever, we can also make the *supply relay into a DPDT as well, and dump the back EMF (if the motor is still spinning down) into a sink for electronic braking effect.

wvmarle:
True, this works, but you have to make very sure those two relays switch at the exact same time (at least to the millisecond) so they don't ever cause a short. With a four-relay H-bridge (or four MOSFETs, or a single IC) that's much easier to assure.

How would you get the direction DPDT relay to be on and off at the same time to cause a short? I have used this configuration with DPDT ON-ON switches and DPDT relays for 20+ years because you are guaranteed not to short anything. It is far more likely for a pair of the mosfets in H bridge to be enabled and form the short from power to ground. When you are using a switch for control, a DPDT ON-OFF-ON is the best as you get the direction and on-off in the same device.

lastchancename:
Not exactly... or at all...
Turn the *supply relay off, then do whatever you want with the *direction relay (there is no power on the direction relay contacts or the motor, and no EMF path back to the supply#)...
Then reapply power when you need to drive the motor fwd or backward as desired.
No timing conflicts, unless you leave the power on and mash the motor into reverse - and that can happen with an h-bridge (possibly more easily).
Best practice suggests someone is monitoring the motor state, and only applies power when it’s stopped - or as good as.

If we want to be clever, we can also make the *supply relay into a DPDT as well, and dump the back EMF (if the motor is still spinning down) into a sink for electronic braking effect.

wvmarle:
You normally need four relays in H-bridge configuration to change polarity. Those same relays can completely cut the power to the motor if needed.

Furthermore you should add something like a solenoid lock to secure the lift in the top position, so it can't come down by itself.

So far it sounds like a single Uno can handle this easily. I don't see the need even for a Mega.

I am using a linear actuator to raise and lower the tv so the threaded rod prevents any failures with the tv falling. As for the motor control I was planning on doing what lastchancename posted along with a relay to shut off the 12 volt power supply while changing the directional relays. This has made me realize another concern though which is if the relay for the power supply fails for whatever reason the directional relays will introduce a (momentary) direct short while they switch directions. In order to relay information to the arduino to confirm the power supply has shut off I was thinking of getting a 12 volt relay (probably just an automotive style one since I have some laying around) which would be activated by the power supply while it is on (wired in parallel to the motor and motor relays). Then using the switched portion of the relay it would act just like a button feeding 5v to an input pin on the arduino. This way a variable can monitor what the status of the power supply directly.

I know the coil side of a relay will fry an arduino but what about the switched side?

Is there a more elegant solution that I am unaware of?

cj8990:
... This has made me realize another concern though which is if the relay for the power supply fails for whatever reason the directional relays will introduce a (momentary) direct short while they switch directions. ...

If the power supply fails and the relay causes the direct short, then what is the issue? The power supply has already failed.

How are you going to get a direct short between the normally open and normally closed contacts?

Although lastchancename drew the circuit with two SPDT relays, he speaks of them being a single DPDT relay. Using a DPDT relay reduces the chance of the one contact being connected to normally open while the other is connected to normally closed to almost nil. (sure it could happen and I could win the lottery too).

cj8990:
I know the coil side of a relay will fry an arduino but what about the switched side?

The contacts of a relay are not much different than those of a switch. Depends on what voltage is applied.

cj8990:
In order to relay information to the arduino to confirm the power supply has shut off I was thinking of getting a 12 volt relay (probably just an automotive style one since I have some laying around) which would be activated by the power supply while it is on (wired in parallel to the motor and motor relays). Then using the switched portion of the relay it would act just like a button feeding 5v to an input pin on the arduino. This way a variable can monitor what the status of the power supply directly.

One way is to use a 12V relay connected directly to the power supply output and connect the contacts to the arduino 5V and a digital input pin. There is a solid state method that uses a 10V zener diode, current limiting resistor and an optocoupler to do the same thing. All those items are connected in series to the power supply output and the output transistor of the opto coupler is connected to a digital input (the status of the input pin is inverted 0=good, 1=bad). The advantage to the latter is two fold. First, less current draw and second, doesn't use a mechanical relay.

Although lastchancename drew the circuit with two SPDT relays, he speaks of them being a single DPDT relay

Sorry - it was a very old drawing - meant to clearly illustrate the separation of the Poles of the relay, and how they drive the motor.

p.s. it is effectively impossible to short the supply, or (try to) run the motor in both directions - unless the relay fails mechanically, or you're lucky enough to get a make-before-break relay (also a special order)... then you have a different problem altogether!

You're all worrying about the wrong things!
Get an (infallible) H-bridge or (regular) DPDT relay. End of Story!

adwsystems:
Although lastchancename drew the circuit with two SPDT relays, he speaks of them being a single DPDT relay.

One way is to use a 12V relay connected directly to the power supply output and connect the contacts to the arduino 5V and a digital input pin.

Ahh.. sorry! This is the part I missed. A single DPDT relay. In my head I was going with two SPDT relays to carry out polarity swapping and a third relay for power on off. I was concerned with the possibility of the power relay failing in the on position and the two SPDT polarity relays carrying on and causing a direct short between + and - off the power supply.

This is what I had in mind.