detection of external stimulus