We have a quite complicated device which runs on Atmega328PB MCU which is incorporated on the analog of Arduino Nano board. User deflects joystick, and MCU controls stepper motor drivers accordingly, also communicating by Bluetooth. Device consists of the following parts:

  1. 12V@2A wall PSU (MeanWell) connectet to Vin of Arduino with 100 uF bypass electrolytic capacitor
  2. Industrial APEM joystick with 0.5-4.5V analog outputs (X and Y axis, connected to A0 and A1 analog inputs accordingly).
  3. I2C OLED LCD (20x4)
  4. Two HC-06 Bluetooth modules
  5. Two Allegro A4988 drivers from Pololu connected to a couple of bipolar stepper motors. Vref of drivers is set to 0.25V rendering maximum current of 460 mA.
  6. A button, connected to digital input pin D9.
  7. Indicator LED, connected to D10.

5 volts for all consumers are supplied by AMS1117 installed on the Arduino board. We have a repeating problem, that after some time of successful operation, A0 input begins to read strange data. We measured the following resistances:

  1. A0 - GND: 210 Ohm
  2. A0 - 5V: 1700 Ohm

This resistances are reached gradually from normal several M ohms, not in a single step. Our only idea was that protection diodes on the input were fried.Pin schematic from datasheet DMM shows the following voltage drop:

  • D1: 0.155V
  • D2: 0.55V

On normal pins values are 0.75V and 0.62V accordingly. Moreover, we noticed that two other input pins (A1 and button D9) are also damaged, but to a lesser extent. All output pins are OK.

What can possibly be a reason of such failure? And what actions should be taken to find it out?


General layout General view. Power (12V) goes to the gray box, from there goes to the main PCB, where onboard AMS1117 regulator provides 5V, which goes back to joystick. When fully assembled, main board with motors and screen are located in a large plastic enclosure. Big rocker switch provides 12V to Arduino regulator.

Connector board

PCB inside gray box. Connects joystick, button with LED, 12V power and a cable going to the main PCB.

Main PCB

Main PCB. That's where Arduino, drivers, motors, BT modules and screen are connected.

THANKS TO EVERYONE You've guided me to right direction (so I hope). Below are oscillograms recorded during various conditions.

Output of AMS1117 5V regulator after turning on main switch Output of AMS1117 5V regulator after turning on main switch

12V after turning on main switch Same for 12V

Voltage on analog input Voltage in analog input after turning on main switch. That's probably the perpetrator: undershoot down to -1.28V

Joystick disconnected Even worse if I disconnect joystick output from the analog pin. Voltage goes down to -5V. I believe that when connected to MCU, protection diodes are dying while trying to clamp this voltage.

Standalone joystick If I power up a standalone joystick (not connected to anything), signal on it's output demonstrates normal behavior. When system is under normal operation, both 5V and 12V show very high stability under any circumstances (motors idle or running at full speed, BT transmission on and off).

What is causing such dreadful behavior of joystick output, and how to combat it???

  • \$\begingroup\$ It might help if you clearly separated whatever parts of the system are on the far side of the radio link. What sort of environment does the transmitter side that is failing operate in? Do you have long cable runs? Industrial machinery? Welding/plasma cutting/fusion research reactor... \$\endgroup\$ Commented Oct 30, 2019 at 16:21
  • \$\begingroup\$ Can you break the circuit and measure current flow between the joystick and arduino analog input as you sweep through the range? \$\endgroup\$
    – nvuono
    Commented Oct 30, 2019 at 16:28
  • \$\begingroup\$ Could it be ESD damage? Is the pin broken out to some connector and the joystick connects via a cable and a mating connector? \$\endgroup\$
    – anrieff
    Commented Oct 30, 2019 at 16:51
  • \$\begingroup\$ @ChrisStratton Bluetooth modules are attached to the same PCB where we put Arduino as a shield. I don't think that these modules are to blame, it is well tested in many projects. Environment is a standard lab. \$\endgroup\$
    – Zhenek
    Commented Oct 30, 2019 at 16:52
  • \$\begingroup\$ @nvuono you mean by DMM as an ammeter? Or using resistor in series and measuring quick voltage drop with oscilloscope? \$\endgroup\$
    – Zhenek
    Commented Oct 30, 2019 at 16:53

1 Answer 1


While it can't be said for sure, your MCU pins could be killed by ESD. The failure mode you describe can be quite typical for ESD damage. You can test this with an ESD tester, but it's easier to install protection and see if the thing still fails. You can use some TVS diodes rated for 5V on the analog inputs. You can also put some resistance, e.g. 100Ω on the input, to limit the static discharge current, like this:


simulate this circuit – Schematic created using CircuitLab

  • \$\begingroup\$ Thanks! But what is the source of the ESD? MCU is in the plastic enclosure, and user never touches any contacts or connectors. \$\endgroup\$
    – Zhenek
    Commented Oct 30, 2019 at 17:49
  • \$\begingroup\$ Before you connect the joystick, it may have accumulated some static charge. Depending on which pins mate first - sometimes this static charge flows safely through the ground, but if it's the signal pins, then you have it. What model are the connectors btw? \$\endgroup\$
    – anrieff
    Commented Oct 30, 2019 at 17:55
  • \$\begingroup\$ The problem is that once system assembled, user doesn't disconnect anything. Connectors are Connfly HU/WF aeries. Apem provides joystick with such connector (HU-7) already mounted. \$\endgroup\$
    – Zhenek
    Commented Oct 30, 2019 at 18:12
  • \$\begingroup\$ @Zhenek: to clarify: after everything is connected, the system works, and then degrades after some use? Or something else? \$\endgroup\$
    – anrieff
    Commented Oct 31, 2019 at 9:37
  • \$\begingroup\$ I've added some pictures. I guess I've fount the culprit, but I have no idea why it's happening. \$\endgroup\$
    – Zhenek
    Commented Oct 31, 2019 at 13:32

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.