Go Down

Topic: Automated Dust Collection (Read 2842 times) previous topic - next topic

groundFungus

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.

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

gladewater2016

a2 and a3 grounded

wvmarle

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?
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

groundFungus

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

gladewater2016

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

wvmarle

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).
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

gladewater2016

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.

groundFungus

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.   

Code: [Select]
// 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() {}





gladewater2016

This is what I got.

groundFungus

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:
Code: [Select]
// 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);

gladewater2016

// 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?

groundFungus

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.

gladewater2016

I changed the code to match what you said. Still doesnt work

groundFungus

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



Does the dust collector relay operate when it should?  Does the serial output show the gate positions when a tool is turned on?

Go Up