Born about 1790, he was educated for the Church of Scotland, and was licensed to preach; but he abandoned the church for the teaching profession. He became rector of the Royal Academy of Tain, in Ross-shire. After saving a little money, he provided a substitute to perform his duties, and went to Paris. There he attended the lectures of Louis Jacques Thénard, Joseph Louis Gay-Lussac, and Jean-Baptiste Biot. He soon acquired skill in devising and performing experiments in natural philosophy.