Table of Contents
More details on PWM can be found in Activity 1b and Activity 4. We will likewise employ the Arduino board for sensing the position/speed of the motor. There are different methods for achieving this with among the most popular being the optical encoder. An optical encoder includes an emitter (a light source, like an LED) and a detector (a phototransistor).
When the phototransistor finds the light its output goes high, and when it does not discover light its output goes low. By counting these pulses, the sensing unit suggests the displacement of the product between the emitter and detector. Furthermore, by timing the frequency of these pulses, the sensing unit can be utilized to suggest speed.
In the following rotary example, when the disk is rotating counterclockwise the disk will encounter Set A first and Set B 2nd, thereby causing channel A to go low before channel B goes low. בקרי מהירות למנועים. When the disk is rotating clockwise, then channel B will go low initially. This type of configuration is typical of what is referred to as quadrature.
A Hall-effect sensor is able to discover an electromagnetic field. By detecting the passing of gear teeth or a magnet, the Hall-effect sensing unit can generate a pulse-train output comparable to that produced by an optical encoder. In addition, employing offset Hall-effect sensors can produce a quadrature output for determining the direction of movement.
This specific motor can be driven by a 6-V lantern type battery. The encoder provides 48 counts per transformation (if you count both fluctuating edges). The motor likewise includes a transmission so that the Hall-effect sensor creates 1633 counts per transformation at the output shaft of the gearbox.
Various accessories for the motor (brackets, wheels, etc.) can be found from the exact same website. The setup of the motor with encoder and its connection to the Arduino board is revealed below. The color band on the diode suggests its cathode. The Gate, Source, and Drain pins of the MOSFET can be deduced from its orientation in the provided figure.
The Pulse Generator block toggles in between 0 and 1 and is linked to the Digital Write Block to switch the transistor between its OFF state and its ON state, respectively. Double-clicking the Pulse Generator block we set the Sample time equivalent to "0. 02". In the downloadable model, the sample time is set to the variable Ts which needs to be defined in the MATLAB workspace by typing Ts = 0.
We will also specify the Pulse type to be Sample based with a Duration of "28/Ts" samples (28 seconds) and a Pulse width of "26/Ts" samples (26 seconds) and a Phase hold-up of "2/Ts" samples (2 seconds). As the gate of the MOSFET is triggered from Digital Output 5, the Digital Write block requirements to be set to the matching pin.
We will leave the Sample time as "-1" to inherit the worth from the Pulse Generator block. The Encoder Read block is used for reading the quadrature encoder signal. The encoder pulses are counted through the program operating on the Arduino board. The Encoder Read block polls the board every sample duration to get the most recent variety of counts that have been collected.
We will also set Pin A to "2" and Pin B to "3". These represent the pins to which we linked the quadrature encoder signals. For the Arduino Uno, this is the only choice. For the Mega, for example, we could likewise use pins 18 and 19, or pins 20 and 21.
Examination of the figure reveals that motor is at first at rest (variety of counts aren't changing), then after 2 seconds the motor is turned on (the transistor is turned on) and the variety of encoder counts increments as the motor spins. If the motor was spinning in the opposite direction, the encoder counts would decrement.
e. it utilizes 16-bits, 15 bits for the number and 1 bit for the sign). Considering that we ultimately wish to estimate the motor's speed based on these counts, we somehow need to address this rollover. Specifically, we will construct the subsystem "Rollover" displayed in the design below. This subsystem compares the current number of counts to the number of counts from the previous sample in order to figure out whether a rollover has actually occurred (at 32767 or at -32768) and then modifies the collected number of counts to get rid of the rollover.
Table of Contents
Click here About Magnetic Bar