CEB Press/Manufacturing Instructions/Detroit Fab Lab Solenoid Driver: Difference between revisions
William Neal (talk | contribs) No edit summary |
William Neal (talk | contribs) No edit summary |
||
Line 9: | Line 9: | ||
Here is some sample source code to test the five connections. <html><b>Warning: Connecting the drivers to the solenoid unit incorrectly can ruin the unit.</b> </html> | Here is some sample source code to test the five connections. <html><b>Warning: Connecting the drivers to the solenoid unit incorrectly can ruin the unit.In particular, you should watch the polarity of the connections and ensure that opposite sides of one solenoid are not turned on at the same time.</b> </html> | ||
It is recommended that the board be fully tested first and then connected to the solenoid drivers. After this, circuit connections should be double checked before operating the solenoids. | It is recommended that the board be fully tested first and then connected to the solenoid drivers. After this, circuit connections should be double checked before operating the solenoids. | ||
Line 21: | Line 21: | ||
void setup() | void setup() | ||
{ | { | ||
// | |||
pinMode(pwm_a, OUTPUT); | pinMode(pwm_a, OUTPUT); | ||
pinMode(pwm_b, OUTPUT); | pinMode(pwm_b, OUTPUT); | ||
Line 32: | Line 33: | ||
void loop() | void loop() | ||
{ | { | ||
fade_channel(pwm_a); | fade_channel(pwm_a); |
Revision as of 20:06, 23 July 2011
The Detroit Fab Lab has provided a custom-manufactured board that offers the five solenoid driver outputs required by the CEB Press. The card plugs into the Arduino Breakout Shield. The Five pins used to drive the five solenoid connections are as follows:
- D11
- D10
- D9
- D6
- D3
Here is some sample source code to test the five connections. Warning: Connecting the drivers to the solenoid unit incorrectly can ruin the unit.In particular, you should watch the polarity of the connections and ensure that opposite sides of one solenoid are not turned on at the same time. It is recommended that the board be fully tested first and then connected to the solenoid drivers. After this, circuit connections should be double checked before operating the solenoids.
int pwm_a = 11; int pwm_b = 10; int pwm_c = 9; int pwm_d = 6; int pwm_e = 3; int i;
void setup() { //
pinMode(pwm_a, OUTPUT); pinMode(pwm_b, OUTPUT); pinMode(pwm_c, OUTPUT); pinMode(pwm_d, OUTPUT); pinMode(pwm_e, OUTPUT);
Serial.begin(9600);
}
void loop() {
fade_channel(pwm_a); fade_channel(pwm_b); fade_channel(pwm_c); fade_channel(pwm_d); fade_channel(pwm_e);
}
void fade_channel(int channel) {
Serial.println("Fading pwm channel to max: "); Serial.println(channel); for (i=0; i<=255; i++) { analogWrite(channel, i); delay(100); }
Serial.println("pwm channel at max."); delay(1000); Serial.println("fading down."); for (i=255; i>=0; i--) { analogWrite(channel, i); delay(100); }
Serial.println("pwm channel at 0."); delay(1000);
}