Finding a change in a signal
You need to be sure about:


Noise power is bounded
The power of the signal step is higher than 4 times that noise power.


If the noise power is bounded and the change in the signal level is higher than 4 times that noise power (from the pictures it seems to be so, I mean, the step is more than twice the max value of noise), why not take the derivative of the signal? something like:

step = abs(x[n] - x[n-1]);
if (step &gt; threshold)
{
  // Event has happened: 
  // 1. Take timer value
  event_time = get_time();
  // 2. Update the state machine
  state = (state == START_STATE) ? STOP_STATE : START_STATE;
}


Well, the get_timer() is specific to your MCU and there are better ways to implement a Finite State Machine, but that is the idea. It is fast and fulfills the requirements, I would not go further.