Arduino and Electronics

F

Fish

Guest
I'm trying to make a automatic water system for my garden. I'm new in this stuff, i've just bought some books on it, anyone got any tips.
 
D

Dundee

Guest
I'm trying to make a automatic water system for my garden. I'm new in this stuff, i've just bought some books on it, anyone got any tips.
I have made heaps of stuff with Arduino's, happy to help. It is really easy to work with, easy to code, and easy to interface.
What did you have in mind specifically fish?
 
  • Like
Reactions: Fish
D

Dundee

Guest
How cheap is this stuff :)
Do the whole project on a few dollars :)







 
  • Like
Reactions: Aurora and Fish
F

Fish

Guest
Thanks

I have made heaps of stuff with Arduino's, happy to help. It is really easy to work with, easy to code, and easy to interface.
What did you have in mind specifically fish?

I want to make something that can water the plants everyday in the exact time. What kind of programming language should i use, can i use Phyton on Raspberry pi? Or is there something else?
 
  • Like
Reactions: Aurora
F

Fish

Guest
I got one more question, is it possible to make your own PCB and program it by yourself without the use fo Raspberry pi or Arduino?
 
A

Aurora

Guest
That's wonderful energy. If this studio was not so important right now, I would certainly bring a project of my own along. :cool:
 
  • Like
Reactions: Fish
D

Dundee

Guest
I would use the Arduino, the Pi is a better platform in a lot of ways but the Arduino is really easy to program. Lots of example code. You pretty much program it in "C". When you buy any sensor, or any interface there is always simple code to get it working.

Have a look at the following example. It is an Arduino controlling 4 relays with the code.
Its really easy. Just break the problem down into separate bits and test them one at a time. Once each but works, start making the bits talk together..
Like I said, if you go with arduino I can help :)


 
  • Like
Reactions: Aurora and Fish
D

Dundee

Guest
If you give me some details I can help get you started. How many water outputs/sprinklers/taps? do you want to over ride them, and so on.
 
  • Like
Reactions: Fish
F

Fish

Guest
If you give me some details I can help get you started. How many water outputs/sprinklers/taps? do you want to over ride them, and so on.
Since i don't know much about it so i'll start small with 2 outputs for the 2 sprinklers from 1 tap
 
Last edited by a moderator:
  • Like
Reactions: Aurora
D

Dundee

Guest
Thanks for the info Dundee
Ok so get your Arduino, I recommend the UNO or a clone. They are cheap and will do what you want.

Go to here and download the software, and follow the instructions on getting it going.


You might have to install a USB driver to get the software to see the board.
Plug it in and let it detect, It will power up from USB for now.
Look in your com ports on the control panel and identify which com port it is installed as, it will be obvious :) (This may change with plugging in and out?)
Go back to the IDE and set the com port to match.
Go into the options and select the board model you have eg: UNO.
Go to File -> Examples -> Basic -> and open the Blink sketch
It will open another IDE

Here is the code example. Note it does not define the pin number in the code for the Built in LED, It may be set as a constant in the IDE???
If it does not work, add this line up the top somewhere...
int LED_BUILTIN = 13

Upload and run and watch the led blink on and off on the board.
Try changing the delays to alter the plash interval.
1000 = 1000 milliseconds, or one second

Once you get this far you are 80% there.
I will design a really simple two way relay cct for you in the meantime.


/*
Blink

Turns an LED on for one second, then off for one second, repeatedly.

Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
the correct LED pin independent of which board is used.
If you want to know what pin the on-board LED is connected to on your Arduino
model, check the Technical Specs of your board at:
https://www.arduino.cc/en/Main/Products

modified 8 May 2014
by Scott Fitzgerald
modified 2 Sep 2016
by Arturo Guadalupi
modified 8 Sep 2016
by Colby Newman

This example code is in the public domain.

http://www.arduino.cc/en/Tutorial/Blink
*/

// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
 
  • Like
Reactions: Fish and Aurora
F

Fish

Guest
Ok so get your Arduino, I recommend the UNO or a clone. They are cheap and will do what you want.

Go to here and download the software, and follow the instructions on getting it going.


You might have to install a USB driver to get the software to see the board.
Plug it in and let it detect, It will power up from USB for now.
Look in your com ports on the control panel and identify which com port it is installed as, it will be obvious :) (This may change with plugging in and out?)
Go back to the IDE and set the com port to match.
Go into the options and select the board model you have eg: UNO.
Go to File -> Examples -> Basic -> and open the Blink sketch
It will open another IDE

