Using BLDC Hall Sensors as Position Encoders – Part 2

Using a Digilent Analog Discovery 2 analyzer to visualize BLDC Hall sensor output

The following information is intended to assist in interpreting Hall sensor logical output for the purposes of determining position, direction and speed. Although the output can be used for motor commutation, that aspect of BLDC motor operation is not explained here.

Overview

Visualizing the output of the Hall effect sensors aids in understanding and processing signals during the development and programming of a project. Acquiring the data may require a power supply, logic analyzer, oscilloscope, and a few indicators and switches. As an alternative to higher cost equipment, computer-based systems are often a suitable substitute.

Digilent Analog Discovery 2 (AD2)

The AD2 computer-based analyzer (1286-1117-ND) from Digilent uses graphical user interfaces (GUIs) to emulate real-world devices such as oscilloscopes, function generators, power supplies, meters, loggers, LED indicators, and switches. Users configure a project electrically through detachable wire lead headers and can save the entire GUI configurations and settings. The following setups are specific to this part of the BLDC Hall Sensors as Encoders project and include four different ways to visualize the sensor output.

Breadboarding the Sensor Output and AD2 Input/Output

Using a breadboard (438-1045-ND or similar), attach the AD2 module to the left end of the breadboard using hook and loop fasteners (3M162604-ND). Connect the AD2 to a computer using the supplied USB cable; then attach an external 5 V, 2 A power supply to the AD2 (not supplied, 102-3425-ND or similar). Use sections of right angle 0.100 pitch pin headers (S1121EC-10-ND) and the AD2 wire lead chart (see below) to connect AD2 wire leads to the breadboard beginning with the two positive scope channel leads. Connect the AD2 V+ supply lead to the positive (+) side of the lower power rail. Connect all AD2 ground leads and the negative scope leads to the negative side of the lower power rail. Use solid jumper wires (BKWK-3-ND) to make all other board connections and to join the negative and positive sides of the upper and lower power rails respectively (Figure 1).

Chart 1: AD2 Wire Lead Chart (Image source: Digilent, Inc.)

Figure 1 (Image source: Digi-Key Electronics)

Note:The AD2 scope is limited to two channels for examination of the three sensor outputs. Any combination of scope to sensor connections are acceptable for testing.

The sensor output is active low meaning when triggered, the output is connected to the negative power rail. When not triggered, the output is said to be floating. It is neither positive nor negative. When not triggered, the sensor output needs to be pulled up to the positive power rail to establish two defined states which appear as a square wave on the AD2 scope. Insert three 4 KΩ – 8 KΩ resistors into the breadboard to be used as pull-ups for the sensor output (Figure 2).

Figure 2 (Image source: Digi-Key Electronics)

Software

WaveForms is the downloadable software required to implement the AD2. Once downloaded and installed, select the Workspace dropdown; then select New from the list. A new workspace opens and is ready for configuration (Figure 3).

Figure 3 (Image source: Digi-Key Electronics)

Note: Once configured, saving options are available.

Power Supply: The power rails of the breadboard require 5 V to energize the sensors. Select the Supplies tab on the Waveforms welcome page (Figure 4). Make the Supplies dialog box float by selecting the dock/undock icon. Size the box to take up a minimum amount of display space. (Figure 5).

Figure 4 (Image source: Digi-Key Electronics)

Figure 5 (Image source: Digi-Key Electronics)

Configure the supply by selecting 5 V from the Positive Supply (V+) Voltage dropdown selector. Assure the Negative Supply (V-) is Off by toggling the button. The button should read “Off” and display a red “X”. Enable the output by toggling the Master EnableOn” (Figure 6).

Figure 6 (Image source: Digi-Key Electronics)

Oscilloscope: The scope tool allows the user to visually examine and measure the sensor output waveforms. Select the Scope tab on the Waveforms welcome page (Figure 7). Make the scope dialog box float by selecting the dock/undock icon. Size the box to take up a minimum amount of display space.

Figure 7 (Image source: Digi-Key Electronics)

The scope is configurable in many ways and has a wide range of functions at the user’s disposal. For this project, match the dialog boxes and configuration dropdowns in the WaveForms scope window with the settings in Figure 8. Ensure the power supply Master Enable in the supplies window is on; then select the Scan button in the scope window. Turn the BLDC motor by hand to see the square wave output of the sensors appear in the scope window (Figure 9).

Figure 8 (Image source: Digi-Key Electronics)

Figure 9 (Image source: Digi-Key Electronics)

As the motor is turned faster or slower, note the change in the frequency of the square waves and how the offset between the signals remains constant. Swap the wire leads on the header pins to observe the remaining sensor output or to observe the offset between different combinations of waves. The scope functions allow the user to see wave frequency and amplitude and to make real-time measurements.

This is a good time to save the workspace. Select Workspace from the Waveforms menu to reveal saving options.

Logic Analyzer: Another way to observe the signal relationship and to visualize the high/low logic (ones and zeros) between the squarewaves involves the logic analyzer.

The first step is to add some circuit paths and leads to the breadboard to support the analyzer function.  Add a three-position header and jumper wires to the breadboard; then connect digital input/output wires 15, 14 & 13 to the header. Add solid jumper wires to connect the sensor output to the header. See Figure 10 and the AD2 wire lead chart provided earlier.

Figure 10 (Image source: Digi-Key Electronics)

Select Logic Analyzer from the left sidebar list of functions on the Waveforms welcome page; then select the green “+” icon to add a digital input/output channel from the list. Add channels 15, 14 and 13 to the analyzer. Make the logic analyzer dialog box float by selecting the dock/undock icon. Size the box to take up a minimum amount of display space.

The analyzer is configurable in many ways and has a wide range of functions at the user’s disposal. For this project, match the dialog boxes and configuration dropdowns in the WaveForms logic analyzer window with the settings in Figure 11.

Figure 11 (Image source: Digi-Key Electronics)

Select View in the analyzer menu; then select Data to turn on the data window. Drag the window to an open space on the computer monitor. Ensure the power supply Master Enable in the supplies windows is on; then select the Scan button in the logic analyzer window. Turn the BLDC motor by hand to see all three squarewave outputs of the sensors appear in the analyzer window and the binary values appear in the data window (Figure 12).

Figure 12 (Image source: Digi-Key Electronics)

The binary values in the data window match the values determined in part one of this tutorial (see Additional Resources below). If the wheel is rotated one step at a time, the rise or fall of the squarewaves can be observed as well as stepping through the binary combinations one at a time (001, 101, 100, 110, 010, 011).

Static I/O: For additional indication, simulated LEDs can be assigned to the sensor output digital channels.

Select Static I/O from the left sidebar list of functions on the Waveforms welcome page. Make the static I/O dialog box float by selecting the dock/undock icon. Size the box to take up a minimum amount of display space.

Configuration is not needed as LED indication is the default setting for each channel. Turn the BLDC motor by hand and observe the LEDS toggling ON and OFF as the logic analyzer detects rising and falling edges of the squarewaves. Note the LED status reflects the binary combinations in the data window (Figure 13).

Figure 13 (Image source: Digi-Key Electronics)

The Static I/O can also be configured as logic switches to control real-world circuits. As an option for this example, a DC drive motor may be used to turn the BLDC motor using a friction wheel and a test stand. The simplest way to manually operate the BLDC motor involves only an external power supply and a solid-state relay (SSR, CC1126-ND) (Figure 14). Connect the negative lead extending from the control side of the SSR to one of the negative power rails on the project breadboard; then connect the positive lead from the SSR to the AD2 digital 7 I/O lead.

Figure 14 (Image source: Digi-Key Electronics)

Configure DIO 7 as a push-pull switch in the Static I/O window using the dropdown selector next to the I/O number. With the power supply set to less than the maximum motor input voltage, toggle the AD2 switch to turn the motor on and off. Use the voltage dial of the external power supply to set motor speed. Implementing SSR’s controlled by the Static I/O channels allows users to toggle on and off an endless list of peripheral devices that are isolated from the breadboard and the AD2 power supplies.

Summary

The Diligent Analog Discovery 2 may not have all the capability of high-end, stand-alone lab equipment but it can assist in visualizing the signals generated by many electronic devices and sensors. Without visualization tools, the experimenter can only imagine what is happening to sense and control signals in a circuit and how the circuit responds to those signals.

Additional Resources:

Using BLDC Hall Sensors as Position Encoders

Part 1 – The Anatomy and Operation of BLDC Hub Motors with Hall Effect Sensors

关于此作者

Image of Don Johanneck

Don Johanneck 是 Digi-Key Electronics 的技术内容开发人员,自 2014 年以来一直在该公司工作。他最近刚转岗到现在的职位,负责撰写视频说明和产品内容。Don 通过 Digi-Key 奖学金计划获得了北国社区技术学院电子技术和自动化系的应用科学副学士学位。他喜欢无线电控制建模,老式机器修复和修补。

More posts by Don Johanneck