Timer with pulse to start motor.

Discussion in 'The Projects Forum' started by Ornulf, Jan 1, 2016.

  1. Ornulf

    Thread Starter New Member

    Jan 1, 2016
    5
    0
    Hello, and happy new year!
    I have got a soil humidity sensor with digital output for my tomato plant in the cellar, a 12V Delay Timer Monostable Switch Adjustable Relay Module NE555 Car Oscillator, and a pump driven from a 12 v battery charger. I would like a cirquit to sense the sensor high or low say 2 times a day, and send a pulse to the delay timer to start the pump for a set seconds when required. I am not an experienced electronic engineer!
    Ornulf
     
  2. nerdegutta

    Moderator

    Dec 15, 2009
    2,515
    785
    Hi, and welcome to AAC.

    Do you have any datasheet for the sensor? Or pictures or schematic diagrams?

    Happy New Year, Ornulf.
     
  3. Ornulf

    Thread Starter New Member

    Jan 1, 2016
    5
    0
    image.png image.png Takker!
    I do not have scematics, but maybe these pictures can help?
     
  4. nerdegutta

    Moderator

    Dec 15, 2009
    2,515
    785
    Ok, this sensor has an analog and a digital output.

    I'm afraid, the easiest way is to use a microcontroller to read the analog output.

    In the microcontrollers program, you set the values you need, for the pump to start.

    A block diagram would look something like this:

    TomatoHumiditySensorBlock.jpeg

    Do you have a picture of the 12v relay pump and the 555 controller circuit?

    There are a lots of choices for a microcontroller, but a PICAXE or an Arduino would be the easiest way. They are really simple to program and use, and here on the forum there are plenty people who can help you program it, or even make a PCB for you!
     
  5. Ornulf

    Thread Starter New Member

    Jan 1, 2016
    5
    0
    Thanks. It is ok to use AO, only I want:
    Check sensor one or twice a day and act if humidity low.
    Send pulse to delay timer (data attached).
    Delay timer activates an electromechanical relay a preset number of seconds (about 12 - 15).
    Check next in 12 hours.
    An arduino will be ok. Suggestion on schematic and program? image.png
     
  6. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,031
    3,802
    The easy way to delay an arduino is using the
    Code (Text):
    1.  
    2. int ledPin = 13;      // set a variable names so we know what the pin does...
    3. int trigger555Pin = 10;
    4. int moistureSensor = 5;
    5.  
    6.  
    7.  
    8. void setup()
    9. {
    10.   pinMode(ledPin, OUTPUT);      // sets the digital pin as output
    11. }
    12.  
    13. void loop()
    14. {
    15.  
    16.   delay(12 * 60 * 60 * 1000);                  // waits for 12 hours worth of milliseconds
    17. digitalWrite(ledPin, HIGH);  // sets the LED on
    18.  
    19. if (digitalRead(moistureSensor) = 1)
    20.      { // trigger if soil sensor says "dry"
    21.  
    22.      digitalWrite(trigger555Pin, HIGH); // sends low pulse to 555 trigger
    23.      digitalDelay(10 * 1000); //10 seconds worth of milliseconds
    24.      digitalWrite(trigger555Pin, LOW); // sends low pulse to 555 trigger
    25.  
    26.      digitalDelay(20*1000);  // wait for 20 seconds for 2nd pulse
    27.  
    28.      digitalWrite(trigger555Pin, HIGH); // sends low pulse to 555 trigger
    29.      digitalDelay(10 * 1000);  // delay 10 seconds worth of milliseconds.
    30.      digitalWrite(trigger555Pin, LOW); // sends low pulse to 555 trigger
    31.      }
    32.  
    33. digitalWrite(ledPin, HIGH);    // sets the LED off
    34. }
    35.  
    If I remember correctly, the number must be in milliseconds and is a long-integer.
     
    Last edited: Jan 2, 2016
    Ornulf likes this.
  7. nerdegutta

    Moderator

    Dec 15, 2009
    2,515
    785
    AFAIK, he also need a "driver" for the 555 board. Something like this:

    Relaydriver.png
    Don't you think?
     
  8. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,031
    3,802
    Yes, could you also add the IF statement to read the sensor before triggering the 555
     
  9. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,031
    3,802
    The 555 needs 12 v because the coil voltage on the relay is 12 volts.

    This drawing assumes you have A/C mains adapter for power since it is not low power design.

    The second wire to the sensor is the regulate 5V output from the arduino board. You can also use regulated 3 volt output if your board has that instead.

    image.jpg
     
  10. Ornulf

    Thread Starter New Member

    Jan 1, 2016
    5
    0
    Thanks to you both!
    I will try to build and program from your outline.
     
  11. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,031
    3,802
    I picked some random Arduino PIN numbers for the Sensor and 555 delay trigger. You can reassign them as needed in code when you connect (assuming they are digital input or output pins on the board (see top rows of code). The LEd pin must stay at 13.
     
  12. Ornulf

    Thread Starter New Member

    Jan 1, 2016
    5
    0
    Hi again!
    I have used a little time to look into the arduino, ordered one one, and not got the 555 delay timer yet.
    I think I have misunderstood the function of the 555 delay timer, thought it would start on impulse, and then give power in 0 to 10 sek.
    (does such device exist, and what would it be called?).
    With the arduino and the suggested program, do I really need the 555 timer? Will not a siple transistor amplifier powering an electromechanical relay do the trick?
    Will this work?:

    void setup() {
    int ledPin = 13; // set a variable names so we know what the pin does...
    int trigger555Pin = 10;
    int moistureSensor = 5;
    pinMode(ledPin, OUTPUT); // sets the digital pin as output
    int intervalvarhour = 12; // sets the hours between moisture check
    int pumpvarseconds = 11; // sets the seconds the pump runs
    }

    void loop()
    {

    delay(intervalvarhour * 60 * 60 * 1000); // waits for number of hours worth of milliseconds
    digitalWrite(ledPin, HIGH); // sets the LED on

    if (digitalRead(moistureSensor) = 1)
    { // trigger if soil sensor says "dry"

    digitalWrite(trigger555Pin, HIGH); // sends high pulse to amplifier start the pump (will the signal stay on?)
    digitalDelay(pumpvarseconds * 1000); //number of seconds the pump is on worth of milliseconds
    digitalWrite(trigger555Pin, LOW); // sends low pulse to amplifier stop pump(signal stops?)

    digitalWrite(ledPin, HIGH); // sets the LED off
    }

    As a total novice, I would be very thankful for guidance!
    What is the easiest way to set the variables? Can one use an android phone?
    regards.
     
  13. nerdegutta

    Moderator

    Dec 15, 2009
    2,515
    785
    Hi.
    At first glance, you need to set the moisture oi to input in the setup function.

    You do not need the 555 timer circuit. It can all be done with the Arduino.

    I'm at work on my cellphone right now, so it's hard to draw a circuit. :)
     
  14. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,804
    832
    There are a few changes necessary.

    The pin definitions should take place BEFORE setup(). As it is, being defined in setup(), they are only valid there and not available in loop().

    You set the pin mode for your LED pin, but you need to define moistureSensor and trigger555Pin as well. The former should be defined as an input and the latter as an output.
    pinMode(moistureSensor,INPUT);
    pinMode(trigger555Pin,OUTPUT);​
    Depending on your sensor, if it needs a pull-up resistor, you can use INPUT_PULLUP.

    The signal will stay on when you use a digitalWrite command. And it will stay on until you use another digitalWrite command with the inverse output. I.e., HIGH/LOW.

    I'm not clear on what you are using the 555 for, but I'd be surprised if you couldn't do it in the Arduino.

    A suggestion. The Arduino has a serial console. If you initialize the serial output in setup(), with something like serial.begin(9600), you can use serial.println("message"); or serial.println(variable); to debug your code.

    What variable do you want to change? I'd modify the initialization statements and recompile/upload.

    Hope you find these comments helpful.
     
  15. ebeowulf17

    Active Member

    Aug 12, 2014
    678
    79
    If you want to be able to change variables while the program is running, LCD display/keypad combos are available. Those could be used if you want to be able to enter exact values.

    If you want on-the-fly control, but don't need to be able to see the exact values, you could hook up a trim pot to an analog input and scale the analog reading to a suitable range of variable values.

    Of course, if you don't need to adjust it frequently, djsfantasi's suggestion is by far the simplest approach.
     
  16. nerdegutta

    Moderator

    Dec 15, 2009
    2,515
    785
    The above suggestions are great!
    Here's an idea for a schematic diagram. The thought is that when the Arduino_pin is put HIGH, it let current flow through the BC547 transistor, which in turn activates the relay. P1 connects to the S1 and activates the pump. This requires that the GND of the pump is connected to the 0v of the 12v powersupply.

    Relaydriver_01.png
    This is an illustration. You might have a different relay.

    I'm sure you've Googled around, if not, try it, and you'll see there's a lot of similar projects out there. :)
     
Loading...