Help with first project

Hi,

I'm a first time aduinoer (didn't order anything yet) looking for a verification on my project idea so that I can order the needed parts.

Concept:
The idea is simple and already present in the Create.arduino projects, a simple plant watering system.
It will be powered by :

  • An Arduino Uno (or Nano?)
  • A battery (I will need help about this too, I don't know how to actually power the arduino yet)
  • A submerged water pump
  • A soil hygrometry sensor (capacitive)
  • A float switch to sense if the water bottle (reservoir) is empty
  • A buzzer to indicate low level in water reservoir (one of those piezo thingies maybe?)
  • A potentiometer to select watering cycle duration or desired soil hygrometry level
  • (Optional) An LCD display the variable set by the mentioned potentiometer
  • A button to manually force the soil moisture check + watering if needed
  • A on off switch for the battery to arduino connection
  • Tubing to hook the water pump outlet to the plant

I don't want it to drain it's battery so the "lets check soil moisture and water if necesarry" function will only be called every let's say 5 mins for now

The Fritzing schematic is attached (though I only used the breadboard tab and not the actual schematics, too complicated for me)

Questions:

  • What do you guys think about the overall project, are the parts correct?
  • Is the schematics correct?
  • Would the float switch work for this application?
  • Do I need additional transistors, resistors, capacitors? (I saw a bunch of advanced schemes for 12V pumps etc)
  • Is the "force manual cycle" button necessary? I saw a few times people mentionning the onboard reset button that could accomplish the same thing?
  • Since some of these parts come by 3x I might extend this to water a few plants, would a Nano or Uno be enough for that expension?

PS: I'm a programmer at heart, so I expect that part to be fairly easier

Thanks!

watering_bb.pdf (875 KB)

watering.zip (25.6 KB)

Well now. :grinning:

You may be "a programmer at heart", but not familiar with the Web. :astonished: PDFs are quite inappropriate for Web posting; they cannot embed in Web pages. Here is your diagram.
Watering02.png
Expand!

Fritzing is disliked here as it is a poor and confusing description of a circuit, the "actual schematic" is a much better description of a circuit. "Zip" files are a popular vector for virus infections in email and Web pages, so most here will choose not to open them. :cold_sweat:

The Nano is the "workhorse" version of the UNO, used for serious designs that have to do something rather than just play. It uses the same processor and thus code, just a different package, and also implements the final two, analog-only input ports.

It is far more practical than the UNO, usually comes without the pins soldered so you can solder the pins in to mount on a "solderless breadboard", or a terminal adaptor or as a daughter-board to your own custom PCB, or you can solder wires directly to the Nano PCB.

You cannot connect a motor directly to the logic output of an Arduino.

You cannot really run a pump on battery power and don't really want to run any system for long-term use on a battery. Unless you have a full charging system such as solar of course. I doubt you really want to do that. Nor would you want to turn your watering system off as I would imagine.

Switches should connect between an Arduino pin and ground, you can often use the internal pullup (about 46k) if the switch is good quality and not connected with a very long wiring. Otherwise you will want a pull-up, something between 1k and 10k. You do not want to run the 5 v supply out to switches if you can avoid it.

The capacitive moisture sensor is the only version that is likely to survive actual use in soil. You got that right!

Connecting the contrast potentiometer for the LCD to Vcc is a longstanding mistake in the circuits published. It should not be connected to 5 V and if you are using a 10k pot it works better if both ends connect to ground (which is to say, a 1k pot is the correct value).

A very real danger is that the obsolete tutorials on the Arduino site and others misleadingly imply that the largely ornamental "barrel jack" and "Vin" connections to the on-board regulator allow a usable source of 5 V power. This is absolutely not the case. It is essentially only for demonstration use of the bare board back in the very beginning of the Arduino project when "9V" transformer-rectifier-capacitor power packs were common and this was a practical way to power a lone Arduino board for initial demonstration purposes. And even then it was limited because an unloaded 9 V transformer-rectifier-capacitor supply would generally provide over 12 V which the regulator could barely handle.

If you are asking this question, it is highly likely that you will wish to connect something else. In which case, the answer is regulated 5 V.

This is because the on-board regulator is essentially capable of powering only the microcontroller itself and no more than a couple of indicator LEDs. The on-board regulator might be able to power a few other things if it had a heatsink, but on the (older) Arduinos, it does not.

Powering via the "barrel jack" or "Vin" connections is asking for trouble. The "5V" pin is not by any means an output pin, if anything a "reference" pin but most certainly the preferred pin to which to supply a regulated 5 V.

A practical power supply for the Nano (or UNO, Pro Mini, Leonardo etc.) is a "phone charger" with a USB output connector for 5 V, generally up to a couple of Amps though you can not feed more than 500 mA through the USB connection.

If you want to power it from 12 V or a car system, you need a 5 V switchmode "buck" regulator to supply the 5 V.

Hi,
Welcome to the forum.

Have you actually written code and programmed an Arduino controller to get familiar with the environment?

Tom... :slight_smile:

My advice is to simply start with a breadboard and some leds and some buttons. You can buy starter kits on ebay or suchlike. Start with the simple tutorials. If you can turn an LED on or off you can turn anything on or off from a code point of view. Once you have worked through the blink sketch and button sketch you need to understand state machines and use of millis (blink without delay sketch). Arduino is an I/O device so basically inputs and outputs, on and off. Buttons are your inputs leds your outputs. When you understand them then you can plan your system with leds representing solenoids and relays etc and buttons representing sensors. Get it all working on a breadboard. Check your coding, make it better. Learn about functions, arrays, ifs and for loops. Then you can start adding in more complex components like sensors and use then to change the state that activates your leds.

Do one thing at a time.
Save your code in different files and work iteratively (i.e. filenames: blink, button, blinkButton, etc) otherwise you will mess up and lose code. (use 'save as' every time you move on to a new addition).
avoid while loops and delays
use serial.print to check under the hood of your code

Of course, you can just cheat and copy what someone else has done but then you are not learning. Use other's code to understand better ways of doing it but try and understand it before you use it.

pmagowan:
My advice is to simply start with a breadboard and some leds and some buttons. You can buy starter kits on ebay or suchlike. Start with the simple .....

+1 for all of that.

Trying to design a complete system without experience is a recipe for frustration. Creating a functioning micro-processor based project is a lot more complex intellectually than (say) building a Lego model. You will run into problems that might be hardware or software and you need to know how to figure out which it is.

...R

Oh wow, I wasn't expecting this many detailed replies thank you guys first of all.

TomGeorge:
Hi,
Welcome to the forum.

Have you actually written code and programmed an Arduino controller to get familiar with the environment?

Tom... :slight_smile:

No I never fiddled with an arduino, I messed around with other small circuitery though (had a few electronics courses but that's all). Programming side, I did a lot of Python, Java, C#, C++ and C projects I should be good on that part. (Also coded a line following robot back in first year of College)

I think you guys are right, I will start with one of those "starter kits" that include verious parts and sensors, breadboards etc to mess around and understand how the Arduino works first.

But then I will be needing electrical knowledge with how to hook up the pump and other components (For exemple adding transistors, capacitors etc), because I have no idea how to design a schematics and the circuitery as a whole...

PS: also Paul__B I'd like to argue that PDF is not suited for web, all mainstream browsers are capable of opening that file format and you CAN embed them into web pages, it's just not implemented in this forum. I chose the PDF format because I thought Fritzing exported the schematics as SVGs (or any other raster image format) and a PNG or JPEG wouldn't have kept that property. (Looks like exporting it as a PDF converted them to classic bitmap images still though...)

And yes .zip s from unknown sources can be scary, I added that comment in my edit reason but it got overwritten

Lots of concepts here. Start with reading sensors. Then move to controlling the pump. Stumble through it.

Problem with the projects present on the Create Hub is that they usually don't explain much when it comes to using basic electronic components such as Transistors, capacitors etc.

Anyone got a good tutorial that covers those?

Have fun:

http://www.robotoid.com/appnotes/electronics-capacitor-markings.html

And YouTube . . .

More:

Arduino links of interest.

How to use this forum:
https://forum.arduino.cc/index.php?topic=149014.0

Listing of downloadable 'Arduino PDFs' :
Either Google >>>- - - - > arduino filetype: pdf
Or
https://www.google.ca/search?q=arduino+filetype%3A+pdf&rlz=1C9BKJA_enCA739CA739&oq=arduino+filetype%3A+pdf&aqs=chrome..69i57j69i65.1385j0j7&hl=en-US&sourceid=chrome-mobile&ie=UTF-8

Listing of downloadable 'C++ PDFs' :
Either Google >>>- - - - > C++ filetype: pdf
Or
https://www.google.ca/search?q=c%2B%2B+filetype%3A+pdf&rlz=1C9BKJA_enCA739CA739&oq=c%2B%2B+filetype%3A+pdf&aqs=chrome..69i57.22790j0j7&hl=en-US&sourceid=chrome-mobile&ie=UTF-8

Arduino cheat sheet:

Watch these:
Arduino programming syntax:

Arduino arithmetic operators:

Arduino control flow:

Arduino data types:

Understanding Destructive LC Voltage Spikes:

OR

Why MOSFET gate resistors:

Some things to read

LCD information:

OR

Reading a schematic:
https://learn.sparkfun.com/tutorials/how-to-read-a-schematic

Language Reference:

Foundations:

How and Why to avoid delay():
http://playground.arduino.cc/Code/AvoidDelay

Demonstration code for several things at the same time.
http://forum.arduino.cc/index.php?topic=223286.0

Multitasking:
Part 1:

Part 2:

Part 3:

Sparkfun Tutorials:
https://learn.sparkfun.com/tutorials?page=all

Micro Controllers:

Useful links:
https://forum.arduino.cc/index.php?topic=384198.0

Arduino programming traps, tips and style guide:

Call for useful programming discussions
https://forum.arduino.cc/index.php?topic=383980.0

Jeremy Blume:

Arduino products:

Motors/MOSFETs

Switches:

Share tips you have come across, 500+ posts:
https://forum.arduino.cc/index.php?topic=445951.0

Images from above:
https://www.google.com/search?q=“Share+tips+you+have”+larryD+site:https://forum.arduino.cc&prmd=nmvi&source=lnms&tbm=isch&sa=X&ved=0ahUKEwiJw-zu68ncAhXPGTQIHWCDCNwQ_AUIFCgE&biw=1024&bih=653

Debug discussion:
https://forum.arduino.cc/index.php?topic=215334.msg1575801#msg1575801

Frequently Asked Questions:
https://www.arduino.cc/en/main/FAQ#toc10

Number 'type's.

  • boolean (8 bit) - simple logical true/false, Arduino does not use single bits for bool
  • byte (8 bit) - unsigned number from 0 to 255
  • char (8 bit) - signed number from -128 to 127. The compiler will attempt to interpret this data type as a character in some circumstances, which may yield unexpected results
  • unsigned char (8 bit) - same as 'byte'; if this is what you're after, you should use 'byte' instead, for reasons of clarity
  • word (16 bit) - unsigned number from 0 to 65535
  • unsigned int (16 bit)- the same as 'word'. Use 'word' instead for clarity and brevity
  • int (16 bit) - signed number from -32768 to 32767. This is most commonly what you see used for general purpose variables in Arduino example code provided with the IDE
  • unsigned long (32 bit) - unsigned number from 0 to 4,294,967,295. The most common usage of this is to store the result of the millis() function, which returns the number of milliseconds the current code has been running
  • long (32 bit) - signed number from -2,147,483,648 to 2,147,483,647
    float (32 bit) - signed number from -3.4028235E38 to 3.4028235E38. Floating point on the Arduino is not native; the compiler has to jump through hoops to make it work. If you can avoid it, you should. We'll touch on this later. Sparkfun.

You select the 'type' best suited for your variables.

ex:

  • your variable does not change and it defines a pin on the Arduino. const byte limitSwitchPin = 34;
  • since an analog variable can be 0 to 1023, a byte will not do, you can select 'int'. int temperature;
  • if your variable needs to be within -64 to +64 a 'char' will do nicely. char joystick;
  • if your variable is used for ASCII then you need type 'char', char myText[] = {"Raspberry Pie Smells"};
  • if your variable enables some code then boolean can be used. boolean enableFlag = false;
  • millis() returns the time in ms since rebooting, unsigned long currentTime = millis();
    etc.

Oh, and have fun too :slight_smile: !

Oh wow well, thank you good sir !

Please tell me you had that saved somewhere because that's a lot of resources to gather :slight_smile:

Bookmarked !

Oh yes !

pijcab:
all mainstream browsers are capable of opening that file format and you CAN embed them into web pages, it's just not implemented in this forum.

So how might you do it?

pijcab:
I chose the PDF format because I thought Fritzing exported the schematics as SVGs (or any other raster image format) and a PNG or JPEG wouldn't have kept that property.

Perhaps you might explain what that means? :astonished: