A photoelectric sensor can include: a lighting element configured to generate a first optical signal, where a second optical signal is generated by reflection of the first optical signal when emitting an object; a driving circuit configured to drive the lighting element; a photoelectric conversion circuit configured to generate a first optical current in accordance with the second optical signal; and a programmable current amplifier circuit configured to sample and hold the first optical current when the lighting element is in operation, and to generate a second optical current when the lighting element is out of operation in one detection period, where the second optical current lasts for at least one working period in the detection period, and where the second optical current represents the first optical current.