BS2 Strange Behavior
dcscott
Posts: 3
Hello all. I have a BS2p24 that I am using to control an assembly that has a 24V DC motor and 2 Hall effect sensors (these run through a comparator circuit that provides a logic high when the sensors are tripped).
I'm using the Stamp to control an Allegro A4973 motor driver (providing PHASE and ENABLE output to the motor driver), and the sensors provide input to the Stamp. Additionally, there is a switch provided to set an operation "mode" (input to the Stamp).
In essence, with the unit in the cycle mode, it should travel between the 2 sensors until user input (the switch) changes. In the other mode, the unit should stop motion at the next sensor that is tripped (stop on limit). I additionally have status LEDs for the user to indicate which sensor is tripped and the direction of travel.
On an initial startup, the unit works correctly. In the cycle mode, it will cycle between the sensors correctly, and when switched to the stop on limit mode, the unit stops at the next sensor it trips. I can then set the mode switch back to cycle to initiate movement in the opposite direction and set the switch back to stop on limit mode and the unit will again correctly stop at the next limit. This is repeatable.
However, after only a short period of time (maybe 60-90 seconds), the unit will start behaving erratically. It will start to "miss" the next sensor trip. In other words, when I set the mode switch from cycle to stop on limit, the unit will travel to the next limit, reverse direction, and then stop at the other limit (the position it started from). In my testing, it also appears that the longer the unit runs the more it will miss the sensor trips (often skipping 2 or more sensor trips before deciding to finally stop).
Given that the unit initially functions as expected, I'm biased to believe my code is correctly functioning, so I'm wondering if any of you fine folks have any ideas about what could be causing the erratic behavior I'm seeing?
I'm using the Stamp to control an Allegro A4973 motor driver (providing PHASE and ENABLE output to the motor driver), and the sensors provide input to the Stamp. Additionally, there is a switch provided to set an operation "mode" (input to the Stamp).
In essence, with the unit in the cycle mode, it should travel between the 2 sensors until user input (the switch) changes. In the other mode, the unit should stop motion at the next sensor that is tripped (stop on limit). I additionally have status LEDs for the user to indicate which sensor is tripped and the direction of travel.
On an initial startup, the unit works correctly. In the cycle mode, it will cycle between the sensors correctly, and when switched to the stop on limit mode, the unit stops at the next sensor it trips. I can then set the mode switch back to cycle to initiate movement in the opposite direction and set the switch back to stop on limit mode and the unit will again correctly stop at the next limit. This is repeatable.
However, after only a short period of time (maybe 60-90 seconds), the unit will start behaving erratically. It will start to "miss" the next sensor trip. In other words, when I set the mode switch from cycle to stop on limit, the unit will travel to the next limit, reverse direction, and then stop at the other limit (the position it started from). In my testing, it also appears that the longer the unit runs the more it will miss the sensor trips (often skipping 2 or more sensor trips before deciding to finally stop).
Given that the unit initially functions as expected, I'm biased to believe my code is correctly functioning, so I'm wondering if any of you fine folks have any ideas about what could be causing the erratic behavior I'm seeing?
Comments
I've reviewed it several times, but I'll take another look. My thoughts ran along yours; If I had a poorly isolated circuit and noise was the cause, I'd expect it to present earlier as well.
The unit is set to run standalone, so no PC is connected and there are no connections to the serial pins.
What type of switch are you using to control the mode? Does it have appropriate pull-up/pull-down resistors? If not, a floating input could be interpreted in the wrong state.
Can you add LEDs to display the mode? It seems from your description that the Stamp is changing modes, so knowing which mode it is actually in would help.
After reseating the Stamp, it all functions normally and for extended periods.
Thanks for all your ideas for help!