Microduino Hall sensor to measure DC motor RPM
Language: | English • 中文 |
---|
ObjectiveThis lesson will teach you use the hall sensor to measure the RPM(Revolution(s) Per Minute) of DC motor, and display the value on OLED. Equipment
Schematic
ProgramFunction description: attachInterrupt(0, rpm, RISING); //Bind the interrupt to pin 0 which corresponding to port D2 in microduino. When interrupt happened, invoke function rpm(), the trigger condition is that voltage changed from low to high. sei(); //Enable the interrupt cli(); //Disable the interrupt DebugStep 1: Copy the code to IDE and compile it. Step 2: Set up circuit, as follows: Note: Step 1: During setting up circuit, we will use Microduino-Cube-S1 board. This extension board was designed for OLED, only need plug in the Microduino-Core and Microduino-FT232R to slot and then connect the OLED to corresponding slot on Microduino-Cube-S1. Step 2: As far as possible close hall sensor to DB motor, and easy to detect magnetic field changes. Step 3: Run program. Step 4: Rotate the potentiometer, observe the value on OLED. ResultRotate the potentiometer, motor will rotate. Hall sensor will induct motor's magnetic field changes regularly, to determine the frequency in one second and calculate the RPM, and then displayed on the OLED. Videohttp://v.youku.com/v_show/id_XNjkyNzk0MTQw.html
|