I am running a differential drive robot using an STM32 chip soldered on a customized PCB. The STM controls an array of Infra Red Sensors for line following and 2 DC Motors with encoders.
After around 2-3 hours of operation, the robot starts to have some delays in following the line and stopping. I am seeing a slower processing of the encoders and IR sensors over time which results in a huge delay in sending the commands.
I tried decreasing the speed by 50%, and the robot operated for a longer period of time.
Any idea what might be the problem for this decrease in performance over time?
2 DC Motors being handled by a controller. The STM reads the encoders from the controller which are correct and reliable values as per the testing has shown.
2 IR sensors array (polulu 15 IR Sensor array) of 15 sensors each. The STM read the values of the IR and controls the speed of the motors accordingly to keep the robot following the line. It is using the built in function from the Polulu sensor.
The robot uses the IR Sensors to stop at the right position (i check how many sensors read the line since at the stopping the line is wider). Now in case the sensor messed up, the encoders will detect it since it moved more or less than it should and the bot will be able to move to the right position again.
The issue I am facing is that after a certain time (mostly in 2 hours but its decreasing after more tests) the robot messes up the stopping position (it keeps driving) and the encoders takes time to start recovering. Even after the recovering the sensor doesn't see the line anymore. As if nothing is working.
I tried decreasing the speed by 50% and the issue did not happen anymore for more than 2 days of running the bot. And from the looks of it, it seems like everything is delayed, this is why i suspect that it could be the STM slowing down after a certain time.
How can I debug this? Check memory usage over time for example?
So many ways. One is just spotting it in the code. Another, serial debug statements. Is anything on the processor board getting hot? Did you read the guide as suggested in reply #10?
I really dislike guessing, but with no details on circuitry and no software listing; my suspicions are that you are drawing to much output current and "something" is heating up causing the uC to become erratic or simply shutdown.
In my shop, I would bring out the IR thermal camera; but, then again, I tend to do a rather detailed analysis of power parameters during the prototyping stage of designs. You can always use your finger to probe the temperature of the various components
(SERIOUSLY please do not actually use your finger ... you could suffer a severe burn.)
You could try measuring the total current being drawn if you have a decent DVM with a high-current DC section.