Welcome, Guest
Username: Password: Remember me

TOPIC: Arctic Hare mod by Jussi

Arctic Hare mod by Jussi 1 month 1 week ago #18185

  • Stockfisch
  • Stockfisch's Avatar
  • Offline
  • User
  • User
  • Posts: 102
  • Thank you received: 2
I have this one: www.marotronics.de/Ardumower-Power-Pack-...i-Mn-Akku-13790-Euro
provided by shop

What do you think about this charger: rover.xbay.com/rover/0/0/0?mpre=https%3A...2Fitm%2F323861287466

Best,
Bjoern

Please Log in or Create an account to join the conversation.

Last Edit: by Stockfisch.

Arctic Hare mod by Jussi 1 month 1 week ago #18192

  • jussip
  • jussip's Avatar Topic Author
  • Offline
  • User
  • User
  • Posts: 237
  • Thank you received: 22
You can use it. It's 29.4v li-ion charger. Those can get quite hot, that's why I bought alum. with fan.
5Ah battery and charging current 3A means that so called c-rate for charging is 0.6. For long term use it's better go 0.5 or below. 0.5C charging current in this case is 2.5A or below. I'm charging 10.5Ah battery with 3A charger. It takes about 5h to charge from 23.8v to 29.4v.

This recover serial connection when due resets. Now there's no error anymore. In that error problem was that script doesn't exit it stays 'stuck' and systemctl didn't restarted it. I don't is there solution to exit script case like that?
if DueConnectedOnPi:
        try:
            mymower.dueSerialReceived=Due_Serial.readline()
            if str(mymower.dueSerialReceived)!="b''":
                
                mymower.dueSerialReceived=str(mymower.dueSerialReceived,'utf8')
                if mymower.dueSerialReceived[:1] != '$' : #it is console message because the first digit is not $
                    if(len(mymower.dueSerialReceived))>2:
                        consoleInsertText(mymower.dueSerialReceived)
                        
                else :  # here a nmea message
                    #print(mymower.dueSerialReceived)
                    #message = pynmea2.parse(mymower.dueSerialReceived)
                    #decode_message(message)
                
                    try:
                        message = pynmea2.parse(mymower.dueSerialReceived)
                        decode_message(message)
                    except :
                    #    print("INCOMING MESSAGE ERROR FROM DUE --> " + str(mymower.dueSerialReceived))
                        consoleInsertText("INCOMING MESSAGE ERROR FROM DUE" + '\n')
                        consoleInsertText(str(mymower.dueSerialReceived) + '\n')

        except:
            print("Due serial connection fail, trying to reset")
            Due_Serial.close()
            time.sleep(3)
            Due_Serial.open()
The following user(s) said Thank You: Bernard, Stockfisch

Please Log in or Create an account to join the conversation.

Arctic Hare mod by Jussi 1 month 1 week ago #18199

  • Stockfisch
  • Stockfisch's Avatar
  • Offline
  • User
  • User
  • Posts: 102
  • Thank you received: 2

jussip wrote: You can use it. It's 29.4v li-ion charger. Those can get quite hot, that's why I bought alum. with fan.


Hello
I just ordered the one behind my link. In the text is written that there is a fan installed. We will see :cheer:
I will report about quality.
Thanks and best regards,
Bjoern

Please Log in or Create an account to join the conversation.

Arctic Hare mod by Jussi 1 month 3 days ago #18267

  • jussip
  • jussip's Avatar Topic Author
  • Offline
  • User
  • User
  • Posts: 237
  • Thank you received: 22
If watchdog reset due mower start again but doesn't start mowing. Is there any way to recognise watchdog reset and start mowing? checktimer maybe..
Changing this makes it always start mowing mode
stateLast = stateCurr = stateNext = STATE_OFF;

Please Log in or Create an account to join the conversation.

Arctic Hare mod par Jussi 1 month 2 days ago #18282

  • Bernard
  • Bernard's Avatar
  • Offline
  • User
  • User
  • Posts: 1073
  • Thank you received: 210

