mBed AC algorithm