Reptile Mister Programming for Newbie

Hello all,
I do not know where to turn at this point. I have wanted to do this project for a couple years now and have watched countless videos, googled and attempted to learn to write the appropriate code but I am struggling. I want to build a mister for a reptile enclosure but am completely stuck on the Arduino code. I am really hoping someone can point me in the right direction. I don't think it's overly complicated but for someone with no experience in this it's been a big challenge. I really want to build this myself and not buy one, the only thing holding this up is this programming.

Here is what I want to do:
I want to program the Arduino to control a pump by way of a relay. The pump will pump water through a misting tip to mist the reptile cage.
I'm looking to have a display, 4 buttons to program and a relay that runs the pump.

My plan for the buttons is this:
1-Will scroll through the 3 options in a menu
2 & 3 will set the values for those options, one goes up the other goes down.
4- The final button will start the program.

The 3 screens with settings are:
1- Delay (in hours) - How much time before the first time the relay is triggered leading to a misting.
2-Frequency of misting(in hours) - After the delay timer hits 0 and mists this timer starts. When it reaches 0 it activates the relay leading to another misting then starts counting down again in a loop. i.e. Every 4 hours mist.
3- How long to mist for (In seconds)- How long to leave the relay open for misting into the cage before stopping.

Once those three values are set the 4th button is pressed and the program runs and the Delay timer starts. Then the program will run until the power is turned off.

I hope that was clear and there are some kind people out there to help me figure out what to do. Thank you all!

The first thing you need to do is go through the examples in the IDE.

After that, study/master BWD timers and State Machine programming.

Suggest you also draw a proposed schematic that matches your requirements.


How much does a ready made unit cost ?


Have you looked at using an ultrasonic mister control ?

What relay do you have?

What display are you using?

What buttons or switches?

How are they wired to your Arduino, and what kind of Arduino board are you using?

What at all have you tried for the only thing holding you up?

a7

The units are in the neighborhood of $50, I admit that is the easiest route by far but there is something to 3D printing parts and programming something like this yourself. I literally have the rest figured out even the wiring for this, it's just the writing the program. I have not looked into the ultrasonic mister control or are even familiar with it. I will check it out though.

IMO, an ultrasonic fogger/mister sitting in distilled water is what should be used for this.

No pump, no relay.

Hey alto777, I should have thought to include these details:

The Display is this: https://www.amazon.com/gp/product/B0761LV1SD/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

The Relay is this:

The Arduino is the nano, this:

The buttons are just the black standard buttons that you can put into a breadboard. As far as the wiring I have been using the Tinkercad circuit program to try and design this virtually before actually wiring it all together. Attached is a snip of the diagram as wired. Tinkercad doesn't have the display I have so I figured I'll just have to modify the code appropriately though.

As far as trying, I've drawn up designs for the what the printed enclosure to hold the electronics will look like, purchased everything needed, and have just been trying to get the code written.

i

THX.

Looks like you approach things in a slightly different direction than I. Do.

A few observations.

The Nano Every is just enough different so it may make you do a little extra work from time to time, no show stoppers I don’t think, but an occasional you’ll need to do some digging, one hopes minor.

The nine volt battery may have been all tinkercod had available to represent the power supply, but a smoke detector 9 volt rectangular battery will be almost worthless if it is asked to provide any larger current as the misting device may require, or even the smaller current by the lower powered items for very long.

The usual practice is to provide power to the Arduino, and whatever voltage is required to the other components directly, that is to say not using the 5 volt output pin on the UNO or other Arduino board as a power supply.

Anything over 5 volts fed to the UNO is wasted in heat; it is preferred to use 5 volts, either a 5 volt power supply or by use of a regulator to make 5 volts out of 9 or 12 that you have plenty of. A step-down or “buck” regulator is efficient and effective.

But the largest part of all is the software, so yes, you will have to start where we all did… get the Nano or whatever to blink an LED, respond to switches &c.

Start or keep reading examples and trying them out.

Develop each capability (display, buttons, misting) separate ly, and only when each section works well with your code start on any grand combining of the pieces.

Usually a piece of hardware meant for the Arduino has lotsa ppl already doing things with it, so find working examples and study them, try them, tinker with them and so forth.

Put aside all fantasy about what kind of box this goes in and so forth. It won’t be for awhile that putting things in their final physical relationships to each other won’t be a waste of time or at least a distraction. I speak as someone with large fingers…

You ve bitten off quite a mouthful, so lastly I recommend that you stay calm and give up the idea that this will be finished by Christmas Valentine’s Day.

Also, even hand drawn “real” schematics will win more attention around here than any tinkercod or Fritzling diagrams - they are not very good at the most important thing a schematic should communicate - how the parts are wired together. I recommend getting to know a bit about how real schematic diagrams are used, there’s prolly a crap-ton of tuts online for basic schematic literacy.

I’ve recently had the Bing viruus, so I can tell you that it is deficient and no match for Google, so when you google, I suggest Googling.

HTH and we here for as fine a stepping through this as you may need.

a7

Is it safe to use an ultrasonic mister with a reptile? You need to be sure it is above their hearing range so you don't harm their hearing.

I appreciate the write up, alto. To your point about the 9V battery, it was just because that was the easiest thing tinkercad had to represent a power source for the pump, your right about that. I intend to run this entire setup on a 18650 battery because I want it portable. I have sourced a pump that works at that voltage and a charge discharge board for the battery to protect it.

I have been able to do some basic stuff like you mentioned but I tend to get lost when it gets bigger.

I have actually have been trying to develop a code for each purpose as you've mentioned and I've had moderate success with it. For example, I have gotten a program to work as a menu that uses the buttons. It allowed you to move between the three categories I listed above and select a time for the hours and seconds. But it doesn't relate to a timer in anyway and that's the hard part.

I did find a timer code where the value is set in the arduino sketch and once it hit zeto that triggered the pump to mist. I'm struggling to link the two let alone in a manner that I laid out in my original post. That is what I've been doing mostly, piecing out the different sketches and then every time I try to bring two codes together I can't get anywhere because I get lost.

I have only drawn the physical design out as an idea but put it on the back burner until the coding is done. I'll look into some examples of schematics and starting learning those as well. I do always use google as well.

First, if you haven't yet done any breadboarding wire the pushbuttons according to S3 below and specify INPUT_PULLUP in Setup() when you do your pinMode().

Second, debounce ALL the switches before using their status.

Third, use the change of state of the buttons and not the current status.

See the first five demos in: IDE/file/examples/digital.

Do not attempt to construct the whole program at one go.  Start with just detecting one button and using it to increment a counter.  Serial.print the counter value to verify you're only getting one sense per button press.

Then, modify the code to reset the counter to zero when a preset (three in your case) is reached.  The counter value can be used to select which menu option is active.  Add a small piece at at time and prove it does what you want before moving on.

What display will you use?

It may not be important and you hardly need another plateful, but an RTC “real time clock” module would give you accurate timing related to the actual time of day, so every four hours could be 2, 6, 10 o’clock and so forth. They are inexpensive and fairly easy to work with, good libraries exist and many examples code.

And if you are using a battery, you will need to figure out how to get the entire system to go into a low power mode between mistings… here again an RTC can play a part.

But you can leave off that entire branch of R&D and just get a mains powered version functioning.

Then mains power with the RTC perhaps, then sleeping between mist times.

If sleep is going to be needed, there may be easier Arduino to start with than the Nano Every, which I use but for which I have not looked into extreme or even not extreme reduced power operation.

a7

Thank you all again. I'm going to take a little time and see where I can get this weekend with these suggestions. I hadn't even considered a low power mode between activities but that makes perfect sense!

When the time comes, this is where you want to go for the skinny on low power:

It may seem like a slog, but he lays out everything there is and provides full examples that can be cut. pasted and experimented with.

Warning: low power can be addictive. Once you are seeing currents like 125 uA it is hard not to want to do everything possible to reduce that to nearly not measurabel.

a7