If watchdog reset due mower start again but doesn't start mowing.

YES it 's what i want and i think it's not a good idea to automaticly restart .
The watchdog is the last error level so it's here to avoid mower run without control.

If you really want to test this :
if (!buttonUse) {
    // robot has no ON/OFF button => start immediately
    setNextState(STATE_FORWARD_ODO, 0);
  }
but at your own risk.

Please Log in or Create an account to join the conversation.

Arctic Hare mod par Jussi 1 month 2 days ago #18283

  • jussip
  • jussip's Avatar Topic Author
  • Offline
  • User
  • User
  • Posts: 237
  • Thank you received: 22
This is how to detect watchdog reset
const char signature [] = "ArduMower";
char * p = (char *) malloc (sizeof (signature));
int ii;
void watchdogSetup(void) {}

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  Serial.println("Setup.................");

  if (!strcmp (p, signature)) // signature exist
  {
    Serial.println ("Watchdog activated reboot.");
  }
  else
  {
    Serial.println ("Cold start.");
    memcpy (p, signature, sizeof signature);  // copy signature into RAM
  }

  watchdogEnable(1000);// Watchdog triggerss after 1sec if not reseted.
  ii = 0;
}


void loop() {
  // put your main code here, to run repeatedly:
  while (ii <= 20)
  {
    ii = ii + 1;
    delay(500);
    Serial.println(ii);
    watchdogReset();
  }
  Serial.println(" reset on the 1010 pause");
  delay(1010);
}
Then somethong like this to timer.h
..........
              Console.print(F(" Distance before start "));
              Console.println(whereToStart);
              setNextState(STATE_STATION_REV, 0);
            }
            if ((stateCurr == STATE_OFF) && (resetByWDT))
            {
              resetByWDT = false;
              Console.println(F("Trying once to recover from watchdog reset"));
              ActualRunningTimer = i;
              mowPatternCurr = timer[i].startMowPattern;
              setNextState(STATE_FORWARD_ODO, 0);
            }
          }
        }
        if ((stateCurr != STATE_STATION) && (stopTimerTriggered) && (ActualRunningTimer == i)) // Stop only the running timer
        {
          Console.println(F("timer stop triggered"));
          ActualRunningTimer = 99;
          if (perimeterUse)
            setNextState(STATE_PERI_FIND, 0);
          else
            setNextState(STATE_OFF, 0);
        }
        if ((stateCurr == STATE_OFF) && (stopTimerTriggered) && (perimeterUse) && (resetByWDT))
        {
          resetByWDT = false;
          Console.println(F("Screw you guys, I'm going home!!!"));
          setNextState(STATE_PERI_FIND, 0);
        }
      }
    }
  }
}
and robot.cpp
case STATE_OFF:
......
    checkBattery();
    if (resetByWDT) // check timer after wdt reset
    {
      nextTimeTimer = millis() - 1;
      checkTimer();
    }
    break;
The following user(s) said Thank You: Bernard

Please Log in or Create an account to join the conversation.

Arctic Hare mod par Jussi 1 month 2 days ago #18284

  • Bernard
  • Bernard's Avatar
  • Offline
  • User
  • User
  • Posts: 1073
  • Thank you received: 210
Thanks but the most important for me is to know why the wtd is trigger.
And debug the code to avoid this behaviour.
BUt how.

Please Log in or Create an account to join the conversation.

Arctic Hare mod par Jussi 1 month 2 days ago #18287

  • jussip
  • jussip's Avatar Topic Author
  • Offline
  • User
  • User
  • Posts: 237
  • Thank you received: 22
