• RoBot Man
  • C/C++
  • 20KB
  • rar
  • 0
  • 1 积分
  • 1
  • 2021-03-10 12:17
Source Electricmeter for aduino and ESP8266
  • Test
  • sketch_may24a
  • sketch_may24a.ino
  • lcdv1
  • lcdv1.ino
  • RTCTFT160
  • RTCTFT160_F.ino
  • RTCTFT160.ino
  • lcd
  • lcd.ino
  • lcd_v2
  • lcd_v2.ino
  • lcd_v3_test_blynk
  • lcd_v3_test_blynk.ino
  • adetest.txt
  • adetest.rar
#include <aDE9153A.h rel='nofollow' onclick='return false;'> #include <aDE9153AAPI.h rel='nofollow' onclick='return false;'> /* * Test Code for the ADE9153AAPI * * Designed specifically to work with the EV_ADE9153ASHIELDZ board and * ADE9153AAPI library * ---- http://www.analog.com/ADE9153A * * Created by David Lath for Analog Devices Inc., January 8, 2018 * * Copyright (c) 2018, Analog Devices, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted (subject to the limitations in the disclaimer * below) provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of Analog Devices, Inc. nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED * BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #define ARM_MATH_CM0PLUS #include <SPI.h> #include <aDE9153A.h rel='nofollow' onclick='return false;'> #include <aDE9153AAPI.h rel='nofollow' onclick='return false;'> // Variable for write Eeprom /* Basic initializations */ #define SPI_SPEED 1000000 //SPI Speed #define CS_PIN 8 //8-->Arduino Zero. 15-->ESP8266 #define ADE9153A_RESET_PIN 4 //On-board Reset Pin #define USER_INPUT 5 //On-board User Input Button Pin #define LED 6 //On-board LED pin ADE9153AClass ade9153A; struct EnergyRegs energyVals; //Energy register values are read and stored in EnergyRegs structure struct PowerRegs powerVals; //Metrology data can be accessed from these structures struct RMSRegs rmsVals; struct PQRegs pqVals; struct AcalRegs acalVals; struct Temperature tempVal; void readandwrite(void); void resetADE9153A(void); int ledState = LOW; int inputState = LOW; unsigned long lastReport = 0; const long reportInterval = 5000; const long blinkInterval = 500; void setup() { /* Pin and serial monitor setup */ pinMode(LED, OUTPUT); pinMode(USER_INPUT, INPUT); pinMode(ADE9153A_RESET_PIN, OUTPUT); digitalWrite(ADE9153A_RESET_PIN, HIGH); Serial.begin(115200); //Reset ADE9153A for clean startup delay(500); /*SPI initialization and test*/ bool commscheck = ade9153A.SPI_Init(SPI_SPEED,CS_PIN); //Initialize SPI if (!commscheck) { Serial.println("ADE9153A Shield not detected. Plug in Shield and reset the Arduino"); while (!commscheck) { //Hold until arduino is reset delay(1000); } } ade9153A.SetupADE9153A(); //Setup ADE9153A according to ADE9153AAPI.h /* Read and Print Specific Register using ADE9153A SPI Library */ Serial.println(String(ade9153A.SPI_Read_32(REG_VERSION_PRODUCT), HEX)); // Version of IC ade9153A.SPI_Write_32(REG_AIGAIN, -268435456); //AIGAIN to -1 to account for IAP-IAN swap delay(500); } void loop() { /* Main loop */ /* Returns metrology to the serial monitor and waits for USER_INPUT button press to run autocal */ unsigned long currentReport = millis(); if ((currentReport - lastReport) >= reportInterval){ lastReport = currentReport; // 06/12 readandwrite(); } inputState = digitalRead(USER_INPUT); if (inputState == LOW) { Serial.println("Autocalibrating Current Channel"); ade9153A.StartAcal_AINormal(); runLength(20); ade9153A.StopAcal(); Serial.println("Autocalibrating Voltage Channel"); ade9153A.StartAcal_AV(); runLength(40); ade9153A.StopAcal(); delay(100); ade9153A.ReadAcalRegs(&acalVals); Serial.print("AICC: "); Serial.println(acalVals.AICC); Serial.print("AICERT: "); Serial.println(acalVals.AcalAICERTReg); Serial.print("AVCC: "); Serial.println(acalVals.AVCC); Serial.print("AVCERT: "); Serial.println(acalVals.AcalAVCERTReg); long Igain = (-(acalVals.AICC / 838.190) - 1) * 134217728; long Vgain = ((acalVals.AVCC / 13411.05) - 1) * 134217728; ade9153A.SPI_Write_32(REG_AIGAIN, Igain); ade9153A.SPI_Write_32(REG_AVGAIN, Vgain); Serial.println("Autocalibration Complete"); delay(2000); } } void readandwrite() { /* Read and Print WATT Register using ADE9153A Read Library */ ade9153A.ReadEnergyRegs(&energyVals); ade9153A.ReadPowerRegs(&powerVals); //Template to read Power registers from ADE9000 and store data in Arduino MCU ade9153A.ReadRMSRegs(&rmsVals); ade9153A.ReadPQRegs(&pqVals); ade9153A.ReadTemperature(&tempVal); Serial.print("RMS Current:\t"); Serial.print(rmsVals.CurrentRMSValue/1000); Serial.println(" A"); Serial.print("RMS Voltage:\t"); Serial.print(rmsVals.VoltageRMSValue/1000); Serial.println(" V"); Serial.print("Active Power:\t"); Serial.print(powerVals.ActivePowerValue/1000); Serial.println(" W"); Serial.print("Active Energy:\t"); Serial.print(energyVals.ActiveEnergyValue); Serial.println(" mWhr"); Serial.println((energyVals.ActiveEnergyReg/1000)*0.858307); Serial.println(energyVals.FundReactiveEnergyValue/1000); Serial.print("Reactive Power:\t"); Serial.print(powerVals.FundReactivePowerValue/1000); Serial.println(" VAR"); Serial.print("Apparent Power:\t"); Serial.print(powerVals.ApparentPowerValue/1000); Serial.println(" VA"); Serial.print("Power Factor:\t"); Serial.println(pqVals.PowerFactorValue); Serial.print("Frequency:\t"); Serial.print(pqVals.FrequencyValue); Serial.println(" Hz"); Serial.print("Temperature:\t"); Serial.print(tempVal.TemperatureVal); Serial.println(" degC"); Serial.println(""); Serial.println(""); } // reset void runLength(long seconds) { unsigned long startTime = millis(); while (millis() - startTime < (seconds*1000)){ digitalWrite(LED, HIGH); delay(blinkInterval); digitalWrite(LED, LOW); delay(blinkInterval); } }
    • iot garage.rar
      its about the documetation of embedded system project garbage collection system
    • OPC UA C协议栈
      OPC UA官网提供的开源协议栈,ANSI C语言实现,会员资格才能下载的吧,IIOT、工业4.0行业开发人员必备。协议栈版本:1.03.341 内含一些小的测试samples
    • aws-iot-device-sdk-embedded-C-master.zip
      亚马逊物联网设备端c sdk
    • awesome-iot-master
      Halim Qarroum Github上的资源,云栖社区有中文翻译版:A curated list of awesome internet of Things projects and resource. 该文档涉及IOT终端软硬件、系统、平台以及相关标准,很有参考价值
    • aws-iot-device-sdk-embedded-C:SDK,用于使用嵌入式C从设备连接到AWS IoT
      适用于嵌入式C的AWS IoT设备SDK 目录 总览 适用于嵌入式C的AWS IoT设备SDK(C-SDK)是下的C源文件的集合,可用于嵌入式应用程序中以将IoT设备安全地连接到 。 它包含MQTT客户端,HTTP客户端,JSON解析器,AWS IoT...
    • Cypress-针对可穿戴设备的PSoC IoT平台-综合文档
      Cypress-针对可穿戴设备的PSoC IoT平台
    • iot-device-sdk-embedded-c:用于连接到IoT核心版的Cloud IoT Device SDK
      适用于嵌入式C的Google Cloud IoT设备SDK 适用于嵌入式C的Google Cloud IoT设备SDK是易于移植的开源C库,可将低端IoT设备连接到... git clone https://github.com/GoogleCloudPlatform/iot-device-sdk-embedded-c.git
    • embedded_iot:我的嵌入式系统和IoT课程资料库
      Embedded_iot Varodom Toochinda博士Kasetsart University机械工程系 在这里,IUP学生可以在这里找到我的嵌入式系统和IoT课程的材料 01205479电气工程物联网 01211421工业控制嵌入式系统 课程资料 讲座0:课程介绍...
    • Workshop_IOT
      Workshop_IOT 越来越多的东西-汽车,门铃,烟雾探测器,冰箱,随便你说-通过“嵌入式系统”连接到互联网。 我们称其为物联网(IoT)。 这些系统如何工作?创建成熟的物联网设备的基本要素是什么? 在本研讨会中,...
    • Keil.STM32F1xx_DFP.2.3.0.zip