An OS transistor is preferably used as each of the transistors 612 and 634. Since the off-state current of the OS transistor is extremely low as described above, the capacitor 633 can be small or omitted. Furthermore, when the transistors 612 and 634 are OS transistors, the potential of the node 637 is less likely to be changed. Thus, an imaging device that is less likely to be affected by noise can be provided.
The transistor 635 is provided on the substrate 401. The transistor 635 can function as an n-channel transistor. A well 620 of a p-type semiconductor is provided in a portion of the substrate 401. The well 620 can be provided by a method similar to that for forming the p-type semiconductor 621. The well 620 and the p-type semiconductor 621 can be formed at the same time. Note that the transistor 282 described above can be used as the transistor 635, for example.