In this Blogtut, we will be focusing on measuring the direction of current in Industrial pump armatures using magnet sensor (interface with ESP32) and can display the measurement in the Node-RED dashboard
Hardware RequiredArduino
Node-RED
About MMC2460MTThe modular breakout board using 4mbps I2C transmission between sensor and microcontrollers like Arduino, Raspberry Pi, ESP8266, ESP32, etc. measures the magnetic field in two axes (X axis and Y axis) which measure the magnetic field in gauss parameters. The sensor shares its importance especially in the application like electronic compassing, GPS navigation assist, magnetic field measurement.
ApplicationWell, as per mentioned above application we have tested this Sensor with a slightly different way by using the sensor with electric motor pumps. As the pump Consist of armature coil which the electromagnetic field. As some earlier EMF methods, we know about right-hand thumb rule and knowing about the current magnetic field directions. We were able to find out the magnetic directions which has the parameters unit in Gauss.
We can manipulate the parameters according to the requirement and can test the current direction according
Note: When Sensor is not near the Electric Pump Armatures then it will give you a constant garbage value which is not the point to worry.
I2C CodeMentioned below sample code will help you to test the magnetic effects which I have mentioned in application topic but there are more advanced ways to monitor the sensor data which will be useful respective to its applications and physics and formulas implemented accordingly.
- Initialize the Wire.h file called as I2C Library especially use in Arduino IDE
#include <Wire.h>
- Initialize the I2C registers of sensor module which is specified to work with 2 wire protocol.
#define Addr 0x30
- Begin the I2C transmission and Initialize the baud rate as per the requirements for serial communication.
Wire.begin(21,22);Serial.begin(115200);setup_wifi(); //We will be using simple Wifi.h library
- Request for 4 bytes of Data which we want to read from the sensor through I2C connection for reading X and Y axis Coefficients.
if(Wire.available() == 4) { data[0] = Wire.read(); data[1] = Wire.read(); data[2] = Wire.read(); data[3] = Wire.read(); delay(100); }
- If bytes are available then use the mentioned below formula will help to convert the data bytes and display desired values
int xMag = ((data[1] * 256) + data[0]);int yMag = ((data[3] * 256) + data[2]);
- Manipulate the magnetic field axial parameters (already showing the value in Gauss units)as per the requirement of Sensitivity and Resolution settings given in the datasheet
- Using Serial.print you will be able to read the sensor data in the serial monitor screen.
As Node-RED is a great platform to monitor your sensor data with the help of sensor dashboard but to work with this application it's better to start with setup tutorial which we have earlier mentioned in Blogtut.
With the help of earlier Blogtut, you will be able to monitor the sensor data through Serial protocol using Serial Node or using MQTT protocol which is very much famous in many IOT platforms nowadays. But to start with the basic setup we should go through Node-RED MQTT node which will surely help you out in understanding the mechanism of MQTT protocol.
Mentioned below is the output which you will be able to check out from debug node as well as through dashboard.
Comments