Difference between revisions of "Lesson 43--Microduino Rotary encoder"

From Microduino Wiki
Jump to: navigation, search
(Created page with "{{Language | 第四十三课--Microduino 旋转编码器使用}} {| style="width: 800px;" |- | ==Objective== This experiment will through Microduino to decode the rotary encod...")
 
 
Line 29: Line 29:
  
 
==Program==
 
==Program==
Download test program:
+
Download test program:
 
https://github.com/Microduino/Microduino_Tutorials/tree/master/Microduino_Advanced/Microduino_rotary_encoder
 
https://github.com/Microduino/Microduino_Tutorials/tree/master/Microduino_Advanced/Microduino_rotary_encoder
  
 
==Debug==
 
==Debug==
*Step 1:
+
*Step 1:
 
Set up the circuit follow the schematic
 
Set up the circuit follow the schematic
 
[[File:rotary_encoder_Wiring-1.jpg|600px|center|thumb]]
 
[[File:rotary_encoder_Wiring-1.jpg|600px|center|thumb]]
  
*Step 2:Download test program
+
*Step 2: Download test program
  
*Step 3:Open the test program, select the board and compile the program, then downlaod it.
+
*Step 3: Open the test program, select the board and compile the program, then download it.
  
 
*Configure the serial baud rate and open the serial monitor
 
*Configure the serial baud rate and open the serial monitor
Line 53: Line 53:
  
 
==Result==
 
==Result==
According to the serial port monitor returned data to judge the state of rotary encoder. The playsers can make other application based on this experiment.
+
According to the serial port monitor returned data to judge the state of rotary encoder. The players can make other application based on this experiment.
  
 
==Video==
 
==Video==
  
 
|}
 
|}

Latest revision as of 08:59, 12 September 2016

Language: English  • 中文

Objective

This experiment will through Microduino to decode the rotary encoder, judge the movement direction and whether it was pressed.

Equipment

Rotary encoder

Rotary encoder

Rotary encoder.jpg

This kind of rotary encoder has turn left, turn right and press three functions. The function of the press just like we use the button. Rotate the encoder, it caan produce the pulse signal that has a different phase, which can be used to distinguish the opposite direction.

Rotary encoder Signal.jpg

If the output 1 as the high electricity level, and a high level in output 2 too, then switch rotated as clockwise, otherwise output 2 is a low level, it must be counterclockwise.

Pin Diagram

Rotary encoder pin.jpg

Schematic

Rotary encoder Wiring.jpg

Program

Download test program: https://github.com/Microduino/Microduino_Tutorials/tree/master/Microduino_Advanced/Microduino_rotary_encoder

Debug

  • Step 1:

Set up the circuit follow the schematic

Rotary encoder Wiring-1.jpg
  • Step 2: Download test program
  • Step 3: Open the test program, select the board and compile the program, then download it.
  • Configure the serial baud rate and open the serial monitor
  • Rotate and press the button, observe the date
    • Clockwise rotation
Rotary encoder Clockwise.jpg
    • Counterclockwise rotation
Rotary encoder Counterclockwise.jpg
    • Press the button
Rotary encoder button.jpg

Result

According to the serial port monitor returned data to judge the state of rotary encoder. The players can make other application based on this experiment.

Video