Seeed CurrentSensor SCT-013-030

Hi,

I have a question about something weird.
I would like to measure a DC current. On the forum and the internet I read that this sensor only measures the AC currents.
So when I plug in the sensor it only measures 0 Amps.

Last year however someone else was capable of using this sensor to measure DC currents.
The only difference is the fact that he was using an arduino Due + Fez Medusa 3D and I’m using a Fez Spider.
I hope anyone can give me an answer why it worked last year and doesn’t work with me?

Not sure what you mean by measures 0 amps? A DC current through a transformer like this will still generate a DC current out the other side… it’s then al about how you process and analyse the data you get

But this is the wrong tool for the job. You need a proper shunt resistor and measure the voltage drop over it.

And if you found “someone else” it will always help if you show evidence of what they did, that way we might be able to explain to you how to achieve the same outcome on your Spider, as I am confident that if someone else did it we can replicate that.

This is the script used with the arduino:


 #include <Wire.h>
 #include <SPI.h>

 #include <Gadgeteering.h>
 #include <Mainboards/FEZMedusaShield3D.h>

 #include <Modules/Current.h>
 #include <Core/Types.h>

using namespace gadgeteering;
using namespace gadgeteering::mainboards;
using namespace gadgeteering::modules;

fez_medusa_shield_3d board; 

current C1(3);

void setup()
{
Serial.begin(9600); 
}

void loop()
{
 
   double motor_current = C1.get_current_reading();
  
   Serial.print("C1: ");
   Serial.print(motor_current);
   Serial.println
```cs
("A. ");
   
   
   
  delay(1000);
 }

And this is the code I wrote for the Spider:


namespace BT_SpiderCtrlByWinPhone
{
    public partial class Program
    {

private double current;

GT.Timer timergetData;

 #region ProgramStarted()
            // This method is run when the mainboard is powered up or reset.   
            void ProgramStarted()
            {

// Set a timer to get data from the sensors in intervals
                timergetData = new GT.Timer(GetInterval);
                timergetData.Tick += new GT.Timer.TickEventHandler(timerGetData_Tick);
                timergetData.Stop();
}
            #endregion

 #region timerGetData_Tick gets data from sensors
            void timerGetData_Tick(GT.Timer timer)
            {
                current = currentSensor.GetCurrentReading();
                

            }
            #endregion

   }
}


namespace BT_SpiderCtrlByWinPhone {
    using Gadgeteer;
    using GTM = Gadgeteer.Modules;
    
    
    public partial class Program : Gadgeteer.Program {
        
        /// <summary>The USB Client DP module using socket 1 of the mainboard.</summary>
        private Gadgeteer.Modules.GHIElectronics.USBClientDP usbClientDP;
        
        /// <summary>The CurrentSensor module using socket 9 of the mainboard.</summary>
        private Gadgeteer.Modules.Seeed.CurrentSensor currentSensor;
        
        /// <summary>This property provides access to the Mainboard API. This is normally not necessary for an end user program.</summary>
        protected new static GHIElectronics.Gadgeteer.FEZSpider Mainboard {
            get {
                return ((GHIElectronics.Gadgeteer.FEZSpider)(Gadgeteer.Program.Mainboard));
            }
            set {
                Gadgeteer.Program.Mainboard = value;
            }
        }
        
        /// <summary>This method runs automatically when the device is powered, and calls ProgramStarted.</summary>
        public static void Main() {
            // Important to initialize the Mainboard first
            Program.Mainboard = new GHIElectronics.Gadgeteer.FEZSpider();
            Program p = new Program();
            p.InitializeModules();
            p.ProgramStarted();
            // Starts Dispatcher
            p.Run();
        }
        
        private void InitializeModules() {
            this.usbClientDP = new GTM.GHIElectronics.USBClientDP(1);
            this.currentSensor = new GTM.Seeed.CurrentSensor(9);
        }
    }
}

@ Verspeeks - I might be mistaken, but if you want a timer to fire the tick event you actually have to Start() the timer and not Stop() it …

3 Likes

@ PiWi - I changed the stop into start, but this didn’t solve the problem…
There is happening somethin strange I think: when the currentsensor is plugged into the spider, it only measures 0, but when it isn’t plugged in, it gives values…

Can anyone explain this phenomenon?

Did you switch to a shunt resistor or are you still using the coil device? It sounds more like an electrical problem or an input range/scaling problem, especially since you say you get values (noise) when it is unplugged and zero when it is plugged into your board. Can you read a value on your sensor with a Voltmeter or Oscilloscope? Can you get a reading off a small alternative voltage source, like a battery? Try to narrow down the problem by testing things in isolation.

1 Like

It’s for measuring AC only. It’s only a transformer with a burden resistor.

You need a different type to do that such as one with a hall effect sensor.

2 Likes