New Guy, Old Guy

Let me start by saying im not getting it.

I roast coffee for a living and wanted to automate my cold brew process. I've done a little with arduino in the distant past, but am having a hard time recalling what i once knew.

And, it's real basic stuff i cant get around.

I want to press button 1 (momentary) to start the process.

Turn on a relay 1 minute, every 5 minutes for 12 hours.

I want a momentary stop button that i can pause or turn off.

I can find all the pieces i need, but im having trouble remembering how to insert the separate programs into an overall routine.

I'd appreciate help if you can move me forward. I'd also be willing to provide a couple of 12 oz bags of amazing coffee if i can use your script. i know that's the easy way out, but i need to get this going.

www.burr.roasters.com

thanks for any help provided.

johnny

j50:
I want a momentary stop button that i can pause or turn off.

How should this bit function?

I guess you also want some indication of how far into the 12hour cycle the device is, and if it is paused or come to a normal end.
Consider using an LCD1602 display with I2C backpack. These are cheap and easy to use.

So you basically have three states (stopped, running, paused) controlled with two buttons?

For accurate timekeeping (not sure how accurate it needs to be), an RTC might also be a good idea.

If you are willing to put effort into this, we can help out.

There is a forum called Gigs and Collaboration on this web site where you can arrange for someone to write code for you.

Have you worked with ‘any’ Arduino hardware and software before, what ?

Are you capable of coming up wth a schematic showing the hardware you need and then show it here ?

Posting images:
https://forum.arduino.cc/index.php?topic=519037.0

Thanks for the response. I'll try to answer in order.

wildbill "How should this bit function?"
I don't know. I think it should be, one button to start. Second button. One push is pause. second pause is start. Does this sound too complex for the very inexperienced?

6v6gt "I guess you also want some indication of how far into the 12hour cycle the device is, and if it is paused or come to a normal end.
Consider using an LCD1602 display with I2C backpack. These are cheap and easy to use.."

I had thought about it, but i didn't want to complicate. once i can understand more, i would like to do that. I have a 2x8 LCD and an IC2, but haven't looked at it or tested the parts yet.

sterretje "So you basically have three states (stopped, running, paused) controlled with two buttons? For accurate timekeeping (not sure how accurate it needs to be), an RTC might also be a good idea."

Yes, though start and stop are my must haves. Pause might be nice, say if i discovered a small leak or kink in a line that needs a quick fix. I just read about the RTC, Very useful tool, but i think it's overkill here. I need to be able to cycle a small pump for 12 to 20 hours, i will need to do some testing for total time, but i think the on board timer is close enough for this.

i dont know how to properly format code, but here it is. I stole it from someone else's work and have only modified the on/off times. it does the very basic operation i need. i can survive on this, but it's not very graceful; plug in to start and unplug to stop.

int in1 = 7;
void setup() {
pinMode(in1, OUTPUT);
digitalWrite(in1, HIGH);
}
void loop() {
digitalWrite(in1, LOW);
delay(12560);
digitalWrite(in1, HIGH);
delay(5
100*60);
}

"If you are willing to put effort into this, we can help out.

There is a forum called Gigs and Collaboration on this web site where you can arrange for someone to write code for you.

Have you worked with 'any' Arduino hardware and software before, what ?

Are you capable of coming up wth a schematic showing the hardware you need and then show it here ?"

Fantastic! Ill answer your questions in order. I have worked with an arduino, but only minimally. i designed and purchased most of the parts to monitor systems on my old Land Rover, oil temp and pressure, water temp, volts, amps and i can't think of what else. i wrote the code and tested several inputs and displays. Never installed, due to life getting in the way. i then used it as a timer to turn lights on and off to give my plants light over the winter. worked fine. had problems with the LEDs and power supplies so the ardiuno worked fine, but didnt run for more than a month.

i can write a schematic of the what i need. it's the coding that slows me down. thanks for the help. ill check out the Gigs and Collaboration forum, sounds like just what i need.

johnny

Sounds like a plan :wink:

Yes, show us a schematic and we can help "Pump You Up".

You should be able to do this with the forum's help. I doubt that you will need to pay someone through Gigs and Collaboration.

One thing to consider regarding the pause (stop/resume) is whether you need the machine to complete the interrupted on/off cycle when restarted after the pause, or just begin a new one.

This might be a starting point:

EDIT
Updated the attached sketch.

BrewMix.ino (11.4 KB)

The bad news is you need to write some C code, you can't write Java code for Arduino!

(Someone will probably prove me wrong now, but it was just a joke anyway).

For 12 or even 20 hours, you don't need an RTC, the Arduino's internal clock will be more than accurate enough for brewing purposes.

Honestly I think you have to put some effort in and try to learn the basics. There are many tutorials out there which are very good. We cannot or at least I cannot just write code to pass on to other people. It's not what this forum is about

What happens in pause mode? I assume that the relay is turned off. When you unpause, I'd guess that you forget about any partial minute of activity that was under way. Do you need to consider how far through the five minute break you were?

Here's my take: you're living your life in 5 minute intervals. Count seconds until you get to a minute, minutes until you get to 5 and 5 minute intervals until you get to 12 hours.

During each interval the relay is HIGH for the first minute and LOW for the rest. A boolean variable determines when you are in pause mode so the relay will not turn on.

I made a framework that might be a start. There is no code for handling button presses, example code for that is included in the IDE (File=>Examples=>Digital=>Button). Maybe wait for a button in startup() and in loop() look for a button press and toggle the value of the pause variable.

I recommend if you don't use a LCD at least have a couple LEDs that show status, like relay off, relay on and paused.

int seconds = 0;
int minutes = 0;
int intervals = 0;  // count of on/off intervals

unsigned long timer = 0UL;        // count ms

const int INTERVAL_LENGTH = 5;  // minutes
const int MAX_INTERVALS = 144;  // # of intervals in 12 hours

bool pause = false;     // relay off if pause == true

const byte RELAY_PIN = 2;


void setup() {

  Serial.begin(9600);

  // relay on
  digitalWrite(RELAY_PIN, HIGH);

}

void loop() {

  // counted to a second
  if ( millis() - timer >= 1000 )
  {
    Serial.print(".");

    // increment seconds and reset timer
    seconds++;
    timer = millis();

  } // if

  // counted to a minute
  if ( seconds >= 60 )
  {

    // increment minutes and reset seconds
    minutes++;
    seconds = 0;

    Serial.println();
    Serial.print(minutes);
    Serial.println(" minutes");

  } // if

  // interval reached?
  if ( minutes >= INTERVAL_LENGTH )
  {
    // increment intervals and reset minutes
    intervals++;
    minutes = 0;

    Serial.print(INTERVAL_LENGTH * intervals);
    Serial.println("  minutes");

    // if time is up, pause permanently
    if ( intervals == MAX_INTERVALS ) pause = true;

  } // if

  // relay on if in first minute unless paused
  digitalWrite(RELAY_PIN, ((minutes < 1) && !pause) ? HIGH : LOW);


}

thank you all for the initial input! Please give me a few days to digest and look up all that i dont understand. i promise i am trying to learn, but i think this is way over my ability to get to in the short time i am shooting for. i've got the stand, buckets pumps and simple program up and running. i think the timing is good enough, but needs to be monitored.

the pause button is there just to stop the process,briefly, to make physical adjustments and for unseen events, so the disruption would not have to count the down time, just to start the loop...... im not sure that this is even a realistic option. if the loop starts, the button wont be looked at until it's complete? no interruption of the loop? maybe just a start/stop option? that would also be ok. im trying to balance needs vs reality..... im jut not sure where that line is.

Eventually, i'll set up to run overnight so that cold brew coffee is ready in the morning. I'll have to add a level sensor to shut off. i think that is more feasible than some of my other ideas.

thanks!

johnny

The schematic and accompanying sketch in post #8 will obviously need fleshing out.

If you need explanation for these or others ask.