# Timer with pulse to start motor.

#### Ornulf

Joined Jan 1, 2016
5
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

#### nerdegutta

Joined Dec 15, 2009
2,684
Hi, and welcome to AAC.

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

Happy New Year, Ornulf.

#### Ornulf

Joined Jan 1, 2016
5
Takker!
I do not have scematics, but maybe these pictures can help?

#### nerdegutta

Joined Dec 15, 2009
2,684
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:

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!

#### Ornulf

Joined Jan 1, 2016
5
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?

#### GopherT

Joined Nov 23, 2012
8,012
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
The easy way to delay an arduino is using the
Code:
int ledPin = 13;      // set a variable names so we know what the pin does...
int trigger555Pin = 10;
int moistureSensor = 5;

void setup()
{
pinMode(ledPin, OUTPUT);      // sets the digital pin as output
}

void loop()
{

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

{ // trigger if soil sensor says "dry"

digitalWrite(trigger555Pin, HIGH); // sends low pulse to 555 trigger
digitalDelay(10 * 1000); //10 seconds worth of milliseconds
digitalWrite(trigger555Pin, LOW); // sends low pulse to 555 trigger

digitalDelay(20*1000);  // wait for 20 seconds for 2nd pulse

digitalWrite(trigger555Pin, HIGH); // sends low pulse to 555 trigger
digitalDelay(10 * 1000);  // delay 10 seconds worth of milliseconds.
digitalWrite(trigger555Pin, LOW); // sends low pulse to 555 trigger
}

digitalWrite(ledPin, HIGH);    // sets the LED off
}
If I remember correctly, the number must be in milliseconds and is a long-integer.

Last edited:

#### nerdegutta

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

Don't you think?

#### GopherT

Joined Nov 23, 2012
8,012
AFAIK, he also need a "driver" for the 555 board. Something like this:

View attachment 97667
Don't you think?
Yes, could you also add the IF statement to read the sensor before triggering the 555

#### GopherT

Joined Nov 23, 2012
8,012
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.

#### Ornulf

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

#### GopherT

Joined Nov 23, 2012
8,012
Thanks to you both!
I will try to build and program from your outline.
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.

#### Ornulf

Joined Jan 1, 2016
5
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

{ // 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.

#### nerdegutta

Joined Dec 15, 2009
2,684
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.

#### djsfantasi

Joined Apr 11, 2010
8,587
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.

#### ebeowulf17

Joined Aug 12, 2014
3,306
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.

#### nerdegutta

Joined Dec 15, 2009
2,684
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.

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.