Automated Dust Collection

@gladewater2016, how much experience do you have with the Arduinos?

Which Arduino do you have?

How many ACS712 do you have?

As I read the code, you need at least 2 (actually will need 4).

I am using the arduino uno and a adafruit 16x12 bit servo shield. If and when I get the project finished, It will be udes on 6 different tools, so there will be 6, acs712,. My arduino knowledge is very limited

How many ACS712 do you have now?

These two lines

String tools[NUMBER_OF_TOOLS] = {"Miter Saw","Table Saw","Band Saw"}; //, "Floor Sweep" int voltSensor[NUMBER_OF_TOOLS] = {A1,A2,A3};

Show which sensor is assigned to each tool.

These lines:

for(int i=0;i

check for the tool to be turned on.

If the one ACS712 you have is wired to A0, it will not cause the DC to turn on. Try plugging it into A1.

The program also has lots of output to the serial monitor. Can you post some using code tags.

I plugged it into A1. The serial plotter is showing a voltage increase when I turn the heat gun on. I am using a heat gun to similate the tool being turned on. I am not getting a signal to turn the dust collector relay on

Does the serial monitor show the arduino is trying to turn on the DC?

void turnOnDustCollection(){ Serial.println("turnOnDustCollection"); digitalWrite(dustCollectionRelayPin,1); collectorIsOn = true; }

When I turn the heat gun on, the amps change from 0.07 to 5.40. So I guess the answer is yes..?

for(int i=0;i

What do you think that the exit statements do in this snippet?

There should not be a guess. The text listed in post #11 will be printed in the serial monitor. The serial monitor is in the same menu and right above the Serial Plotter.

The serial monitor is where I am seeing the amp increase when I turn the heat gun on. It is showing a amp increase on the miter saw from 0.07 to 5.40

You never see it print "turnOnDustCollection"?

no

groundFungus: for(int i=0;i

What do you think that the exit statements do in this snippet?

Find tool and exit loop(). Cute function. I'm thinking this doesn't work very well.

Luckily I can admit that I didn't write it.

I guess the million dollar question is, how do I fix it so it will turn on the dust collector and open a servo for the blast gate for the miter saw?

Actually the exit; does nothing but throw this warning.

...\arduino_modified_sketch_800891\sketch_may17b.ino: In function 'void setup()':

C:\Users\DaD\AppData\Local\Temp\arduino_modified_sketch_800891\sketch_may17b.ino:9:11: warning: statement is a reference, not call, to function 'exit' [-Waddress]
       exit;
           ^
...\arduino_modified_sketch_800891\sketch_may17b.ino:9:11: warning: statement has no effect [-Wunused-value]

The exit(0) function would exit loop, disable interrupts and freeze.

groundFungus:
Actually the exit; does nothing but throw this warning.

...\arduino_modified_sketch_800891\sketch_may17b.ino: In function 'void setup()':

C:\Users\DaD\AppData\Local\Temp\arduino_modified_sketch_800891\sketch_may17b.ino:9:11: warning: statement is a reference, not call, to function ‘exit’ [-Waddress]
      exit;
          ^
…\arduino_modified_sketch_800891\sketch_may17b.ino:9:11: warning: statement has no effect [-Wunused-value]





The exit(0) function would exit loop, disable interrupts and freeze.

That code is in loop(), not in setup(). Why does the compiler think it is in setup()?

I installed the Adafruit PWM Servo library (against my better judgement) and do not get any errors:

Build options changed, rebuilding all
Sketch uses 9122 bytes (3%) of program storage space. Maximum is 253952 bytes.
Global variables use 659 bytes (8%) of dynamic memory, leaving 7533 bytes for local variables. Maximum is 8192 bytes.

I did not say [u]error.[/u]

Do you have all warnings turned on in Preferences? I installed the Adafruit library and compiled his code and got the same warning.

Warnings. Errors. I don't care. I don't release code with warnings.

Show verbose output during compilation is checked and Compiler warnings is set to ALL.

Why would it freeze? Exit() would just bail from loop() back to main(). It does not sound like it is freezing as the OP is reporting seeing the Serial monitor providing data.

I am using the same code that the original builder of the system used. His system is identical to mine. The only exception is, I will be adding more tools than he did.

Any suggestions on how to fix it and make it work?

Arduino and exit(0) I tried to point out a potential problem. The program flow may not be as desired if the exit (whatever it is supposed to do) is ignored. I'm done.