Go Down

Topic: Minimum Hardware Requirement  (Read 135 times) previous topic - next topic

rOBvAN

Hey.

I am new to Arduino but before I start I have a question about what motherboard/expansion modules I need or can use.
I have a simple but physically large system I'd like to automate with relays (with the potential to do more in the future).

The main requirement is the ability to control at least 15 relays.
If they are all PWM controlled I would need a board with at least 15 digital outputs that can be configured to be PWM. So I would need the mega2560.

The next main requirement is for the board to communicate with an external system via serial RS232. Would this require some sort of adapter/module? I want to send and receive ASCII/HEX codes to and from the Arduino. I see that it is "Serial" but it is also TTL which I am unfamiliar with.

Thanks for any help you can provide.



larryd

#1
Aug 25, 2019, 06:49 pm Last Edit: Aug 25, 2019, 06:52 pm by larryd
Why in the world would you want to control a relay using PWM. ???

What loads are the relays controlling?

Yes you need a TTL to RS232 converter if you need RS232 levels, lots on the internet.




No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

CrossRoads

Relays and PWM do not go well together.  The chattering will be noisy, and they have a lifetime limit of how many contact closures they are rated for.

Using Analog.write(pin, level) with level from 0 to 255 will put out a square wave of varying width at ~488 Hz (cycles/second).
If the relay was rated for 1,000,000 cycles, then after 1000000 cycles/ 488 cycles/second = 2049 seconds it will be nearing the end of it life. (34 minutes)


To communicate via RS232 you need something with a MAX232 family of chip on it, such as
http://www.nkcelectronics.com/RS232-to-TTL-converter-board-DTE-with-Male-DB9-33V-to-5V_p_369.html

(forum may stick some extra characters on the start and end of that)

to convert the RS232 level of +/-3V to +/-12V (typical, could be as high as 25V) down to 0/5V for the Mega to use on Serial1, Serial2, or Serial3.
Serial (0, if you will) is setup to communicate with a PC via USB,  so I wouldn't connect the RS232 module to that.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

rOBvAN

Great! That's all I need right now. You are right, it probably won't be PWM in the end.

Thanks again for taking the time to reply.

larryd

#4
Aug 25, 2019, 07:09 pm Last Edit: Aug 25, 2019, 07:10 pm by larryd
Actually a relay will not operate 'at' PWM frequencies.



No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

wvmarle

Using Analog.write(pin, level) with level from 0 to 255 will put out a square wave of varying width at ~488 Hz (cycles/second).
If the relay was rated for 1,000,000 cycles, then after 1000000 cycles/ 488 cycles/second = 2049 seconds it will be nearing the end of it life. (34 minutes)
I don't think a relay will be able to physically react that fast. The induction of the coil will also seriously smooth out the current. It's more likely either on or off, depending on whether the resulting current is enough to activate the coil.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

Paul_KD7HB

Actually a relay will not operate 'at' PWM frequencies.




Certainly not the Ebay relays, but a bi-polar relay will operate that fast.

Paul

PaulRB

#7
Aug 25, 2019, 08:32 pm Last Edit: Aug 25, 2019, 08:43 pm by PaulRB
Yes, you can use relays with PWM. Your kitchen microwave does that, for example. When you select "low", "medium" or "high", a relay switches on & off the cyclotron using pwm. But the period of that pwm signal is measured in seconds rather than milliseconds or microseconds. If the cyclotron is switched on for 5s in each 10s period for "medium" power, that's just a 50% duty cycle pwm signal.

But periods of seconds are not what the Arduino community normally refers to as pwm. You can't do 5s in 10s with analogWrite(). Someone will prove me wrong about that, I bet! Some code to fiddle the AVR timer registers or something...

dave-in-nj

Well, by now we know that relays and PWM are not the first choice for.... well, we have no idea what you are doing.

Can you tell us what you want to control with the relays ?   voltage, power and hopefully with a link to a data sheet.

Chances are there is some way to do what you want with common parts.

david_2018

#9
Aug 25, 2019, 08:52 pm Last Edit: Aug 25, 2019, 08:53 pm by david_2018
The main requirement is the ability to control at least 15 relays.
If they are all PWM controlled I would need a board with at least 15 digital outputs that can be configured to be PWM. So I would need the mega2560.
You have already gotten advice about not needing PWM, but 15 relays do not necessarily require a mega2560.  A couple of shift registers will give you 16 digital outputs capable of driving the common optically-isolated relay boards, only requiring a couple of pins on the arduino.

Quote
The next main requirement is for the board to communicate with an external system via serial RS232.
That would be something that would tend to favor an arduino with a second hardware serial port (the mega has four, counting the USB interface).  The UNO can implement a software serial port, but that has its limitations, particularly if you need a high baud rate.



wvmarle

YBut periods of seconds are not what the Arduino community normally refers to as pwm. You can't do 5s in 10s with analogWrite(). Someone will prove me wrong about that, I bet! Some code to fiddle the AVR timer registers or something...
LOL you gave a challenge :-)
Timer1 16-bit so 65535 max value.
Highest prescaler f/1024 so at 16 MHz that's an overflow after just over 4 seconds. Meaning 10s to overflow is possible if you reduce the clock to <6 MHz or so. So yes, should be possible, but totally impractical and just fiddling the registers a bit is not enough.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

Go Up