I am building a POV display, where all modules work with 5V (Raspberry Pi / apa102 LED strip / motor).

First I built an ESC module using a universal PCB which uses 5V from the power supply and a PWM signal from the Raspberry.

There is also a speed sensor (encoder) circuit that uses a Schmitt-trigger IC (assembled on a breadboard) to adapt the signal to the Raspberry.

At this stage everything was good and there was no problem with the sensor and the Raspberry GUI was printing speed values without any problem. But when I assembled everything on the PCB, the speed values glitched sometimes and gave wrong measurements.

I noticed also that when I shut the motor down the measurement became correct (slow-down speed was right and smooth). It appeared that the motor is the cause of this. Maybe it was making noise. All this happened when I was testing at home. But the big surprise is that this does not happen at my university where the values are correct anyway. Even the oscilloscope shows very little noise.

My question is: why didn't my PCB work properly at my house but works alright at my University?

Did I make a mistake by assembling everything on one PCB? Especially the ESC?

The following picture is my PCB:

enter image description here

The following is the electronic schematic of the ESC section and sensing section:

enter image description here enter image description here

  • \$\begingroup\$ Sounds like your standard lack of decoupling, layout or measurement setup issue. Please show how you measure your signal. \$\endgroup\$
    – winny
    Nov 26, 2021 at 17:51
  • \$\begingroup\$ I don't think so i am using decoupling capacitors probably every were also there is pull up resistors... Okey i will post the sensing part as soon as possible \$\endgroup\$
    – 0ussama
    Nov 26, 2021 at 17:55
  • 1
    \$\begingroup\$ There's a good chance that it's a ground loop or some other wiring issue. Is the motor being powered off of the same 5V regulated supply that's running your computer? Is the ground wire from the ESC sharing the ground wire with other parts of the circuit? Is your encoder ground common with the motor drive wires? Are your encoder wires run adjacent to your motor drive wires with no shielding? \$\endgroup\$
    – TimWescott
    Nov 26, 2021 at 17:57
  • \$\begingroup\$ Decoupling is key. Is your motor brushed? If yes, do you have a flyback diode across it? \$\endgroup\$
    – winny
    Nov 26, 2021 at 17:57
  • \$\begingroup\$ @winny yes my motor is brushed and it is DC .. yes i have flyback diode... \$\endgroup\$
    – 0ussama
    Nov 26, 2021 at 18:58

1 Answer 1


The motor and logic should have own power supply, separate the voltage for logic with diode and place a low-pass after it.


simulate this circuit – Schematic created using CircuitLab

  • \$\begingroup\$ Do you mean that the logic wire goes to raspberry pi power input or what ? If that what you mean ... How that is possible if the raspberry pi uses 2.5 A and 5.25 V exactly .... The diode will drop voltage and the resistor must above 12.5 W ... \$\endgroup\$
    – 0ussama
    Nov 26, 2021 at 20:17
  • \$\begingroup\$ R1 is probably not necessary, although D2 probably needs to be capable of more current (I'd use a Schottkey rated for 2.5A). Check your Raspberry Pi specs, you can probably get away with giving it slightly less than 5V. \$\endgroup\$
    – TimWescott
    Nov 26, 2021 at 21:16
  • \$\begingroup\$ @TimWescott no if you try just 5V , the red LED will start blinking to indicate that the power supply is less then recommended which is 5.25 V (this what happen to me) \$\endgroup\$
    – 0ussama
    Nov 27, 2021 at 1:24

Your Answer

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

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