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.
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.
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/datasheets/Kits/SFE-SIK-RedBoard-Guide-Version3.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.
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.
Do you have any spike relays? An arduino can drive them directly.
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.