loading

diy rotary encoder

by:Sinowon     2020-03-15
Sorry for not having pictures, I didn\'t decide to do a tutorial on this until I was almost finished.
Overview: The rotary encoder uses two or more sensors to detect the position, direction of rotation, speed, and number of turns of the device.
This special use Hall sensors and magnets.
Waterproof by wrapping the sensor or in another way, this special type can be easily waterproof.
Some of the vehicles used some flavor Hall rotary encoders for the wheel speed sensor and the crankshaft position sensor for the engine, and also for some anemometers.
There are three main types of rotary encoder: 1.
Use a conductive track and brush 2.
Optical, using light and Sensor 3.
Magnetic, using some kind of magnetic sensor and magnetic material such as Hall sensor and magnet.
The actual rotating part can also be magnetized.
The linear encoder is made in a very similar way to the rotary encoder.
I tested the encoder I made with python code on Raspberry pi at speeds up to 1500 RPM.
The link to the code and schematic will be at the end.
The manufacturer specification on the drill I used to test said that the maximum speed is 1500 RPM, the speed I got from the encoder is 1487 RPM, both forward and backward are 1485 RPM.
This may be due to the fact that the battery is not fully charged, or it may be an inherent bad time for Raspberry pi.
Arduino will work better, but I don\'t like the 12 v on the analog pin, haha, oops.
Materials/tools: 1.
Spinning things (
Chuck I use electric drill)2.
Two or More Hall sensors (
Depending on the resolution you want)3. Four magnets (
Depending on the resolution you want)4. Glue 5. Wire (
I used some connectors for my bad servo system)6. Solder 7.
Soldering Iron 8.
Heat Shrink tube for your taste 9, electrical tape or other wire insulation material.
Marking devices, such as marking or scriberStep 1: Mark the equal points around the outside of the rotating part and glue the magnet to these points in the appropriate direction.
It helps to mark the polarity of the magnet.
In my case, every 90 degrees (
0 degrees, 90 degrees, 180 degrees, 270 degrees)
For the resolution of 4/rotation, this is enough for my app, but depending on the resolution you shot, it may vary.
A good way to find out the spacing is :(
360 degrees/number of magnets)
If you go by degrees, or (
Circumference/quantity of magnet)
If you were measured
In my case, the separation of the handle is well spaced for my application, so I don\'t have to measure anything.
Weld the wire to the sensor for insulation and heat shrinkage.
Be careful not to make the sensor too hot, be sure to test it and see if it still works after you\'re done.
The test is easy, just turn on the power and connect the LED to the data cable.
If the LED is opened next to the properly oriented magnet, it is closed when it is pulled (non-latching type)
, Or another pole that applies a magnet (latching type)
Then you can go.
The particular sensor I use is
Lock and connect to the ground (-)when activated.
Mark where the sensor should go.
For this special arrangement, this is at 1/16 times the circumference (0, 1/16th).
The reason for this is that one sensor has to trigger before the other, but to some extent the controller can distinguish between the timing difference between forward and backward.
I tried it initially at 1/8th mar k, but I don\'t know which direction it will go because the time difference is the same.
Before you position properly, it helps to fix the sensor tape down for the time being and then mark it.
You can do 1/8 division and you don\'t have direction sensing, but your resolution will double.
One thing that can be done is to use the second group of two sensors, offset 5/16 division spacing on the other side on the 7/16 th and 1/8 th other sensors can get the resolution of 16 pulses/loops, but I don\'t need such a good determination.
There is a timed demo in the video.
Stick the sensor at the Mark and paste it in place until the glue is cured.
Make sure there is a gap between the magnet and the sensor so that they are not hit and make sure that the sensor is aligned with the magnet in the right direction.
You do it when the glue is dry.
To get a schematic of the Raspberry pi and python code to measure the RPM, direction of rotation, and number of turns in the RPM, go here or here to get the PDF.
The reason I charge for the code is that it took about 4 days to get everything to work, while the rest of the project, including all the documentation, took only about 7 hours (
5 of them are documents)
Also, the $1 is not much, it helps to support larger, more complex projects, in fact, this is the only one I haven\'t charged for yet, and of course, it was released at that time.
Custom message
Chat Online 编辑模式下无法使用
Leave Your Message inputting...