Here is the code example. Note it does not define the pin number in the code for the Built in LED, It may be set as a constant in the IDE???
If it does not work, add this line up the top somewhere...
int LED_BUILTIN = 13

Upload and run and watch the led blink on and off on the board.
Try changing the delays to alter the plash interval.
1000 = 1000 milliseconds, or one second

Once you get this far you are 80% there.
I will design a really simple two way relay cct for you in the meantime.


/*
Blink

Turns an LED on for one second, then off for one second, repeatedly.

Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
the correct LED pin independent of which board is used.
If you want to know what pin the on-board LED is connected to on your Arduino
model, check the Technical Specs of your board at:
https://www.arduino.cc/en/Main/Products

modified 8 May 2014
by Scott Fitzgerald
modified 2 Sep 2016
by Arturo Guadalupi
modified 8 Sep 2016
by Colby Newman

This example code is in the public domain.

http://www.arduino.cc/en/Tutorial/Blink
*/

// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}

Ok i will try. Thank you Dundee
 
D

Dundee

Guest
Heya Fish, as promised, sorry for the less than stellar presentation. I am no document writer :(

First some recommended bits to buy.
Something to turn on and off your taps.
Something like this will do it, operates off 12v dc and will handle about 0.8mpa which is about 120 psi, should be heaps.
This example is $7 each



You need a few relays (One per solenoid) so here is a cheap and easy to use relay board that works fine on an Arduino
It is about $10


Here is a wiring diagram of sorts :) lol
If it makes no sense ask me a question.
I have done it first using 4 switches. If you make it that far I will modify it to include a real time clock and stuff.
Still easy but a little more involved as unless you want to hard code the on off times into the Arduino were going to need a keypad and a small LCD display.
Don't want to scare you off just yet :)



Finally the code, it compiles without error so it should work.
If you copy paste it into the Arduino IDE it is a lot easier to follow.
Keep me posted and good luck.

// Handy Dandy watering system by Miss Fish :)

// define the relay pins to be used
const int relay1 = 6;
const int relay2 = 7;
const int relay3 = 8;
const int relay4 = 9;

// define the switch pins to be used
const int switch1Pin = 2;
const int switch2Pin = 3;
const int switch3Pin = 4;
const int switch4Pin = 5;

// define the checkstate variables
int switch1State = 0;
int switch2State = 0;
int switch3State = 0;
int switch4State = 0;

void setup()
{

// tell the switch pins to be inputs for this project
pinMode(switch1Pin, INPUT);
pinMode(switch2Pin, INPUT);
pinMode(switch3Pin, INPUT);
pinMode(switch4Pin, INPUT);

// tell the relay pins to be outputs for this project
pinMode(relay1, OUTPUT);
pinMode(relay2, OUTPUT);
pinMode(relay3, OUTPUT);
pinMode(relay4, OUTPUT);

}

void loop()
{
// Main loop, each loop watch to see if a switch has been turned on
switch1State = digitalRead(switch1Pin);
switch2State = digitalRead(switch2Pin);
switch3State = digitalRead(switch3Pin);
switch4State = digitalRead(switch4Pin);

// if switch one has turned on (HIGH)
if (switch1State == HIGH)
{
// tell relay pin one to turn on relay 1
digitalWrite(relay1, HIGH);
}
else
{
// tell relay pin one to turn off relay 1
digitalWrite(relay1, LOW);
}

// if switch two has turned on (HIGH)
if (switch2State == HIGH)
{
// tell relay pin two to turn on relay 2
digitalWrite(relay2, HIGH);
}
else
{
// tell relay pin two to turn off relay 2
digitalWrite(relay2, LOW);
}

// if switch three has turned on (HIGH)
if (switch3State == HIGH)
{
// tell relay pin three to turn on relay 3
digitalWrite(relay3, HIGH);
}
else
{
// tell relay pin three to turn off relay 3
digitalWrite(relay3, LOW);
}

// if switch four has turned on (HIGH)
if (switch4State == HIGH)
{
// tell relay pin four to turn on relay 4
digitalWrite(relay4, HIGH);
}
else
{
// tell relay pin four to turn off relay 4
digitalWrite(relay4, LOW);
}

}
 
  • Like
Reactions: Fish
F

Fish

