[adrotate banner=”7″]

, They are very useful electrical components whose rotation and direction can easily be determined., Which makes them perfect to select and change variables., And even though they do their intended job without a problem. Their incremental movement is not a lot of fun to play around with. And I’m. Only saying this because I recently took apart an old, hard drive. And did not only I found quite powerful, neodymium magnets, but also the motor of the hard drive. After removing its platters I’ve freed it from its enclosure and realized that spinning it has a much more Satisfying feel to it than using an incremental rotary encoder.. So in this HACKED episode we will find out how hard drive motors work and in which way it is possible to use them as rotary encoders. Let’s get started. This video is sponsored by JLCPCB., A manufacturer of quick, PCB prototypes for 10 years., Upload your Gerber files to get high quality PCBs for ridiculously low prices and make your projects look more professional.. If we take a close look at the motor, then we can see that it features four breakout points at the back of it. By measuring the resistance between all of them. I noticed that there is a resistance of 6.4 between three points, while there’s a low resistance of 3.3 between each of the three points and the fourth point.. This led me to believe that the motor features a Y connection with the fourth breakout point being the star.

Point. But of course, there also exists other HDD motor types with only three breakout points.. If we would want to create a star point for them, we would have to add a high impedance resistor to each face and use the binding point as a virtual star point., But for now let’s get back to the four wire motor type.. Luckily I had a couple of those laying around, so it was no problem to sacrifice one and break it open with a bit of force. On the inside. We can see that the rotor consists of a permanent magnet with alternating polarities., While the stator consists of copper wire, wrapped around stator sheets, in order to form coils.. This structure is almost identical to that of a BLDC motor.. So to confirm my assumption, I hooked up an ESC to the three phases of the motor, not including the star point and powered it all up.. As you can see, by increasing the on time of the input signal of the ESC, the motor does start to rotate., Which proves that we are in fact dealing with a brushless DC motor.. If you want more information about how a BLDC motor works and how you can make your own driver, for it then make sure to watch my previous project about the subject.. But the main question still remains: How can we determine if it rotates clockwise or anti clockwise To find a possible solution? Let’S crack open an incremental rotary encoder to understand how it works.

On the inside. We can see a circular metal disc. That features a pattern with conductive silver points and black non conductive points., And on the other side we got a few sliding contacts that are in one way or another connected to the VCC ground, DT and CLK pin of the encoder. While it is quite difficult to understand its functional principle through the real life example, the idea is quite easy to grasp with a drawing.. Now, when five volts is connected to the encoder, its metal disk is connected to this voltage potential as well, which means once we rotate the circle for one increment clockwise. The DT pin gets connected to five volts before the CLK pin does. And if we would rotate anti clockwise, the order would be the other way around., Which means we can detect the rotation and direction of the encoder by checking which pin got connected to 5 volts First., A similar principle can be used when it comes to a BLDC motor., As we discovered earlier. Its rotor consists of alternating polarized magnets that, when rotated move alongside the coils of the motor., That means a voltage is induced into them., Which we can observe if we connect each phase to one input of my oscilloscope and the reference voltage potential to the star point.. As you can see, by rotating the motor in either direction, a three phase voltage is created whose amplitude and frequency is proportional to the rotation speed.

. If we have a closer look at the voltages during the clockwise rotation, we can see that the sequence is L1. L2. L3, while the sequence for the anti clockwise rotation is L1 L3 L2.. The reason for that is the coil arrangement itself., Which enables us to determine the rotation and direction by checking in which order the voltages appear.. To do that, I connected L1, L2 and L3 to analog inputs, 0, 1 and 2 respectively. And the star point of the BLDC motor to ground of an Arduino Nano.. For starters, I speeded up the ADC of the Arduino and set the analog reference voltage to the internal 1.1 V. Since the induced voltages of the motor never reached above this value., Then I wrote a simple piece of code which checks if the L1 voltage is in use and if so also checks continuously alternating, whether L2 or L3, is the next induced voltage.. Based on that, the serial monitor, then outputs, clockwise or anti clockwise., And after uploading, the codes opening the serial, monitor and spinning the motor in both directions. It seems like everything, worked just fine. But of course, if you would add an LCD to the system and change a variable on it, according to the motor’s rotation and direction, it would look a lot more impressive.. Now, at this point we could end this mini project and call it a day.. But what still bothered me was that we must utilize the analog to digital converter repeatedly.

. It would make more sense to use an external interrupt, like I did with the traditional rotary encoder. That is why I removed the motor wires from the Arduino and instead connected them to two MCP602 rail to rail, op amps. According to this simple schematic., Those op amps. Basically, act as comparators with a small hysteresis., Which means once the voltage of the faces is higher than the star voltage. The output of the comparator will be pulled to 5 V. While, when the face voltage is lower than the star voltage, the output will be connected to ground.. This creates a three phase voltage as well, but this time with three square voltages.. This way, I can connect the comparator output of L1 to an interrupt pin. While I connect the comparator outputs of L2 and L3 year to ordinary digital pins., Now by activating the interrupts, which only set a flag and including the digital read functions to see which face got a voltage induced afterwards, the code became much more flexible and responsive to The rotation, the motor., The last thing to do for me – was to reattach the platters and have some fun with this quite satisfying rotary encoder.. I hope you enjoyed watching this video and maybe even learned something new along the way.. If so, don’t forget to like share and subscribe.


[adrotate banner=”1″]

arduino rotary encoder Video

[mam_video id=tjCJ3MlFt7g]



[adrotate banner=”2″]


[mam_tag id=1430]



[adrotate banner=”3″]


arduino rotary encoder news






[adrotate banner=”4″]



arduino rotary encoder Social



[adrotate banner=”5″]




See the world through the eyes of this camera-equipped, snake-like robot.

This 3D-printed prosthesis uses computer vision to adjust its grip depending on the object.

Tue Aug 06 07:13:08 +0000 2019

Ks0013 keyestudio Rotary Encoder Module for Arduino
The rotary encoder can count the pulse outputting times during the process of rotation in positive and reverse direction by rotating.
wiki: https://t.co/VrhXakH1a3 https://t.co/sjXSNgSFtX


3D printing at home

DIY Macro Rail


[adrotate banner=”6″]