Use the Hall sensor to measure the speed
Introduction
Hall 3144 is a unipolar Hall switch circuit. When the N pole of a magnet approaches to its print surface, the switch outputs Low; when the N pole moves away, the switch outputs High. In this section, we will use the Hall sensor to measure the DC motor speed. DC motor is a device that converts electrical energy into mechanical one. It is usually used in fan, electronic toy, shaver, etc. considering it is easy to control.
Components
– 2 * Adeept Arduino UNO R3 Board
– 1 * Hall Sensor Module
– 1 * DC motor Module
– 1 * Magnet(N/S)
– 1 * 3D printing material
– 2 * USB Cable
– 1 * 3-Pin Wires
– 1 * 4-Pin Wires
Experimental Principle
The Fritzing image:
Pin definition:
The schematic diagram:
The Fritzing image:
Pin definition:
The schematic diagram:
Experimental Procedures
Step 1: Build the circuit
Step 2: Use the 3D printer to print the keypad to secure the platform
3D Module download link:3Dmodule
Step 3: Program HallSensorModule.ino
/***********************************************************
File name: HallSensorModule.ino
Description: Use the Hall sensor to measure the speed
you will see the data in the serial monitor
Website: www.adeept.com
E-mail: support@adeept.com
Author: Tom
Date: 2016/12/23
***********************************************************/
int hallsensorPin=2; //Set the digital 2 to hall sensor module interface
unsigned long duration; //Define the duration variable as an unsigned long integer variable
void setup()
{
Serial.begin(9600); //The serial baud rate is 9600
pinMode(hallsensorPin, INPUT); //Set the pin to input mode
}
void loop()
{
//Read the high pulse on the pin, the maximum
//pulse time interval of 60 seconds, and the results assigned to the duration variable
duration = pulseIn(hallsensorPin, HIGH,60000000);
Serial.print(60000000/duration); //The duration variable is output through the serial port
Serial.println(" r/min");
}
Step 4: Compile and download the sketch to the UNO R3 board.