Gas sensing via chemoresistive effect in nanograined semiconductors