CEB Press/Manufacturing Instructions/Detroit Fab Lab Solenoid Driver: Difference between revisions
Jump to navigation
Jump to search
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 | 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> | ||
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. | ||
Revision as of 15: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. 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 all channels up and down. // Serial.println("Fading all pwm channels up to max."); for (i=0; i<=255; i++) { analogWrite(pwm_a, i); analogWrite(pwm_b, i); analogWrite(pwm_c, i); analogWrite(pwm_d, i); analogWrite(pwm_e, i); delay(100); } Serial.println("All pwm channels at max."); delay(1000); Serial.println("Fading all channels to 0"); for (i=255; i>=0; i--) { analogWrite(pwm_a, i); analogWrite(pwm_b, i); analogWrite(pwm_c, i); analogWrite(pwm_d, i); analogWrite(pwm_e, i);
delay(100); }
Serial.println("All pwm channels at zero."); delay(1000); 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);
}