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.
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.
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)
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.
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.
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...