Brushless Dc Electric Motor Control By Cpld

1,607 views

Published on

The main area for application of brushless direct current motors (BLDC) is positioning. In this article I am going to describe a simple solution to operation with two phase sine/cosine BLDC.
The main idea is to generate sine and cosine by Pulse Weight Modulation (PWM) using configurable logic for example field programmable array (FPGA) or complex programmable logic device (CPLD).

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,607
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
115
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Brushless Dc Electric Motor Control By Cpld

  1. 1. Published on Your Electronics Open Source (http://dev.emcelettronica.com) Home > Blog > andri_ym's blog > Contenuti Brushless DC electric motor control by CPLD By andri_ym Created May 25 2009 - 08:02 The main area for application of brushless direct current motors (BLDC) is positioning. In this article I am going to describe a simple solution to operation with two phase sine/cosine BLDC. The main idea is to generate sine and cosine by Pulse Weight Modulation (PWM) using configurable logic for example field programmable array (FPGA) or complex programmable logic device (CPLD). The general structure of system shown in Pic. 1. Pic. 1.- General structure of system To produce low cost prototyping solution was selected CPLD from Altera EPM3064A (EPM3128A). Description of circuit diagram Device has the following parts: - motor driver part; - signal and control part; - power supply for motor driver part; - galvanic isolated power supply for signal part; - signal isolator. System was designed using classical H-bridges based on N-channel MOSFET transistors (IRF540N) with proper driver IR2110. The main idea was to generate sine wave modulated PWM signals on CPLD and transfer it via isolating integral circuits to drivers. There are two channels one sine other cosine. CPLD generates both signals using table method. Resulting waves are filtered partially of LC filter (see photo) and load windings of motor. The direction of running simply changes by multiplexing of sine and cosine PWM modulated signals in CPLD.
  2. 2. The system is simply controlled. It can be controlled manually and easily can be connected to any microcontroller. The carry signal is generated by generator IC MC74HC4060. More suitable frequency for drivers ICs is near 200 KHz, so was selected 4 MHz quartz resonator to provide 2500KHs carry signal. Controls: - ?On/Off? switch enables/disables outputs. When outputs disabled rotor of BLDC can be easily rotated and windings have floating potentials. - ?Enable? switch enables run of motor or firmly stops it holding power on windings. - ?Direct/Reverse? switch when closed ?Reset? and ?Stop/Run? defines the direction of rotation. - ?Speed? jumpers set the period of sine/cosine waves and divide speed of rotation of motor. The system designed as is. It has very simple protection by R30 and R45 shunt resistors from over current. Moreover by connection ADC to them can be established current and rotation feedback signal. Pic. 2 ? Circuit diagram In Download [1] section - BLCD_CPLD.zip you'll find the schematic at a high resolution. VHDL code description. VHDL code is provided in appendix A. Configurable logic module has 5 inputs and 2 outputs and utilizes 25% of logic cells. Inputs: 4 of them map switches state (except ?On/Off? what directly connected to isolated repeater) and 1 takes input clock (PWMclk). This clock internally divided and used to control multiplexors to select data from sine/cosine tables. Selected values from tables compared with PWM counting registers and finally form PWM signal with duty
  3. 3. changed cycle. So carry signal is twice modulated ? primary by PWM and secondary by table. Forms of waves depend on entry in tables for MUXA and MUXB multiplexers. In current project used 12 point approximation of sine/cosine wave. The resulting form of signal can be controlled by oscilloscope probes at control points K1 and K2. On the Pic. 3 was shown waveform on motor windings. The modulated PWM carry frequency is filtered and have maximal amplitude near the virtual ?zero? line. The number of points easily can be tuned to 8 point or even less to control stepper motors and to use more chipper CPLD. Current solution compiled for EPM3128A and fits EPM3064. With resolution of sine/cosine wave it can be ported even to EPM3032. Pic. 3 - Waveform on motor windings Implementation Project was implemented and tested with 50Watt BLDC of Russian produced. And provide stable work. Solution was tried to run 1 KWatts BLDC but time by time output transistors and drivers was crashed by high current at low speed turning of rotor (less them 10 rps.). For implementation was selected prototype board with suitable number of drivers and h-bridges. In the photo was shown PCB for two axis control system. To reduce EMC disturbances motor supplied via simple low pass LC filter. It is optional system for low load up to 50 Watts. The cut of frequency of filer should be 100KHz or bellow. Appendix A library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity PWM is-- SIN & COS generator (PWM 8 bit 8 samples per period) generic( Nbit : natural := 3; -- PWM resolution Ncases : natural := 2; -- max=8 samplses PhaseShift: natural := 2 -- Pi/2 phase shift );
  4. 4. Port ( SOut, COut: out STD_LOGIC; -- PWM outputs dir: in STD_LOGIC;-- direction Speed: in STD_LOGIC_VECTOR (1 downto 0);-- rotation Speed PWMclk : in STD_LOGIC;-- PMWclock -- Muxclk: in STD_LOGIC;-- data selector clock -- test : out STD_LOGIC_VECTOR (2 downto 0); -- PWM counter PWMen : in STD_LOGIC-- enable/stop PWM ); signal divider : STD_LOGIC_VECTOR ( 12 downto 0);-- PWM counter signal PWMcnt: STD_LOGIC_VECTOR ( Nbit downto 0);-- PWM counter --signal MuxCnt: STD_LOGIC_VECTOR ( Ncases downto 0);-- selector counter signal MuxA: STD_LOGIC_VECTOR ( 3 downto 0):=quot;0000quot;; -- data pointers signal MuxB: STD_LOGIC_VECTOR ( 3 downto 0):=quot;0011quot;; -- data pointers signal CosOut, SinOut,q : STD_LOGIC; signal DtSin,DtCos: STD_LOGIC_VECTOR (Nbit downto 0);-- PWM reg values end PWM; architecture BHVa of PWM is begin process (PWMclk,PWMen)-- PWM counter begin if (PWMen='0') then divider <= quot;0000000000000quot; ; --- disable/stop PWM else if(PWMclk'Event and PWMclk='1') then divider <= divider +'1'; end if; end if; end process; with Speed select -- q <= divider(9) when quot;11quot;, divider(8) when quot;10quot;, -- --divider(7) when quot;011quot;, -- divider(7) when others; -- process (q) -- SIN & COS data pointers selection begin if (PWMen='0') then MuxA <= quot;0000quot;; MuxB <= quot;0011quot;; else if(q'event and q='1') then MuxA <= MuxA + 1; MuxB <= MuxB + 1; --test (2 downto 0) <=MUXA (2 downto 0); end if; if(MuxA= quot;1010quot;) then MuxA <=quot;0000quot;; end if; if(MuxB= quot;1010quot;) then MuxA <=quot;0000quot;; end if; end if; end process; with MuxA select -- for SIN data 8-input data multiplexer DtSin (Nbit downto 0) <=
  5. 5. xquot;8quot; when quot;0000quot;, -- @000 xquot;Cquot; when quot;0001quot;, -- @030 xquot;Equot; when quot;0010quot;, -- @060 xquot;Fquot; when quot;0011quot;, -- @090 = Pi/2 = max xquot;Dquot; when quot;0100quot;, -- @120 xquot;Bquot; when quot;0101quot;, -- @150 xquot;8quot; when quot;0110quot;, -- @180 = Pi xquot;5quot; when quot;0111quot;, -- @210 xquot;2quot; when quot;1000quot;, -- @240 xquot;1quot; when quot;1001quot;, -- @270 =3/2*Pi= min xquot;2quot; when quot;1010quot;, -- @300 xquot;4quot; when quot;1011quot;, -- @330 xquot;8quot; when others; -- @360 with MuxB select -- for COS data 8-input data multiplexer -- DtCos (Nbit downto 0) <= xquot;8quot; when quot;0000quot;, -- @000 xquot;Cquot; when quot;0001quot;, -- @030 xquot;Equot; when quot;0010quot;, -- @060 xquot;Fquot; when quot;0011quot;, -- @090 = Pi/2 = max xquot;Dquot; when quot;0100quot;, -- @120 xquot;Bquot; when quot;0101quot;, -- @150 xquot;8quot; when quot;0110quot;, -- @180 = Pi xquot;5quot; when quot;0111quot;, -- @210 xquot;2quot; when quot;1000quot;, -- @240 xquot;1quot; when quot;1001quot;, -- @270 =3/2*Pi= min xquot;2quot; when quot;1010quot;, -- @300 xquot;4quot; when quot;1011quot;, -- @330 xquot;8quot; when others; -- @360 process (PWMclk,PWMen) -- PWM counter begin if (PWMen='0') then PWMcnt <= quot;0000quot; ; --- disable/stop PWM else if(PWMclk'Event and PWMclk='1') then PWMcnt <= PWMcnt +'1'; end if; end if; end process; process (dtsin,PWMcnt)-- SIN PWM comparator output begin if (dtsin > PWMcnt ) then SinOut <= '0' ; else SinOut <= '1'; end if; end process; process (dtcos,PWMcnt)-- COS PWM comparator output begin if (dtcos > PWMcnt ) then CosOut <= '0' ; else CosOut <= '1' ; end if; end process; with dir select -- for COS data 8-input data multiplexer
  6. 6. Cout <= CosOut when '0', -- 128@000=0 Sinout when others; with dir select -- for COS data 8-input data multiplexer Sout <= SinOut when '0', -- 128@000=0 CosOut when others; end BHVa; In Download [1] section - BLCD_CPLD.zip you'll find the schematic and BOM. Projects bldc brushless direct current motor cpld Trademarks Source URL: http://dev.emcelettronica.com/brushless-dc-electric-motor-control-cpld Links: [1] http://dev.emcelettronica.com/download

×