Problem: After running a test that creates static electricity, the values acquired by a hall-effect sensor are not correct anymore.

Context: The device I am working on draws and rolls up fishing wire/rope. I monitor the number of rotation it needs to rolls the wire up with (30) magnets all around the spool and an hall-effect sensor on its side measuring the number of magnet according to the direction of the rotation.

My set-up includes three parts: a main PCB, a smaller PCB with the hall-effect sensor and a zif cable that connects both PCBs. These PCB were designed by a EE firm and produced by a reliable mass-production facility. The issue is observed over different main and sensor PCBs.

On the firmware side: the main PCB reads the sensor values using interrupts running on the iRAM, with the MCU running at 240MHz. According to the direction signal it adds or subtracts to a volatile int every-time it senses a magnet. Then at the beginning of my state machine (every 50 ms) I LOG the values on the terminal and saves them every 2 seconds in the File System.

The monitoring works perfectly when no wire is on the spool, whatever the speed of the rotation or the stress on the test set-up.

When introducing the fishing wire, a discrepancy of one third of a rotation appears after 20 rotations; in other words, instead of having the correct result of 20 rotations, it measures down to 19.66 or up to 20.33 rotations.

The Weird part:
1) After observing the discrepancy, if the wire is removed from the test set-up and the test done again the discrepancy can still be observed.

2) The discrepancy is still observed after changing the zif cable or the sensor PCB.

3) Plugging out the electronics does not make the discrepancy disappear

4) The only solution to fix the discrepancy is to flash the firmware again.

5) Without wire, the results of the test are always correct.

Hypothesis: The only reason I can think of after a week of tests is that the wire can somehow change the voltage reference somewhere on the PCB that makes some signal incorrect.

Disclaimer: I have tried to sum-up a test that took 2 full weeks of my time, I might have forgotten some details. I will try to update this post with every new findings.

Question: Can the voltage reference on the PCB be changed by wire rolling up next to a sensor?

  • 1
    \$\begingroup\$ static can also damage components of your electronics \$\endgroup\$
    – PlasmaHH
    Commented May 29, 2018 at 9:21
  • \$\begingroup\$ What information is (re-)stored with the flashing. Programs, reference values? \$\endgroup\$
    – Oldfart
    Commented May 29, 2018 at 9:27
  • \$\begingroup\$ The thing is, the test is back to being correct after re-flashing the firmware. @Oldfart, the values are stored in the File System which is left untouched during the reflashing (I am actually doing a OTA update) \$\endgroup\$
    – valentin
    Commented May 29, 2018 at 9:28
  • \$\begingroup\$ That is why i ask details about what information you are re-flashing. Compiled-code, Reference tables, Calibration values, FPGA code? \$\endgroup\$
    – Oldfart
    Commented May 29, 2018 at 9:34
  • \$\begingroup\$ @Oldfart it includes the partition table, the main .bin and the bootloader .bin. There is no calibration. It's running on the ESP32 with the manufacturer SDK (on top of FreeRTOS). I have added firmware details to the post. \$\endgroup\$
    – valentin
    Commented May 29, 2018 at 9:41

1 Answer 1


Question: Can the voltage reference on the PCB be changed by wire rolling up next to a sensor? Yes it can, for example cause by ESD, however then I would expect that change to be permanent meaning a component suffered damage.

Since you can "fix" the change on the PCB by reflashing this does not appear to be what is happening. My guess is then that some event (possibly ESD) changes the content of the flash memory.

However if you have a more complex setup where a voltage is measured (using an external voltmeter for example), a calibration value determined and then programmed. Then the damage could be compensated for with a new calibration value. Probably you do not have this but I thought I just mention it in case you do.

  • \$\begingroup\$ Thank you for your answer. Would you have an advice on how to find out if indeed ESD (or other event) changes the flash content? Unfortunately, there is no calibration: very simple digital reads \$\endgroup\$
    – valentin
    Commented May 29, 2018 at 11:12
  • \$\begingroup\$ To prove it: write flash and read the bits out. There should be no change. Then do test without the wire and read out flash. There should be no change. Then repeat but with the wire in place. If then the read data has changed you have proof. To solve you might need to improve ESD / EMI robustness of the PCB. I would have to see the design to be able to make suggestions. \$\endgroup\$ Commented May 29, 2018 at 11:17
  • \$\begingroup\$ Thanks. In the first attempt the flash was indeed different but that could be due to the network the stack. Will clean the code and test again asap. \$\endgroup\$
    – valentin
    Commented May 30, 2018 at 8:37

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.