Différences
Ci-dessous, les différences entre deux révisions de la page.
| materiels:capteurs:intensite:intensite [2024/06/24 09:36] – [2.2 ±5A - (ACS70331)] phil | materiels:capteurs:intensite:intensite [2025/06/19 19:30] (Version actuelle) – modification externe 127.0.0.1 | ||
|---|---|---|---|
| Ligne 3: | Ligne 3: | ||
| ===== Capteurs - Intensité du courant ===== | ===== Capteurs - Intensité du courant ===== | ||
| - | [Mise à jour le 24/6/2024] | + | [Mise à jour le 25/6/2024] |
| \\ | \\ | ||
| Ligne 16: | Ligne 16: | ||
| ==== 2. Capteurs analogiques ==== | ==== 2. Capteurs analogiques ==== | ||
| - | {{ : | + | {{ : |
| === 2.1 ±5A - (ACS714) === | === 2.1 ±5A - (ACS714) === | ||
| == 2.1.1 Présentation == | == 2.1.1 Présentation == | ||
| Ligne 28: | Ligne 28: | ||
| * Consommation: | * Consommation: | ||
| * Plage de mesure: -5 A à +5 A en AC ou DC | * Plage de mesure: -5 A à +5 A en AC ou DC | ||
| - | * Sensibilité: | + | * Sensibilité: |
| * précision: **+/-1,5%** | * précision: **+/-1,5%** | ||
| * Shunt: 1,2 mΩ | * Shunt: 1,2 mΩ | ||
| Ligne 34: | Ligne 34: | ||
| * T° de service: -40 à +85 °C | * T° de service: -40 à +85 °C | ||
| * Dimensions: 28 x 21 x 13 mm | * Dimensions: 28 x 21 x 13 mm | ||
| + | |||
| + | * // | ||
| + | {{ : | ||
| {{ : | {{ : | ||
| Ligne 56: | Ligne 59: | ||
| <pane id=" | <pane id=" | ||
| + | * // | ||
| + | * //**Fiche guide**// pour l' | ||
| + | |||
| * //Connexion à un shield// < | * //Connexion à un shield// < | ||
| - | * // Exemple pour tester le capteur// | + | * // Exemple pour tester le capteur |
| {{ : | {{ : | ||
| - | <code cpp acs714.cpp> | + | <code cpp acs714_V1.cpp> |
| - | /*############################################################################## | + | /* |
| - | Author: | + | ACS714 sur Arduino Uno |
| - | * Mirko Prosseda (06-2013) | + | */ |
| - | * email: mirko.prosseda@gmail.com | + | |
| - | + | ||
| - | | + | |
| - | * 5A Linear Current Sensor test sketch v1.0 | + | |
| - | * Read current value from the sensor and print its value on the Serial Monitor | + | |
| - | + | ||
| - | | + | |
| - | * BOARD -> ARDUINO | + | |
| - | * Vcc -> 5V | + | |
| - | * GND -> GND | + | |
| - | * OUT -> PIN A0 | + | |
| - | ############################################################################## | + | |
| - | // Define constants and variables | + | #define RefVal 5.0 |
| - | const int analogInPin | + | #define Pin A0 |
| - | int sensorValue = 0; // value read from the sensor | + | |
| - | float outputValue | + | // Take the average of 500 times |
| + | const int averageValue | ||
| + | long int sensorValue = 0; | ||
| + | float sensitivity | ||
| + | |||
| + | // Output voltage with no current: 2500mV | ||
| + | float Vref = 2500; | ||
| - | // Initialization | ||
| void setup() { | void setup() { | ||
| - | Serial.begin(9600); | + | Serial.begin(9600); |
| } | } | ||
| - | // main loop | ||
| void loop() { | void loop() { | ||
| - | | + | // Read the value 500 times: |
| - | | + | |
| + | sensorValue += analogRead(Pin); | ||
| - | Serial.print(" | + | |
| - | | + | delay(2); |
| - | | + | |
| + | sensorValue = sensorValue / averageValue; | ||
| - | delay(200); | + | |
| + | // Different power supply will lead to different reference sources | ||
| + | // example: 2^10 = 1024 -> 5V / 1024 ~= 4.88mV | ||
| + | // unitValue= 5.0 / 1024.0*1000 ; | ||
| + | float unitValue = RefVal / 1024.0 * 1000; | ||
| + | float voltage = unitValue * sensorValue; | ||
| + | |||
| + | // When no load, | ||
| + | Serial.print(" | ||
| + | Serial.print(voltage); | ||
| + | Serial.println(" | ||
| + | |||
| + | // Calculate the corresponding current | ||
| + | float current = (voltage - Vref) * sensitivity; | ||
| + | |||
| + | // Print display current (mA) | ||
| + | Serial.print(current); | ||
| + | Serial.println(" | ||
| + | |||
| + | Serial.print(" | ||
| + | |||
| + | // Reset the sensorValue for the next reading | ||
| + | sensorValue = 0; | ||
| + | // Read it once per second | ||
| + | | ||
| } | } | ||
| + | </ | ||
| + | |||
| + | * //Exemple à compléter (étude dans la fiche guide)// | ||
| + | |||
| + | <code cpp acs714_V2.cpp> | ||
| + | / | ||
| + | | ||
| + | * Vcc -> 5V # Alimentation du module | ||
| + | * GND -> GND | ||
| + | * OUT -> PIN A0 # Signal de sortie du cateur (tension) | ||
| + | ############################################################################## | ||
| + | |||
| + | // Constantes et variables | ||
| + | const int Ucapteur = A0; // Sortie du capteur : tension (image de l' | ||
| + | int N = 0; // Valeur délivrée par le CA/N | ||
| + | float Intensite = 0; // Valeur de l' | ||
| + | |||
| + | void setup() { | ||
| + | Serial.begin(9600); | ||
| + | } | ||
| + | |||
| + | void loop() { | ||
| + | N = analogRead(Ucapteur); | ||
| + | Intensite = ((float)(N - a) * b) / c; // Calculer a,b et c pour un ACS714 à partir de l' | ||
| + | |||
| + | Serial.print(" | ||
| + | Serial.print(Intensite); | ||
| + | Serial.println(" | ||
| + | |||
| + | delay(2000); | ||
| + | } | ||
| </ | </ | ||
| </ | </ | ||
| <pane id=" | <pane id=" | ||
| - | A venir | + | < |
| </ | </ | ||
| Ligne 173: | Ligne 228: | ||
| <pane id=" | <pane id=" | ||
| - | * // | + | * // |
| - | * // | + | * // |
| * // | * // | ||
| Ligne 215: | Ligne 270: | ||
| {{ : | {{ : | ||
| - | == 2.3.2 Exemples de code == | + | == 2.3.2 Exemples de code (A compléter) |
| < | < | ||
| * [[# | * [[# | ||
| Ligne 226: | Ligne 281: | ||
| / | / | ||
| | | ||
| - | * Mirko Prosseda (06-2014) | + | * Mirko Prosseda (06-2013) |
| * email: mirko.prosseda@gmail.com | * email: mirko.prosseda@gmail.com | ||
| | | ||
| - | | + | |
| * Read current value from the sensor and print its value on the Serial Monitor | * Read current value from the sensor and print its value on the Serial Monitor | ||
| | | ||
| * BOARD -> ARDUINO | * BOARD -> ARDUINO | ||
| - | * Vcc | + | * Vcc |
| * GND -> GND | * GND -> GND | ||
| * OUT -> PIN A0 | * OUT -> PIN A0 | ||
| Ligne 253: | Ligne 308: | ||
| void loop() { | void loop() { | ||
| sensorValue = analogRead(analogInPin); | sensorValue = analogRead(analogInPin); | ||
| - | outputValue = ((float)(sensorValue - 512) * 5 / 0.110) / 1024; // A vérifier | + | outputValue = ((float)(sensorValue - 338) * 5 / 0.11) / 1024; // A vérifier |
| Serial.print(" | Serial.print(" | ||