1
\$\begingroup\$

I am working on a simple Arduino project which counts rotation using rotary encoder. After some calculation, I store this data to EEPROM.

I have used Arduino nano.

rudimentary block circuit diagram of the project is as below. enter image description here

entire system is working completely fine when power supply is on. But when power supply is disconnected, Arduino is detecting some random pulse on rotary encoder sensor pins and modifies count and stores into EEPROM.

I have very little knowledge on circuit design. But i am suspecting, this undefined behavior is because of the 1000uF capacitor.

Please suggest me a circuit design to eliminate this undefined behavior.

Thank you.

\$\endgroup\$
9
  • 1
    \$\begingroup\$ Brown-out detection is required. Look it up. \$\endgroup\$
    – Andy aka
    Aug 2, 2020 at 9:02
  • \$\begingroup\$ AVRs used to have a known issue with EEPROM corruption. It really needs proper reset if power supplies are not within specs for running. One solution was to not use the first page of EEPROM, and keep the write address register pointing to address 0 when not being used. \$\endgroup\$
    – Justme
    Aug 2, 2020 at 10:09
  • \$\begingroup\$ How many times has the EEPROM been written? \$\endgroup\$ Aug 2, 2020 at 10:34
  • \$\begingroup\$ Maybe rig up a voltage divider and monitor the regulator input, force a shutdown when it starts to fall. \$\endgroup\$ Aug 2, 2020 at 10:50
  • 1
    \$\begingroup\$ put an opto on the 12v rail with a big enough resistor that it normally barely turns on, read the output with your sketch, don't save if opto output is off. \$\endgroup\$
    – dandavis
    Aug 3, 2020 at 8:04

1 Answer 1

0
\$\begingroup\$

Use pull down resistors on the Arduino input pins. Assuming the output of the encoder is logic high.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.