You are absolutely right, that's wrong way treat symptoms not real causes.
Pi doesn't anymore cause wdt reset at startup. timeout 0 -> 5 solved that
Due_Serial = serial.Serial('/dev/ttyACM_DUE',115200,timeout=5)
Where 'over 1 sec' comes from? This print out loop run time in ms if time is over 250 ms. readDHT takes 270-280 ms and this line pop's out when dht is read. I have run this several hours now and 291 ms is max loop time for now
if (millis() >= nextTimeInfo) {
    if ((millis() - nextTimeInfo > 250)) {
      if (developerActive) {
        Console.print("------ LOOP NOT OK DUE IS OVERLOAD -- Over 1 sec ");
        Console.println((millis() - nextTimeInfo));
      }
    }
    nextTimeInfo = millis() + 1000; //1000
    printInfo(Console);
    checkErrorCounter();
    if (stateCurr == STATE_REMOTE) printRemote();
    loopsPerSec = loopsPerSecCounter;
    loopsPerSecCounter = 0;
  }

Please Log in or Create an account to join the conversation.

Arctic Hare mod par Jussi 1 month 2 days ago #18288

  • Bernard
  • Bernard's Avatar
  • Offline
  • User
  • User
  • Posts: 1073
  • Thank you received: 210

Pi doesn't anymore cause wdt reset at startup. timeout 0 -> 5 solved that

I use a screen ,so it's easier to check but I never see error on startup (Certainly I start it more than 2 or 300 time) ,so are you sure that you don't autostart 2 time the Piardu, one as service and again on other session like terminal ?
I use Pi3B+

Where 'over 1 sec' comes from?

The nexttimeinfo is set to 1000ms , and in my mower the loop/sec is always >5000,so normaly at 1020ms for example we need to execute again the Loop.
The max duration call is the DHT and near 250ms ,it's why i have print the message only if millis() - nextTimeInfo > 250 .
I have the same result as you with 290 ms message but only 4 or 5 time in 2 hours
Stockfisk show me a 2494 ms over 1 sec and it's not normal at all in normal mowing mode.
But i can't understand why ? except a I2C bug.

I join a console sample of 2 hours mowing so you can see the due overload.
This attachment is hidden for guests.
Please log in or register to see it.

This message has an attachment file.
Please log in or register to see it.

Please Log in or Create an account to join the conversation.

Arctic Hare mod par Jussi 1 month 1 day ago #18289

  • jussip
  • jussip's Avatar Topic Author
  • Offline
  • User
  • User
  • Posts: 237
  • Thank you received: 22
Yes, but it compares loop time only once per second. Sometimes this happen same time with readDHT and warning pop's up.
This check code compares every loop and I get same reading but every time with readDHT
if ((millis() - looptime > 250))
  {
    Console.print("loop run time check ");
    Console.println((millis() - looptime));
  }
  looptime = millis();
20:31:56 loop run time check 279

20:31:56 readDHT22 executing time: 271

20:31:26 loop run time check 288

20:31:26 ------ LOOP NOT OK DUE IS OVERLOAD -- Over 1 sec  274

20:31:26 readDHT22 executing time: 271

20:30:56 loop run time check 291

20:30:56 readDHT22 executing time: 271

Please Log in or Create an account to join the conversation.

Last Edit: by jussip.

Arctic Hare mod par Jussi 1 month 1 day ago #18290

  • Bernard
  • Bernard's Avatar
  • Offline
  • User
  • User
  • Posts: 1073
  • Thank you received: 210
Yes once per second to avoid load the due.

warning pop's up

Ok i check this parts because at my first start to work with Pi i have made a lot of speed test with serial to be sure all can work fast.

I write this part of the code before setup the watchdog to find the correct 2 secondes value.

Maybe test on a full 1 or 2 hours run to be sure you have only the message when read DHT and long message ?
Thanks.

Please Log in or Create an account to join the conversation.

Arctic Hare mod par Jussi 1 month 1 day ago #18291

  • jussip
  • jussip's Avatar Topic Author
  • Offline
  • User
  • User
  • Posts: 237
  • Thank you received: 22
3 hours console log, just wait/off and loop time measuring

Temperature can be taken from pi (processor temp)
/opt/vc/bin/vcgencmd measure_temp
or just float number
/opt/vc/bin/vcgencmd measure_temp | cut -c6-9

This message has an attachment file.
Please log in or register to see it.

Please Log in or Create an account to join the conversation.

Last Edit: by jussip.
Time to create page: 0.483 seconds