{"product_id":"acs712-5a-stroomsensor-meter","title":"ACS712 5A stroomsensor - meter","description":"\u003ch2 class=\"product-page\"\u003eACS712 5A stroomsensor - meter\u003c\/h2\u003e\r\n\u003cp\u003eSensor voor het meten van stroom tot 5A.\u003cbr\u003eVoor uitgebreide specificaties kunt u hier kijken \u003ca href=\"https:\/\/www.sparkfun.com\/datasheets\/BreakoutBoards\/0712.pdf\" target=\"_blank\" rel=\"noopener\"\u003eLINK\u003c\/a\u003e\u003cbr\u003e\u003cbr\u003eVoorbeeld zie hieronder;\u003cbr\u003e\u003cbr\u003e\u003c\/p\u003e\r\n\u003cpre\u003e\/*\r\nMeasuring AC Current Using ACS712\r\n*\/\r\nconst int sensorIn = A0;\r\nint mVperAmp = 185; \/\/ use 100 for 20A Module and 66 for 30A Module\r\n\r\n\r\ndouble Voltage = 0;\r\ndouble VRMS = 0;\r\ndouble AmpsRMS = 0;\r\n\r\n\r\n\r\nvoid setup(){ \r\n \u003cb\u003eSerial\u003c\/b\u003e.begin(9600);\r\n}\r\n\r\nvoid loop(){\r\n \r\n \r\n Voltage = getVPP();\r\n VRMS = (Voltage\/2.0) *0.707; \r\n AmpsRMS = (VRMS * 1000)\/mVperAmp;\r\n \u003cb\u003eSerial\u003c\/b\u003e.print(AmpsRMS);\r\n \u003cb\u003eSerial\u003c\/b\u003e.println(\" Amps RMS\");\r\n\r\n}\r\n\r\nfloat getVPP()\r\n{\r\n  float result;\r\n  \r\n  int readValue;             \/\/value read from the sensor\r\n  int maxValue = 0;          \/\/ store max value here\r\n  int minValue = 1024;          \/\/ store min value here\r\n  \r\n   uint32_t start_time = millis();\r\n   while((millis()-start_time) \u0026lt; 1000) \/\/sample for 1 Sec\r\n   {\r\n       readValue = analogRead(sensorIn);\r\n       \/\/ see if you have a new maxValue\r\n       if (readValue \u0026gt; maxValue) \r\n       {\r\n           \/*record the maximum sensor value*\/\r\n           maxValue = readValue;\r\n       }\r\n       if (readValue \u0026lt; minValue) \r\n       {\r\n           \/*record the maximum sensor value*\/\r\n           minValue = readValue;\r\n       }\r\n   }\r\n   \r\n   \/\/ Subtract min from max\r\n   result = ((maxValue - minValue) * 5.0)\/1024.0;\r\n      \r\n   return result;\r\n }\u003c\/pre\u003e","brand":"Ben's Electronics","offers":[{"title":"Default Title","offer_id":53974401319251,"sku":"EO42","price":3.5,"currency_code":"EUR","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/1077\/7241\/2243\/files\/file_e13a5cde-dca1-42c8-8dd1-14f6c699d4a8.jpg?v=1781131966","url":"https:\/\/checkout.benselectronics.nl\/products\/acs712-5a-stroomsensor-meter","provider":"Ben's Electronics","version":"1.0","type":"link"}