Automated Dust Collection

I connected a led to pin 11 and ground. The led came on as soon as I connected it

Are all of the analog inputs that you are using at near 0V? If any are floating (or high) that could turn on the LED.

@gladewater2016, any chance of posting pictures of your setup?

I added a picture of my setup.

Why no power for the Arduino? They don't tend to work well without.

woops. Power now

sorry. uploaded wrong pic

The analog inputs A2 and A3 are floating so may be reading high enough to be mistaken for a tool on condition, Ground the unused analog inputs and try your code.

I grounded A2 and A3. Now I am getting a signal to 11 before I turn the tool on. When I turn the tool on, the relay stays on

a2 and a3 grounded

gladewater2016:
I grounded A2 and A3. Now I am getting a signal to 11 before I turn the tool on. When I turn the tool on, the relay stays on

That's as it should be, isn't it?

Can you show a sample of the serial monitor output as you power a tool on and off?

It is switching the relay now. It is just working backwards from what I expected. But that is fine.. Now the next problem is the servo. When the tool is turned on, I am not getting a signal to open the servo. I added a 5vt power supply to the adafruit servo board

gladewater2016:
It is switching the relay now. It is just working backwards from what I expected. But that is fine..

That may be simply your relay working in reverse. Some are active high, others active low, and then there's the NO side and the NC side.
Anyway it's a matter of changing those states in your code and you should be good to go.

For the servo part, do you have the servo working with basic servo example scripts, like sweep? Always good to use those to test your components. If that doesn't work it's wiring; if it does work it's in your code.

After making those changes please do post the latest version of your code (properly formatted, in a new message).

I have a small simple servo and a more expensive digital servo.The small servo is working with the sweep code when connected to pin 9, but the digital servo isnt working. Also neither one will work when connected to the servo pins on the adafruit board.

You might want to run an I2C scanner to confirm the device address (SB 0x40) and that the device is communicating on the I2C bus.

// I2C scanner by Nick Gammon.  Thanks Nick.

#include <Wire.h>

void setup() {
  Serial.begin (115200); //*****  make sure serial monitor baud matches *****

  // Leonardo: wait for serial port to connect
  while (!Serial) 
    {
    }

  Serial.println ();
  Serial.println ("I2C scanner. Scanning ...");
  byte count = 0;
  
  Wire.begin();
  for (byte i = 1; i < 120; i++)
  {
    Wire.beginTransmission (i);
    if (Wire.endTransmission () == 0)
      {
      Serial.print ("Found address: ");
      Serial.print (i, DEC);
      Serial.print (" (0x");
      Serial.print (i, HEX);
      Serial.println (")");
      count++;
      delay (1);  // maybe unneeded?
      } // end of good response
  } // end of for loop
  Serial.println ("Done.");
  Serial.print ("Found ");
  Serial.print (count, DEC);
  Serial.println (" device(s).");
}  // end of setup

void loop() {}

This is what I got.

I thought that I saw a solder blob on the A0 address selection jumper. Change the I2C address in the sketch to 0x41.

Make it look like this:

// called this way, it uses the default address 0x40
//Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
// you can also call it with a different address you want
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(0x41);

// called this way, it uses the default address 0x40
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
// you can also call it with a different address you want
//Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(0x41

This is what my code looks like. Should the solder blob not be there?

I know that is how your code looks. The solder blob changes the address from the default (0x40) that is in your code to 0x41. You can either change your code to what I posted (set the address to 0x41) or un-solder the address jumper and leave the coded address at 0x40. Up to you. I would just change the address in the code.

Please post the latest version of your code if you make any changes.