Guest
Heya Fish, as promised, sorry for the less than stellar presentation. I am no document writer :(

First some recommended bits to buy.
Something to turn on and off your taps.
Something like this will do it, operates off 12v dc and will handle about 0.8mpa which is about 120 psi, should be heaps.
This example is $7 each



You need a few relays (One per solenoid) so here is a cheap and easy to use relay board that works fine on an Arduino
It is about $10


Here is a wiring diagram of sorts :) lol
If it makes no sense ask me a question.
I have done it first using 4 switches. If you make it that far I will modify it to include a real time clock and stuff.
Still easy but a little more involved as unless you want to hard code the on off times into the Arduino were going to need a keypad and a small LCD display.
Don't want to scare you off just yet :)



Finally the code, it compiles without error so it should work.
If you copy paste it into the Arduino IDE it is a lot easier to follow.
Keep me posted and good luck.

// Handy Dandy watering system by Miss Fish :)

// define the relay pins to be used
const int relay1 = 6;
const int relay2 = 7;
const int relay3 = 8;
const int relay4 = 9;

// define the switch pins to be used
const int switch1Pin = 2;
const int switch2Pin = 3;
const int switch3Pin = 4;
const int switch4Pin = 5;

// define the checkstate variables
int switch1State = 0;
int switch2State = 0;
int switch3State = 0;
int switch4State = 0;

void setup()
{

// tell the switch pins to be inputs for this project
pinMode(switch1Pin, INPUT);
pinMode(switch2Pin, INPUT);
pinMode(switch3Pin, INPUT);
pinMode(switch4Pin, INPUT);

// tell the relay pins to be outputs for this project
pinMode(relay1, OUTPUT);
pinMode(relay2, OUTPUT);
pinMode(relay3, OUTPUT);
pinMode(relay4, OUTPUT);

}

void loop()
{
// Main loop, each loop watch to see if a switch has been turned on
switch1State = digitalRead(switch1Pin);
switch2State = digitalRead(switch2Pin);
switch3State = digitalRead(switch3Pin);
switch4State = digitalRead(switch4Pin);

// if switch one has turned on (HIGH)
if (switch1State == HIGH)
{
// tell relay pin one to turn on relay 1
digitalWrite(relay1, HIGH);
}
else
{
// tell relay pin one to turn off relay 1
digitalWrite(relay1, LOW);
}

// if switch two has turned on (HIGH)
if (switch2State == HIGH)
{
// tell relay pin two to turn on relay 2
digitalWrite(relay2, HIGH);
}
else
{
// tell relay pin two to turn off relay 2
digitalWrite(relay2, LOW);
}

// if switch three has turned on (HIGH)
if (switch3State == HIGH)
{
// tell relay pin three to turn on relay 3
digitalWrite(relay3, HIGH);
}
else
{
// tell relay pin three to turn off relay 3
digitalWrite(relay3, LOW);
}

// if switch four has turned on (HIGH)
if (switch4State == HIGH)
{
// tell relay pin four to turn on relay 4
digitalWrite(relay4, HIGH);
}
else
{
// tell relay pin four to turn off relay 4
digitalWrite(relay4, LOW);
}

}

Thank you very much Dundee.

That Plastic Water Solenoid Valve is amazing. I didn't see anyone using electrons to control the water flow before.
 
D

Dundee

Guest
Thank you very much Dundee.

That Plastic Water Solenoid Valve is amazing. I didn't see anyone using electrons to control the water flow before.
The fun part about it, once you get a prototype up and running, their is so much cool stuff you can add. Moisture sensors that detect dry soil and override the timer LCD displays, temerature sensors that over ride it if it is a hot day, remote access, turn on your sprinklers over the internet. The good part about Arduino is that you can pretty much test every thing you buy, easily, with example code. And usually pretty simple code too. Then once you understand the new device, you just add it to the current project.

Check out this for a starter kit :)
It is not an UNO but a Mega, pretty much the same thing just more inputs and outputs. You could use one oif these too if you wanted.

All you have to do is get over the leaarning curve of your first project. After that they are easy :)

 
  • Like
Reactions: Fish
D

Dundee

Guest
Hey Fish,
I was at a garage sale yesterday and got an old USB Nerf missile launcher for $6 loll
Only it has no aiming software, and is so old I cant find it anywhere.
Thought it would be a perfect candidate for Arduino.
The plan is to rip out all the old electronics and chuck an Arduino in it to control it and write my own program.
Might stick a webcam on it for remote control haha,
Heading out to see the grand-kids now, but will pull it apart later. Will post picks and code as I go.
Though you might get a giggle out of it.
Here is a pic of the one I found.

 
  • Like
Reactions: Fish
A

Aurora

Guest
You guys are giving me an idea for a television game show where contestants and an expert take used toys and turn them in to state of the art toys.
 
  • Like
Reactions: Fish