Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Programming a 12V relay with Arduino (http://www.chiefdelphi.com/forums/showthread.php?t=130582)

panther83 18-09-2014 14:03

Programming a 12V relay with Arduino
 
We are in the process of wiring up a t shirt cannon for my pre-rookie team to be mounted on our modular robot. We have a Arduino micro-controller with the robot open shield. We code to activate the relay, probably in PWM port 9, for a split second to give power to our solenoid to open and shoot the cannon. I have no idea how to code in Arduino or really at all so any help is awesome.

pastelpony 18-09-2014 14:47

Re: Programming a 12V relay with Arduino
 
There is a relay library I'm sure. There should be an example in the Arduino IDE. I hope you're using an external power source.

jee7s 18-09-2014 18:22

Re: Programming a 12V relay with Arduino
 
Arduino is well documented, so I'm sure there's resources for the particular syntax. You'll probably want to use a simple output rather than a PWM. Just pulse the output to get your relay to switch.

The bigger deal is driving the coil. You'll need to make sure your relay will actually switch at the Arduino output voltage. If that doesn't cut it or if the coil needs more current than the arduino output can provide, you'll need some extra circuitry (like a transistor) to handle the coil drive.

wt200999 18-09-2014 20:17

Re: Programming a 12V relay with Arduino
 
Quote:

Originally Posted by jee7s (Post 1400594)
Arduino is well documented, so I'm sure there's resources for the particular syntax. You'll probably want to use a simple output rather than a PWM. Just pulse the output to get your relay to switch.

The bigger deal is driving the coil. You'll need to make sure your relay will actually switch at the Arduino output voltage. If that doesn't cut it or if the coil needs more current than the arduino output can provide, you'll need some extra circuitry (like a transistor) to handle the coil drive.

A perfect example of all of what jee7s mentioned is in the Sparkfun inventors kit, including an example of driving a motor and of driving a relay with code and schematics. The guide for their kit is free and is listed on the product page: http://dlnmh9ip6v2uc.cloudfront.net/...3.0-Online.pdf

Page 71 has the relay example, and you can probably reference what they do in the guide with what your kit does.

Alan Anderson 18-09-2014 21:10

Re: Programming a 12V relay with Arduino
 
If your budget is up for it, you can add the RobotOpen Solenoid Shield to your Arduino. It's perhaps a bit steep for controlling a single solenoid, but it's perfectly supported by the RobotOpen code library.

Gdeaver 19-09-2014 07:55

Re: Programming a 12V relay with Arduino
 
Do you have any spike relays? An arduino can drive them directly.

ajlapp 19-09-2014 12:26

Re: Programming a 12V relay with Arduino
 
Quote:

We have a Arduino micro-controller with the robot open shield. We code to activate the relay, probably in PWM port 9, for a split second to give power to our solenoid to open and shoot the cannon.
Message me or send an email and we can help you get this running...what relays are you driving?

There are several that I know work well. A spike is also good option.

Just reach out and we'll gt this fixed.


All times are GMT -5. The time now is 02:40.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi