table with timer

I have a question about programming.

I will measuring the temperature on example 12:00 ones a day.
afther I no the temperature on 12:00 he must remember this temperatureo the next day 12:00 when we measuring the new temp.
The temperature that i measuring there i will make a selection into the table.
In appendix you see 2 tables first table selection temperature and the other one selection times/day.

example I have measurering 15 degree celsius on 12:00 hour.
I look to the first table and on 15 degree celsius I see that I must do something 2 times a day.
than I look to table 2 and I see that I must start at 11:00 and i must start at 14:00.

Can any one help me Wath the best programming is for this tables with selection.

I have arduino uno and a arduino ethernet.

I have arduino uno and a arduino ethernet.

But, do you have a clock?

he must remember this temperatureo the next day 12:00 when we measuring the new temp.

Why? I don't see anything that says do something different if the temperature is the same as yesterday vs. the temperature being different from yesterday.

than I look to table 2 and I see that I must start at 11:00 and i must start at 14:00.

If you check the temperature at noon, and see that you must do something at 11:00, you're an hour late already.

Dear PaulS

I wash planning to use the sparkfun deadon RTC DS3234 for clock.

I will measuring ones a day and than the temperature remember it 24 hours till the next measuring iff the time is not changed. And than if it 11:00 is than we must starting.

I hope I understand it other wise You can let me now.

Dear all,

For the table can I use maybe the arrays for this iseu.

For the table can I use maybe the arrays for this iseu.

Of course. That's what you would use.

Is there also more solutions for this iseu

Tell us what you want to do in some details. I can see there are as many as 6 temperature measurements a day or as few as 1 measurement a day. OK, now what do you do with this table? Does someone decide how many times the temperature should be measured or is arduino programmed to decide? I'm totally confused what you want. I think if you use your native language and google translate it, it would be more understandable. What you posted makes it very hard for non-native English speakers to understand.

Dear Liudr.

Thank you very much for you comment. I have 1 temperature sensor and a timer and that must give a signal to my motor when he must run. The temperure difference select how many time's my motor must be running.

The first table you see a temperature from 5 degree to 30 degree the value behind the temperature is saying how many time's the motor must be running each day. I measuring the temperature one a day. Motor is only running 90 sec each time. The second table is like a timer switch per day and there I select on wath for time the motor must be running dependent on wath for temperature I measuring.

For example: I measuring the temperature at 12:00. The measuring is then 21 degree. When I go compare the temperature with my first table than give me a valeu of 4 times running the motor that day. Than I compare the second table and the 4 times running. The times that the motor must be start is than 11:00-12:00-14:00-18:00 for each run 90 sec.

I hope that you now understand what I mean. If my explantion is not good let me now.

PaulS: If you check the temperature at 12:00, and see that you must do something at 11:00, you're an hour late already.

Do you understand this issue ?

This is pseudo code. It will not compile. It is only meant to give you an example of a possible solution. I also like the PCF8563. It has an alarm that can be set and can trigger an interrupt when it pops. You can put your Arduino to sleep for hours and the interrupt will wake it up when the interrupt triggers. The chips are less than $1 US when you buy more than 10 at a time and you only need a couple pull up resistor and a crystal that cost just a few pennies more.

Setup:
  NextTime = 12:00
  TimesPerDay = 0
  TempAt12 = 0

Loop:
  if (NextTime = CurrentTime) {
    TempSample = GetTemp();
    Switch (TimesPerDay)
      Case 0:
        NextTime = 23:59
        break;

      Case 1:
        if (CurrentTime == 11:00) 
          DoSomethingWith(TempSample)
          NextTime = 12:00 
        break;

      Case 2:
        if (CurrentTime == 11:00)
          DoSomethingWith(TempSample)
          NextTime = 12:00 
        else if (CurrentTime == 12:00) 
          NextTime = 14:00 
        else if (CurrentTime == 14:00) 
          DoSomethingWith(TempSample)        
          NextTime = 23:59
        break;

      Case 3:
        if (CurrentTime == 11:00)
          DoSomethingWith(TempSample)
          NextTime = 12:00 
        else if (CurrentTime == 12:00) 
          NextTime = 13:00 
        else if (CurrentTime == 13:00) 
          DoSomethingWith(TempSample)
          NextTime = 17:00 
        else if (CurrentTime == 17:00) 
          DoSomethingWith(TempSample)        
          NextTime = 23:59
        break;

        ...
        
    if (CurrentTemp == 12:00) 
      TempAt12 = TempSample

    if (CurrentTemp == 23:59) 
      SetTimesPerDay()
      if (TimesPerDay == 0)  
        NextTime = 12:00 
      else 
        NextTime = 11:00 
        
  }  /* if */


SetTimesPerDay()
  uint8_t array[] = {0,1,1,1,2,2,3,3,3,3,4,4,4,4,4,4,4,3,3,0}

  i  = constrain(TempAt12, 10, 29)  // limit temp to 10-29 degrees
  i -= 10 // shift index to 0-19
  TimesPerDay = array[i]

Much better this time. Michael raised a good question. You should answer that one first. You still didn't tell us what this project is for. Is it for a fish tank or glass house?

Dear Liudr and Michael,

What I accetly mean is that I have measuring a temperature on 12:00. The temperature that I have measured tel us also howmany times my motor must running on each day. That can for example on 11:00 that day

THe project is a litlle bit a secret that also the mean reason that I can not telling everthing about the project. Later afther everything is registrate for padend pending than I can tell everything.

I hope that this is not a big problem that I can not telling everything

You seem to not understand Michael's question. If you measure the temperature at 12:00 and find out that you must start something at 11:00 you cannot do that because that time is in the past, gone and you cannot go back in time (to my knowledge). My guess is you don't wanna measure the temperature at 12:00 but at 00:00, then you have the whole day before you. Am I guessing correctly?

Taking a temperature measurement at midnight doesn't seem to make much sense. I was thinking it might be midday, but setting the schedule for the next day.

Dear Dxw00d

on a lather step i will that I can change this settings that I can change the time when I will measuring.

It is not at midnight but at midday at this moment.

bjoang: Dear Dxw00d

on a lather step i will that I can change this settings that I can change the time when I will measuring.

It is not at midnight but at midday at this moment.

Then how do you expect something to run at 11:00 based on data retrieved at 12:00?

Patents, secrets? With the level of explanation you give, you should hire someone to do this for you. You may have a decent idea but you seem to lack skills to execute it. I have a lot of those ideas myself. I'm no longer interested in helping anymore. :roll_eyes:

Dear Liudr

I respect your answer, but I'm still not sure it's all going to work so I first do it by hobby and if it fails I have a nice hobby and i learning a lot from arduino. but thanks for the help you've given.

Dear Arrch

If I remember the valeu for 24 hours till the next temperatuur measuring

bjoang: Dear Liudr

I respect your answer, but I'm still not sure it's all going to work so I first do it by hobby and if it fails I have a nice hobby and i learning a lot from arduino. but thanks for the help you've given.

It's a bit ironic that you are building this patented secret device on the backbone of a technology that strives for open source development and collaboration...

Regardless, the first part is easy, just create an array with temperature as the key and the times per day as the value. You just have to bias it by 5 when indexing it, so the key would be temperature-5.

Second one should just be if statements at those times. As in, at 12:00/13:00/14:00/etc., check if the number of times per day is one of the specified values.