Servo interferes with CT reading when not on USB

Hi all,

I’m working on a project to control blast gates on my dust collection system with servos. The thing is the project works fine when the arduino is connected via the USB to a PC.
If i disconnect the arduino and run it from a 5V supply when the servo moves the CT circuit registers 3-4 A,which activates the servo. Then after the time delay and the servo goes to move the opposite direction it registers 3-4A again the cycle continues.

Any suggestions as to why it works when connected to USB but not when only running on the 5V supply?

I have a current monitor set up using a CT and circuit as found here the schematic can be found here

Attached below is the fritzing diagram of the setup.
EDIT: The AA battery holder in the diagram represents a 5V 5A supply.

#include "EmonLib.h"                   // Include Emon Library
EnergyMonitor emon1;                   // Create an instance

Servo myservo;
int gateOpen = 180;
int gateClose = 0;

#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd1(0x3D, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); 
// Specify the 1st I2C chip address used for 1st LCD & its connection pins
// (addr, en,rw,rs,d4,d5,d6,d7,bl,blpol);

const int ledPin = 13;

unsigned long currentMillis;
long previousMillis = 0;
long offDelay = 5000;

void setup()
  emon1.current(1, 60.6);             // Current: input pin, calibration.



pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW);

void loop()
  double Irms = emon1.calcIrms(1480);  // Calculate Irms only
  Serial.print(Irms*230.0);         // Apparent power
  Serial.print(" ");
  Serial.println(Irms);          // Irms


currentMillis = millis();

if (Irms >= 1)
{digitalWrite (ledPin, HIGH);

else if (Irms < 1 && currentMillis - previousMillis > offDelay){
previousMillis = currentMillis;
digitalWrite (ledPin, LOW);



When the Arduino reads an analog value from a sensor, the 5V pin or the 3.3V pin is used to power the sensor. You power the CT circuit with the 'raw' 5V power supply.

Can you measure the voltages with a multimeter ? What is the voltage of the 5V pin ? What is the voltage in the middle of the 10k resistors in the CT circuit. The large capacitor might leak, and lower the voltage.

The 5V supply measures at 5.474V and the junction between the resistors measures 2.741V.

Also for interest sake I changed the supply of the CT circuit to the arduino regulated 5v supply and got the same result, although the current when the servo operates only showed 1-2A

You feed 5V into VIN, then it has to pass a voltage regulator, then it goes to the microcontroller and the 5V pin. What is the voltage of the 5V pin of the Arduino ?

2.741 / 5.474 = 0.501 That means your capacitor is not leaking :)

Suppose the 5V pin is 4.5V, then 2.741 is not in the middle. You need to use the same voltage for a sensor as for the microcontroller. The CT coil with the two 10k and the capacitor is your 'sensor'.

A servo motor can require a peak of 500mA when it starts turning. Even a peak of 1A is possible. That might drop the voltage for the Arduino.

Your hard to follow Fritzing wiring diagram shows you are sharing ground and supply wires between a sensor and a servo (is that the servo?).

Never do that. Always separate high current supply and ground wiring from sensor supply and ground wires, otherwise you inject all sorts of crud into your sensor input.