Newbie starting question

Hello all...

I've started looking at the Arduino product for a "new" hobby I have started. I've done AV control system programming and I may be over-thinking this!

To get going, I need to figure out the best way to open/close relays on the relay card I have. I have an Mega 2560 controller to run the project.

The relay card has 16 relays. On the card, there are 16 pins which activate the relay when shorted to the ground pin.

I just need to know where to start on the Mega 2560 as far as controlling the relay card. I was wondering about using pinmode or if there is a preferred option.

Looking forward to you responses!

Thank you.

Michael (from Canada)

I need to figure out the best way to open/close relays on the relay card I have.

And the relay card you have is. . .?

You may have missed this

PLEASE DON'T POST YOUR QUESTIONS IN THIS TUTORIAL SECTION

and this

--- I'M SERIOUS - DON'T PUT YOUR QUESTIONS HERE ---

.

Don't worry I've already asked for this to be moved.

Oops! My apologies.

The relay card is a SainSmart 16-Channel 12V Relay Module.

Don't SainSmart provide example code?

If you use the SEARCH function (upper right) you will find lots of good results to help towards your project.
Take not that many times relay failures are often linked to an inadequate power supply.

Almost all Arduinos are not directly capable of powering relay coils directly but simply triggering them.

Could you also take a few moments to Learn How To Use The Forum.

Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

Hello again...

I'm not looking to power the relay coils, just "trigger" them. The relay board is already powered from an external power supply.

Sainsmart does not have any programming information, other than a schematic. I already know how to connections work. It is just a case of triggering them.

I have read the "Learn how to use the forum" page.

I will take your advice and see what I can find via the search option. Thanks for your patience!

A good search starter would be "Newbie starting question" - amazing what you can find - more serious a title that tells people what you have a question about helps others to decide if they even want to look at your question - also a link to in your case to relay card helps others quickly look at the info for the card and they don't have to waste time either searching for your card or guessing at how your card should be hooked up (trigger voltage etc)

Start here.

PyroGuy99:
The relay card is a SainSmart 16-Channel 12V Relay Module.

Please post a link to its datasheet so we can see the details.

...R

Let's start with the correct wiring; I did not look up your module, but hope it has a jumper for JD-Vcc; see e.g. this post
https://forum.arduino.cc/index.php?topic=537877.msg3666059#msg3666059

Next, code wise. Arduino pins can basically be in one if two modes. INPUT so you can read e.g a button and OUTPUT so you can control something. After a reset the pins are in INPUT mode. You use pinMode to change the mode.

Next you need to indicate if you want the control signal (in your case to control the relays) needs to be LOW or HIGH. That's done with digitalWrite.

Hi,
I have left a message at SainSmart about their un-downloadable manual for that relay board.

Tom... :slight_smile:

Hello again...

Thanks for all of the user tips. Much appreciated.

Here is the only data sheet that I was able to get from the Sainsmart. Ironically they had it as a .rar file which I thought was a bit unusual. I've extracted the PDF.

16 relay 2.pdf (55.1 KB)

It looks like a typical example of such relay boards except that the relay coils are taking a 12V supply, so there is no jumper to share Arduino power. Other than that, you can use it as sterretje suggests.

wildbill:
It looks like a typical example of such relay boards except that the relay coils are taking a 12V supply, so there is no jumper to share Arduino power. Other than that, you can use it as sterretje suggests.

There would be no pin for Arduino supply for the rela coils because of the current required to drive ALL 16 coils AFAIK.
Tom... :slight_smile:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.