Simplest Build - Help a novice!

Hi!
I must preface that i don't know a lot about programming, Arduinos and such. I'm just getting interested in this sort of things for the first time!
What i'm trying to build (Just as a creative hobby) is a simple device, composed of a small red LED and a button, which:

  • By default, it starts with the LED on
  • When i press the button, the LED turns off, and the device starts an internal one-week timer
  • If at least a week has passed since the last time i've pressed the button, then it turns the LED back on.

Again, it's nothing incredible. The reason i would like to do this is that I have a lot of plants around the house, each requiring a different watering schedule (Once a week, once a month, once every two weeks..), and i thought that assigning a LED light to each one, telling me if it needs to be watered, would ease the process of remembering the schedule for each.

I know that this is probably not the easiest/cheapest way to do this, and i could probably set something analogous up entirely on my phone with some kind of reminder app, but i thought that this would be a fun little project to get started with small-scale programming and Arduinos, which is something that i am interested in.

As i have different plants with different watering schedules, perhaps this could also be 'scaled up' to contain different LEDs and different buttons, each for a different plant, but i would be content if i were able to just start with the one.

I'm of course looking into how to do this myself, but i would much appreciate any inputs anyone might have! As stated, i have 0 experience with this :smiley:

Thanks in advance!

Welcome to the forum

What have you tried so far ?

It is not clear whether you want to implement multi plant timers on a single Arduino or for each plant to have its own Arduino

Either is possible

Have you examined Arduino moisture sensors? Why a week if it's not a week that's needed, but the moisture level in the soil?
That's what makes Arduino so cool: pretty much any real world scenario you can imagine, there is an input sensor out there for only a few dollars that will allow you to interact with the real world problem, in this case, your having a device that reminds you to water your plants when they're thirsty.

1 Like

Thank you for the input!

Some of these plants are.. algae. Which means that, instead of being planted in soil, each one is in a jar full of water, and instead of watering them, i need to switch out the water every few days!

2 Likes

Thanks for the reply!
So far i haven't really tried anything!
I've watched a few tutorials on Arduino on YouTube, the absolute basics :joy:
I was thinking that i would start with a single LED with a single Arduino for a single plant, just to get started with things, learning the ropes a bit, and then maybe expand the project to multiple LEDs, each with a different timer, but still connected to a single Arduino, so as to minimize the cost (?).

One thing that i'm trying to understand is the cheapest Arduino model that would be capable of achieving the end goal - i wouldn't want to purchase a Ferrari just to drive around my house! :joy:

I'm a beginner myself, but I think that this should work!


edit: Just noticed that he said start with it on, I'll tweak the code below, please ignore the code in this image.

This is the code :

#define LED_PIN 6
#define BUTTON_PIN 7
void setup() {
  pinMode(LED_PIN, OUTPUT);
  pinMode(BUTTON_PIN, INPUT);
  digitalWrite(LED_PIN, HIGH);
}
void loop() {
  if (digitalRead(BUTTON_PIN) == HIGH) {
    digitalWrite(LED_PIN, LOW);
    delay(604800000);
    digitalWrite(LED_PIN, HIGH);
  }
  else {
    digitalWrite(LED_PIN, HIGH);
  }
}

More experienced arduino users are welcome to critique this, I am extremely new.

I think the Nano every (with headers) is the cheapest at $14.70 (USD)
You can have up to 10 push buttons and 10 LEDs on one Nano every

1 Like

You could try this - pretty simple

the cheapest Arduino model

you could run this on a nano or tiny.

Hello @mattiaberaldo ,

Welcome, interesting little project for a beginner, one which presents several possibilities.

You can do as @arduinor3broken suggests and use delay, which is quick and simple but which you will quickly realise means that once the timer starts then nothing else happens for 7 days or however long the time runs for, meaning you can only have one timer per Arduino. Given that one Arduino is more than capable of running lots of timers I suggest using delay is good to get you started, but you will need to move on to something better pretty quickly.

Using millis will allow multiple timers on the same Arduino, and each timer can be made to work independently of the others, here is a tutorial to get you started:

As to which Arduino board you use, any are capable of doing what you want. The Uno is the original beginner's board, but is not breadboard friendly.

The Nano is a breadboard friendly version of the Uno:

And the Nano Every is similar in some ways but is actually based around a completely different processor. I prefer it because it has a spare hardware serial port, possibly not required for your project but useful for some projects:

1 Like

Once you have a working project, and you'd like a sensor for each plant, you could go to something like

$7

Since you need only one input and one output this small package would suffice.  You should also look into power saving techniques if this will be a battery powered application.

Nice idea for a first project. But you should continue getting your feet wet (see what I did there?) with small steps maybe nothing to do with the actual goal.

A processor and LED and button per plant would make it easy, but maybe spendy. If the LEDs and buttons don't have to be physical distant one set to the next, one Arduino board will be able to do quite a few pairs.

I suggest getting the sketch you wrote going. Of course for testing set the delay to something like 7 seconds, and test that nothing breaks for longer delays.

You will see us perhaps wanting to make this larger; for now try to avoid mission creep. Pick attainable goals and deploy something, then revisit for version 2. And 3. I won't even say the kind of places ppl take these little projects.

On behalf of your algae (!), however, I would like the device to power up or reset with an indication it was a new world, say another LED that is on only at that time, and goes off and stays off for the rest of eternity once you hit the "I did it" button.

Unless the power fails and you might not have noticed - all copies of the device, or the one multichannel device would show that power had been lost, and the timing lost.

if you are cheap or a sedentary type, this project's software can be fully developed without leaving your chair or spending and money.

Check out this simulator, not too much harder than coming to grips with the IDE, and certainly easier than fiddling with breadboxes and wires and components and so forth.

a7

Hi everyone!
So many replies, thank you all!
I've been trying some things out, by following a combination of these two tutorials:
Tutorial 1 (LED with Button)
Tutorial 2 (Arduino Nano on a Breadboard)

So far, i've put together this simulation (With some strong help from ChatGPT for the coding part):
Wowki Simulation

The simulation has a single button, a single LED, and a much smaller timer (5 seconds) for testing purposes.
Problem is, this doesn't work as intended...

The expected behavior, to recap, is that, when i run the simulation:

  • The LED starts on by default
  • Once i press the button, the LED turns off, and the time of pressing is recorded
  • After 5 seconds, the LED turns back on, and stays on until i press the button again.

What happens instead, for reasons unknown, is that:

  • The LED starts on by default
  • It stays on for a very brief time, then it turns itself off
  • The button does not seem to affect the LED behavior in any way.

I have been trying to debug this for a while, but nothing seems to be working.
Again, i learned what a breadboard and resistors and pins are literally yesterday, so i expect this to be a very basic problem :joy:

Learn more. Your wokwi circuit is no good. Mostly, it seems, from misconceptions about how the breadboard works.

You don't need to use a breadboard in the wokwi. Just get out your components and wire them directly from pin to pin.

The Arduino board will be automatically powered, no need to route power to it, but that did not hurt.

a7

In your code you have configured the button pin using:

 pinMode(buttonPin, INPUT_PULLUP);

However on the breadboard you have also fitted a pull down resistor to the button input pin.

The pull up and pull down resistors are fighting each other to determine the pin's state.

I don't know how the simulator deals with this issue, as the internal pullup resistor is not a fixed value but lies within a range of values.

My guess is that the simulator thinks the button input is always HIGH.

I suggest that you either change the button pin to be an INPUT (without the pull up), or remove the pull down resistor on the breadboard, and rewire the push button so it pulls the input low. (You would need to change the code to check for the button pin going low, if you took the second option)

1 Like

Look at this code and circuit

I did. Why is D8 involved? Why is D7 involved?

It only works because those are input pins.

It would be better to learn how to use a breadboard, or just lose it for wokwi simulating.

a7

1 Like

Your circuit shows LED connected to D2, D7 and D8. Also, there doesn't seem to be any power going to the Arduino. The 5V pin is 5 volts out, the VIN pin is to give power to the Arduino. Without power in, you can't send power out.

Thank you! I changed the code to just INPUT, and now it works as intended! :pray: :grin:

Your circuit shows LED connected to D2, D7 and D8

Would the LED being connected to D7 and D8 be a functional problem or one of tidyness, given that they are (for now) unassigned? I assumed that any unassigned pins wouldn't affect the operation either way.

Also, there doesn't seem to be any power going to the Arduino. The 5V pin is 5 volts out, the VIN pin is to give power to the Arduino. Without power in, you can't send power out.

This makes perfect sense, which makes me all the more confused as to why it now works after @JohnLincoln 's suggestion to change the code :joy: