Jump to content
I2Cdevlib Forums

Search the Community

Showing results for tags 'chipkit'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • I2Cdevlib Web Tools
    • I2C Protocol Analyzer
    • I2C Device Entry Interface
    • I2C Device Library API
  • I2Cdev Platform Discussion
    • Arduino (ATmega)
    • Arduino Due (ARM Cortex M3)
    • MSP430
    • Other Platforms
  • I2C Device Discussion
    • AD7746 capacitance-to-digital converter (Analog Devices)
    • ADS1115 16-bit A/D converter (Texas Instruments)
    • ADXL345 3-axis accelerometer (Analog Devices)
    • AK8975 3-axis magnetometer (AKM Semiconductor)
    • BMA150 3-axis accelerometer (Bosch Sensortec)
    • BMP085 pressure sensor (Bosch Sensortec)
    • DS1307 real-time clock (Maxim)
    • HMC5843 3-axis magnetometer (Honeywell)
    • HMC5883L 3-axis magnetometer (Honeywell)
    • iAQ-2000 indoor air quality sensor (AppliedSensor)
    • IQS156 ProxSense capacitive touch sensor (Azoteq)
    • ITG-3200 3-axis gyroscope (InvenSense)
    • L3G4200D 3-axis accelerometer (STMicroelectronics)
    • MPL3115A2 Xtrinsic Smart Pressure Sensor (Freescale)
    • MPR121 12-bit capacitive touch sensor (Freescale)
    • MPU-6050 6-axis accelerometer/gyroscope (InvenSense)
    • MPU-9150 9-axis accelerometer/gyroscope/magnetometer (InvenSense)
    • PanelPilot multi-screen digital meter (Lascar Electronics)
    • SSD1308 128x64 OLED/PLED driver (Solomon Systech)
    • TCA6424A 24-bit I/O expander (Texas Instruments)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 1 result

  1. Hello, Basically what I am doing is I have the ADS1115 in single channel mode, measuring the voltage across a resistor, which indicates the current flowing through the resistor. The current comes from an AC Current Clamp which sits on my mains power board. Basically what I am trying to do is measure the current flowing, using information I have found on the openenergymonitor.org site. They have a library which basically offsets the AC wave into the positive space, then filters out the wave in code and samples the wave to get an average, which then gives you the current flowing in the AC line. They have used the standard 10 bit ADC on the Arduino, but I wanted to use the 16bit ADS1115 instead. I have set the Gain to be 4.096, and have tried 860samples/second in continuous mode, but I am seeing very weird results sometimes. Its like Channel 0 is merging into Channel, and 2 into 3, or some other random combination, and I cannot fully understand what is going on. I found a similar problem described on the Adafruit website http://forums.adafruit.com/viewtopic.php?f=19&t=54496 This is however using their own library, but one guy mentions yours and said it has a similar problem. He describes a fix, but I cannot find where to apply that. I am also using a Chipkit board, so its running at 80Mhz compared to the 16Mhz of the Arduino. I was wanting to know if you could tell me if there is any reason why doing sampleI = adc.getConversionP1GND(); quite fast, would cause problems. I was under the impression that you could call this as often as you liked, and it would just report the current figure that the ADS1115 had measured at the time, since its in continuous mode. Is that right? Here are the 2 main functions I have in my code, which is mainly copied out of the example from the openenergymonitor.org website double calcIrms(int NUMBER_OF_SAMPLES, int Channel) { double ADC_COUNTS = 24512; //portion of 15bit count used for range double SUPPLYVOLTAGE = 3064; //3.064V is the full scale I can output into sensor from clamp double ICAL = 100; //current constant = (100 / 0.050) / 20 = 100 for (int n = 0; n < NUMBER_OF_SAMPLES; n++) { lastSampleI = sampleI; if(Channel == 1) { sampleI = adc.getConversionP1GND(); } else if(Channel == 3) { sampleI = adc.getConversionP3GND();; } else { return 0; } lastFilteredI = filteredI; filteredI = 0.996 * (lastFilteredI + sampleI - lastSampleI); // Root-mean-square method current // 1) square current values sqI = filteredI * filteredI; // 2) sum sumI += sqI; } double I_RATIO = ICAL * ((SUPPLYVOLTAGE / 1000.0) / (ADC_COUNTS)); double Irms = I_RATIO * sqrt(sumI / NUMBER_OF_SAMPLES); //Reset accumulators sumI = 0; return Irms; } void loop() { Irms1 = calcIrms(100, 1); // Calculate Irms only Irms3 = calcIrms(100, 3); // Calculate Irms only apparentPower1 = supplyVoltage * Irms1; //extract Apparent Power into variable apparentPower3 = supplyVoltage * Irms3; //extract Apparent Power into variable } I am displaying this to a TFT LCD and sometimes the figures just drop to 0 and stay there, and now and then the numbers blink to show something, and then go away again. Any help you could provide would be appreciative, esp if you see that I am doing something stupid. Regards WanaGo
×
×
  • Create New...