Silicon ChipHigh Power DC Motor Speed Control - January 2017 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Pumped hydro storage is no panacea for renewables & Airbags could kill your daughter
  4. Subscriptions
  5. Feature: Pumped Storage Hydroelectricity by Dr David Maddison
  6. PartShop
  7. Feature: Viewing Radio Waves In Colour by Ross Tester
  8. Project: New SC200 Audio Amplifier by Nicholas Vinen & Leo Simpson
  9. Project: High Power DC Motor Speed Control by John Clarke
  10. Serviceman's Log: When spare parts aren't around by Dave Thompson
  11. Project: Programming the ATtiny85 With An Arduino by Lawrence Billson
  12. Product Showcase
  13. Project: El Cheapo Modules From Asia - Part 3 by Jim Rowe
  14. Project: Giving the Ultrasonic Theremin A Volume Control by Bao Smith
  15. Feature: Real-Time System Modelling by Karthik Srinivasan
  16. Feature: Set-Top Boxes Make Great (Cheap!) PVRs by Jim Rowe
  17. Vintage Radio: Pye 1951 5-Valve Model APJ-Modified by Associate Professor Graham Parslow
  18. PartShop
  19. Market Centre
  20. Advertising Index
  21. Outer Back Cover

This is only a preview of the January 2017 issue of Silicon Chip.

You can view 40 of the 104 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Items relevant to "New SC200 Audio Amplifier":
  • Ultra-LD Mk3/Mk4 Amplifier Power Supply PCB [01109111] (AUD $15.00)
  • New SC200 Audio Amplifier PCB [01108161] (AUD $10.00)
  • Hard-to-get parts for the SC200 Audio Amplifier Module (Component, AUD $50.00)
  • New SC200 Audio Amplifier PCB pattern (PDF download) [01108161] (Free)
Articles in this series:
  • New SC200 Audio Amplifier (January 2017)
  • New SC200 Audio Amplifier (January 2017)
  • New SC200 Audio Amplifier – Part 2 (February 2017)
  • New SC200 Audio Amplifier – Part 2 (February 2017)
  • New SC200 Audio Amplifier - Part 3 (March 2017)
  • New SC200 Audio Amplifier - Part 3 (March 2017)
Items relevant to "High Power DC Motor Speed Control":
  • High Power DC Motor Speed Control main PCB [11112161] (AUD $10.00)
  • High Power DC Motor Speed Control Mosfet PCB [11112162] (AUD $12.50)
  • PIC16F88-I/P programmed for the High Power DC Motor Speed Controller [1111216A.HEX] (Programmed Microcontroller, AUD $15.00)
  • Hard-to-get parts for the High Power DC Motor Speed Controller (Component, AUD $50.00)
  • Firmware (ASM and HEX) files for the High Power DC Motor Speed Control [1111216A.HEX] (Software, Free)
  • High Power DC Motor Speed Control PCB patterns (PDF download) [11112161/2] (Free)
Articles in this series:
  • High Power DC Motor Speed Control (January 2017)
  • High Power DC Motor Speed Control (January 2017)
  • High Power DC Motor Speed Control – Part 2 (February 2017)
  • High Power DC Motor Speed Control – Part 2 (February 2017)
Items relevant to "Programming the ATtiny85 With An Arduino":
  • Firmware (.ino) files for the Programming the ATtiny85 With An Arduino (Software, Free)
Items relevant to "El Cheapo Modules From Asia - Part 3":
  • CP2102-based USB/TTL serial converter with microUSB socket and 6-pin right-angle header (Component, AUD $5.00)
  • CP2102-based USB/TTL serial converter with microUSB socket and 6-pin right-angle header (clone version) (Component, AUD $3.00)
Articles in this series:
  • El Cheapo Modules From Asia - Part 1 (October 2016)
  • El Cheapo Modules From Asia - Part 1 (October 2016)
  • El Cheapo Modules From Asia - Part 2 (December 2016)
  • El Cheapo Modules From Asia - Part 2 (December 2016)
  • El Cheapo Modules From Asia - Part 3 (January 2017)
  • El Cheapo Modules From Asia - Part 3 (January 2017)
  • El Cheapo Modules from Asia - Part 4 (February 2017)
  • El Cheapo Modules from Asia - Part 4 (February 2017)
  • El Cheapo Modules, Part 5: LCD module with I²C (March 2017)
  • El Cheapo Modules, Part 5: LCD module with I²C (March 2017)
  • El Cheapo Modules, Part 6: Direct Digital Synthesiser (April 2017)
  • El Cheapo Modules, Part 6: Direct Digital Synthesiser (April 2017)
  • El Cheapo Modules, Part 7: LED Matrix displays (June 2017)
  • El Cheapo Modules, Part 7: LED Matrix displays (June 2017)
  • El Cheapo Modules: Li-ion & LiPo Chargers (August 2017)
  • El Cheapo Modules: Li-ion & LiPo Chargers (August 2017)
  • El Cheapo modules Part 9: AD9850 DDS module (September 2017)
  • El Cheapo modules Part 9: AD9850 DDS module (September 2017)
  • El Cheapo Modules Part 10: GPS receivers (October 2017)
  • El Cheapo Modules Part 10: GPS receivers (October 2017)
  • El Cheapo Modules 11: Pressure/Temperature Sensors (December 2017)
  • El Cheapo Modules 11: Pressure/Temperature Sensors (December 2017)
  • El Cheapo Modules 12: 2.4GHz Wireless Data Modules (January 2018)
  • El Cheapo Modules 12: 2.4GHz Wireless Data Modules (January 2018)
  • El Cheapo Modules 13: sensing motion and moisture (February 2018)
  • El Cheapo Modules 13: sensing motion and moisture (February 2018)
  • El Cheapo Modules 14: Logarithmic RF Detector (March 2018)
  • El Cheapo Modules 14: Logarithmic RF Detector (March 2018)
  • El Cheapo Modules 16: 35-4400MHz frequency generator (May 2018)
  • El Cheapo Modules 16: 35-4400MHz frequency generator (May 2018)
  • El Cheapo Modules 17: 4GHz digital attenuator (June 2018)
  • El Cheapo Modules 17: 4GHz digital attenuator (June 2018)
  • El Cheapo: 500MHz frequency counter and preamp (July 2018)
  • El Cheapo: 500MHz frequency counter and preamp (July 2018)
  • El Cheapo modules Part 19 – Arduino NFC Shield (September 2018)
  • El Cheapo modules Part 19 – Arduino NFC Shield (September 2018)
  • El cheapo modules, part 20: two tiny compass modules (November 2018)
  • El cheapo modules, part 20: two tiny compass modules (November 2018)
  • El cheapo modules, part 21: stamp-sized audio player (December 2018)
  • El cheapo modules, part 21: stamp-sized audio player (December 2018)
  • El Cheapo Modules 22: Stepper Motor Drivers (February 2019)
  • El Cheapo Modules 22: Stepper Motor Drivers (February 2019)
  • El Cheapo Modules 23: Galvanic Skin Response (March 2019)
  • El Cheapo Modules 23: Galvanic Skin Response (March 2019)
  • El Cheapo Modules: Class D amplifier modules (May 2019)
  • El Cheapo Modules: Class D amplifier modules (May 2019)
  • El Cheapo Modules: Long Range (LoRa) Transceivers (June 2019)
  • El Cheapo Modules: Long Range (LoRa) Transceivers (June 2019)
  • El Cheapo Modules: AD584 Precision Voltage References (July 2019)
  • El Cheapo Modules: AD584 Precision Voltage References (July 2019)
  • Three I-O Expanders to give you more control! (November 2019)
  • Three I-O Expanders to give you more control! (November 2019)
  • El Cheapo modules: “Intelligent” 8x8 RGB LED Matrix (January 2020)
  • El Cheapo modules: “Intelligent” 8x8 RGB LED Matrix (January 2020)
  • El Cheapo modules: 8-channel USB Logic Analyser (February 2020)
  • El Cheapo modules: 8-channel USB Logic Analyser (February 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules (May 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules (May 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules, Part 2 (June 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules, Part 2 (June 2020)
  • El Cheapo Modules: Mini Digital Volt/Amp Panel Meters (December 2020)
  • El Cheapo Modules: Mini Digital Volt/Amp Panel Meters (December 2020)
  • El Cheapo Modules: Mini Digital AC Panel Meters (January 2021)
  • El Cheapo Modules: Mini Digital AC Panel Meters (January 2021)
  • El Cheapo Modules: LCR-T4 Digital Multi-Tester (February 2021)
  • El Cheapo Modules: LCR-T4 Digital Multi-Tester (February 2021)
  • El Cheapo Modules: USB-PD chargers (July 2021)
  • El Cheapo Modules: USB-PD chargers (July 2021)
  • El Cheapo Modules: USB-PD Triggers (August 2021)
  • El Cheapo Modules: USB-PD Triggers (August 2021)
  • El Cheapo Modules: 3.8GHz Digital Attenuator (October 2021)
  • El Cheapo Modules: 3.8GHz Digital Attenuator (October 2021)
  • El Cheapo Modules: 6GHz Digital Attenuator (November 2021)
  • El Cheapo Modules: 6GHz Digital Attenuator (November 2021)
  • El Cheapo Modules: 35MHz-4.4GHz Signal Generator (December 2021)
  • El Cheapo Modules: 35MHz-4.4GHz Signal Generator (December 2021)
  • El Cheapo Modules: LTDZ Spectrum Analyser (January 2022)
  • El Cheapo Modules: LTDZ Spectrum Analyser (January 2022)
  • Low-noise HF-UHF Amplifiers (February 2022)
  • Low-noise HF-UHF Amplifiers (February 2022)
  • A Gesture Recognition Module (March 2022)
  • A Gesture Recognition Module (March 2022)
  • Air Quality Sensors (May 2022)
  • Air Quality Sensors (May 2022)
  • MOS Air Quality Sensors (June 2022)
  • MOS Air Quality Sensors (June 2022)
  • PAS CO2 Air Quality Sensor (July 2022)
  • PAS CO2 Air Quality Sensor (July 2022)
  • Particulate Matter (PM) Sensors (November 2022)
  • Particulate Matter (PM) Sensors (November 2022)
  • Heart Rate Sensor Module (February 2023)
  • Heart Rate Sensor Module (February 2023)
  • UVM-30A UV Light Sensor (May 2023)
  • UVM-30A UV Light Sensor (May 2023)
  • VL6180X Rangefinding Module (July 2023)
  • VL6180X Rangefinding Module (July 2023)
  • pH Meter Module (September 2023)
  • pH Meter Module (September 2023)
  • 1.3in Monochrome OLED Display (October 2023)
  • 1.3in Monochrome OLED Display (October 2023)
  • 16-bit precision 4-input ADC (November 2023)
  • 16-bit precision 4-input ADC (November 2023)
  • 1-24V USB Power Supply (October 2024)
  • 1-24V USB Power Supply (October 2024)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (January 2025)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (January 2025)
  • Using Electronic Modules: 1-24V Adjustable USB Power Supply (February 2025)
  • Using Electronic Modules: 1-24V Adjustable USB Power Supply (February 2025)
Items relevant to "Giving the Ultrasonic Theremin A Volume Control":
  • Firmware (.ino and .c) files for Giving the Ultrasonic Theremin a Volume Control (Software, Free)
Articles in this series:
  • Arduino-Based Digital Theremin (December 2016)
  • Arduino-Based Digital Theremin (December 2016)
  • Giving the Ultrasonic Theremin A Volume Control (January 2017)
  • Giving the Ultrasonic Theremin A Volume Control (January 2017)

Purchase a printed copy of this issue for $10.00.

Want REAL Gru Design by JOHN CLARKE Our biggest-ever DC speed controller: 12 to 60V at up to 40A! So you need a speed controller for a powerful DC motor. How much grunt do you want? This design has bags of it and can run with a DC supply from 12V to 60V, at currents up to 40A. As well, it has low battery cut-off, speed regulation (feedback), soft start and other useful features. 36  Silicon Chip siliconchip.com.au unt? T he 24V 20A speed controller published in our June 2011 issue has been extremely popular and reliable over the years and it is still a valid design if you want a fairly modest power output. We also published a more complex 12-24V 40A design with a 4-digit display in the March & April 2008 issues but its complicated set-up made it less popular with readers. But now we have come up with a new design which can be regarded as our June 2011 design on steroids. Not only will it work with much higher battery voltages, up to 60V (equivalent to a 48V lead-acid battery) and at currents up to 40A, it has a wide range of features which will make it much more flexible. What sort of motors can you use with this speed controller? Answer: any brushed DC motor; permanent magnet, series-wound or shunt-wound and with current ratings up to 40A. Features One drawback of all our past DC siliconchip.com.au Features • • • • • • • • • • • Operation up to 60V at cu rrents up to 40A High or low-side switchin g Hall Effect or potentiome ter throttle Soft start at power up Emergency stop button wi th LED indicator Low battery shut down wi th LED indicator LED power and speed ind ication Speed regulation with mo tor feedback Minimum and maximum throttle range adjustmen t Maximum speed limit se tting PWM frequency adjustm ent from 100Hz to 1kHz (typical) speed controllers is that one side of the motor needs to be tied to the positive side of the battery. This is a problem in car applications because in those cases, one side of the motor is tied to chassis. Our new design caters for either situation, depending on link options on the PCB. Our new design provides good speed regulation as it monitors the motor back-EMF. Back-EMF is the voltage generated by the motor which opposes the current flow. Motor back-EMF increases in proportion to the motor speed and so it can be used to provide good speed regulation. Soft start is another desirable feature which means that the motor does not start with a sudden jerk as soon as power is applied. Instead, it can be programmed to start very gently or very rapidly, depending on the setting of a trimpot. The speed of the motor can be adjusted using a standard potentiometer (ie, via a rotary knob) or via a twistgrip (Hall Effect) throttle, as on elec- tric bikes. There is also a flashing LED which gives a visible indication of the speed setting, with short flashes meaning low speed and longer flashes indicating high speed. Maximum speed setting Often you need to limit the speed at which a motor can run and in this design it is simple to set. As with our other DC speed controllers, this circuit works on the pulsewidth modulation (PWM) principle which means that it controls the power by rapidly switching two or three paralleled Mosfets on and off. And since PWM speed controllers can result in an audible whine from the motor, we provide a trimpot to adjust the PWM frequency so you can tune it to minimise audibility of the switching. We should also state that some motors will work better at low PWM rates since they may have high inductance. Others may work well at higher frequencies but the switching noise becomes more audible. Hence, setting + Fig.1: these two circuits show the difference between high K + side and low side switching. D1 MOTOR This refers to the position A – of the control circuitry FEEDBACK and motor with respect to the supply. In low side, the motor is switched, D Q1 or controlled, between DRIVE MOSFET its negative connection SWITCH G S and earth; in high side between the motor positive and the positive supply. Fig.1(a): LOW SIDE SWITCHING + D DRIVE G FEEDBACK S Q1 MOSFET SWITCH + MOTOR K D1 – A Fig.1(b): HIGH SIDE SWITCHING January 2017  37 the PWM frequency is a compromise for the particular motor you are using. cut-off setting at 11.5V. Going below that with sealed lead acid batteries can cause battery failure. Emergency stop The PCB on the base is the control board, carrying the microcontroller and the eight trimpots and this is linked to the lid-mounted switching PCB which has the fuseholder, Mosfets and the four binding post terminals. Two PCBs This feature is self-explanatory. Hit a switch and motor will stop immediately. If you don’t need it, you can leave the switch out. Emergency stop operates in one of two modes. The first will restore normal operation once the throttle is returned to zero. The second will only restore normal operation when power is switched off and on again. Finally, to prevent the battery being discharging too deeply and causing permanent damage, there is a low battery cut-off trimpot. For example, with a 12V battery, you might have a The speed controller is mounted in a compact diecast aluminium case with four high-current binding post terminals, two for the battery connections and two for the connections to the motor. On the side of the box are four LEDs, to indicate Power, Speed, Low Battery and Shutdown/Limit. There is also a toggle power switch and the speed control knob. Inside the box are two PCBs, one sitting on the base and one attached to the lid. High side & low side switching We have already mentioned that this circuit can work with one side of the motor tied to the positive side of the battery and it will also work with one side of the motor tied to the negative side of the battery, which is the case with most, if not all, the DC motors used in cars. Where the motor is connected to the positive side of the battery, the Mosfet doing the PWM switching is connected +12 -- 60V JP1* D3 1N4004 CON7 POWER A REG1 LM2940CT-12 ZD4* K K A S1 GND 10F A GND 10F 1k +5V OUT IN 10F 63V VBAT REG2 7805 +12V OUT IN POWER 10F D2 UF4004 THROTTLE 100F 4 3 14 Vdd RA5/MCLR 100nF EMERGENCY STOP RB3/PWM 6 TPG RB1 RB0 RB2 IC1 PIC16F88 PIC16F88 TP1 1 RB7/AN6 REF–/RA2 2 VBAT K VR7 50k 4.7k VR3 10k FREQUENCY ZD2 4.7V A 8 RA0/AN0 LOW BATTERY SHUTDOWN VOLTAGE 10F RB4 OSC1/RA7 TPV 18 22pF RB5 OSC2/RA6 AN1/RA1 Vss 5 SC 1 Vcc Vb NC 10F 4.7 Vs NC 6 GATE SOURCE 4 VR5 10k 13 FEEDBACK GAIN 17 SOFT START SENSE: JP2 IN = LOW-SIDE SWITCHING OUT = HIGH-SIDE SWITCHING F/B * SEE TABLE 1 FOR VALUES OF THESE COMPONENTS VR4 10k CON8 R2* ADJUST FEEDBACK 12 10 8 7 IC2 Hin Hout IRS21850S S2 3x 1k K 10F 11 15 VR6 10k ZD3 4.7V A LED2  K A A A SPEED 2017 K COM 10F RB6/AN5 16 5 10k MAX SET REF+/RA3 10F R1* 7 JP2 100nF TP2 VR2 10k 2 9 10F THROTTLE MAXIMUM 3 SENSE 1nF VR1 10k +5V AN4/RA4 A +12V 100nF 1k TP3 2.2k VR8 10k THROTTLE MINIMUM 0V K +5V S3  LED1 LED3  K LOW BATTERY LED4  K SHUTDOWN /LIMIT HIGH POWER MOTOR SPEED CONTROLLER Fig.2: the circuitry on this page is that on the “control” PCB. IC1, a PIC16F88, monitors the settings of the various controls, along with monitoring the back-emf from the motor. It produces the PWM signal used to control the motor speed. . . 38  Silicon Chip siliconchip.com.au between the negative terminal of the motor and the negative terminal of the battery. We refer to this as “low side switching” and this is depicted in the circuit of Fig.1(a). This configuration has been used in most of our previous DC speed controls. As you can see, the Mosfet is below the motor, on the “low side”. In the opposite case, the motor is connected to the negative terminal of the battery and the switching Mosfet is connected between the positive terminal of the battery and the positive terminal of the motor and this “high side switching” arrangement is shown in Fig.1(b). Arranging the gate drive signals to an N-channel\ Mosfet in a low-side switching circuit is comparatively simple since the source of the Mosfet is at 0V and this is easy with typical logic or microcontroller switching. It is somewhat more complicated in a high-side switching circuit since the source terminal of the Mosfet is tied to that of the positive motor terminal and so when the motor has full voltage applied to it, the Mosfet’s source voltage is almost equal to the battery voltage. But when the motor has low or zero voltage applied to it, the Mosfet’s source voltage is similarly low. This creates a problem with an Nchannel Mosfet since it needs a gate voltage which is positive with respect to the source. Consider then, a circuit with a nomi- nal battery voltage of 48V and a Mosfet which requires a gate-source voltage of say, 10V to fully turn on. That would mean that the required gate voltage was about 58V, ie, 10V more than the battery voltage. How do you generate such high gate voltages which are tied to the source terminal and which need to “float up an down” according to whether the Mosfet is turned on or off? That task is performed by a “highside driver” IC, so we have one of those chips in our circuit, which we will now describe. Circuit description The full circuit of the motor speed controller is shown in Fig.2. The section on the left-hand page is that on +12 -- 60V FUSE INSTALL RED LINKS (LK1, LK2, LK3 & LK7) FOR HIGH-SIDE SWITCHING (HSS); OR INSTALL BLUE LINKS (LK4, LK5, LK6 & LK8) FOR LOW-SIDE SWITCHING (LSS) Q1 IPP023N10N5AKSA1 G CON2 Q2 IPP023N10N5AKSA1 D G S 4.7 Q3 IPP023N10N5AKSA1 D G S 4.7 CON3 BATTERY + F1 LK1 (HSS) D S LK4 (LSS) 4.7 LK2 (HSS) CON5 (Q3 IS OPTIONAL) K ZD1 GATE MOTOR + 15V A SOURCE K CON1 D1 IDP30E65D1 -XKSA1 A LK7 (HSS) CON6 MOTOR – LK8 (LSS) LK5 (LSS) CON2 LK3 (HSS) CON4 BATTERY – D2, D3 A LK6 (LSS) ZD1-4 A K 7805 LM2940CT-12 LEDS K A K GND IN GND OUT GND IN GND Q1, Q2, (Q3) OUT G D1 K D D S K A . . . while the circuitry on this page is all on the “switching” PCB to actually drive the motor. As mentioned in the text, it is absolutely imperative that you ONLY install the red OR the blue links, depending on high or low-side switching. siliconchip.com.au January 2017  39 flashes to mimic the duty cycle of the PWM signal; brief flashes at low speed settings and longer flashes for higher speed settings. ADC references These waveforms show the operation of the speed controller. The top (blue) trace is the PWM waveform from IC1. The yellow trace is the “jacked up” gate waveform from the high-side driver, IC2. The green trace is the voltage across the motor – note that it is smaller in amplitude than the gate waveform. Finally, the pink trace is the gate-source waveform (difference between traces 1 & 2). the control PCB and it includes the PIC16F88 microcontroller (IC1), the International Rectifier IRS21850S high/low side driver (IC2), two 3-terminal regulators and seven trimpots. The section on the right-hand page is that of the switching PCB and includes the two (or three Mosfets), the fast recovery diode (D1) and the allimportant links which set the circuit up for high-side or low-side switching. We will make this point up-front: It is absolutely crucial that you only install one set of links for high-side OR low-side switching. If you (stupidly!) install all the links, you will have created a short-circuit directly across the battery which will blow the fuse to smithereens as soon as the circuit is connected! With that point out of the way, we will continue with the circuit description. Starting on the left-hand side of the circuit, the microcontroller monitors the speed input signal from a potentiometer (VR8) or a twist-grip Hall Effect throttle and produces a 5V pulsewidth modulated (PWM) signal which is fed to IC2 where it is converted to a floating 0-12V signal suitable for the gates of either low or high-side connected Mosfets. The speed signal from potentiome40  Silicon Chip ter VR8, ranging from 0 to 5V, is fed to the AN4 input of IC1 via a 2.2kΩ resistor. IC1’s analog to digital converter (ADC) converts the speed signal to digital form. The ADC has two reference inputs, REF- and REF+. These references provide the range over which the ADC measures and they are set using trimpots VR1 and VR2, respectively. If a Hall Effect throttle is used, its output does not cover the full 0-5V range. So in this case, VR1 is used to set REF- to match the lowest voltage available from the Hall Effect throttle and VR2 is used to set REF+ for the highest voltage from the sensor. The digital result from the ADC then covers the full 0-255 range. REF+ and REF- do have limit restrictions. REF+ can be set between 2.5V and 5V, while REF- can be from 0V up to 2V below REF+. So for a Hall Effect throttle that has a 0.75V minimum and 3.65V maximum, REF- is set for 0.75V and REF+ set to 3.65V. These values are within the voltage limit restrictions. So depending on the throttle setting, IC1’s PWM output at pin 9 produces a 5V pulse stream with a duty cycle ranging from 0% (Off) to almost 100%. It does not go to the full 100% (ie, 5V), as will be explained later. LED2, connected to pin 15 of IC1, While the throttle input at AN4 uses the REF+ and REF- settings from VR1 and VR2 as discussed above, the remainder of the analog inputs to IC1 are converted using alternative references set up within the software. The first of these is for low battery detection. The AN1 input, pin 18, monitors the battery voltage via resistor R1 and trimpot VR3. The input voltage to IC1 is limited by the 4.7V zener diode, ZD2. Table 1 shows the value of R1, depending on the nominal battery voltage. The battery voltage is deemed to be low when the voltage at AN1 falls below 2.5V, assuming an exact 5V at pin 14 of IC1. If the voltage at AN1 drops below 2.5V, the Mosfets are turned off and LED3 is lit up. This condition will stay until the circuit is turned off and the battery voltage is increased (charge the battery?). Shutdown will re-occur if the battery voltage is still below the low battery setting. Speed regulation feedback One of the tricky aspects of this circuit is providing for feedback of the motor back-EMF. As already noted, the back-EMF is proportional to the speed of the motor and it opposes the current. So when the motor is stalled (but voltage is applied) there will be no back-EMF and the current will be very high (this is the stall or lockedrotor current). Conversely, when motor speed is high, the back-EMF will be high and the current will be correspondingly low. For example, with an applied voltage of 12V and the motor running at maximum speed, the back-EMF could be as high as 10V. A further complication applies depending on whether the circuit is configured for high-side or low-side switching of the Mosfets. In the highside switching case (see Fig.1(b)), the back-EMF will vary from 0V to, say, 10V, with the DC supply being 12V. That can be quite simply coupled back to the microcontroller. But in the low-side switching case, since one side of the motor is tied to the +12V rail, the back-EMF will vary from 12V (zero siliconchip.com.au A +12V 100 F 3 PIN 9, IC1 10k 2 5 1 Vcc 8 7 IC2 Hout IRS21850S Vs NC 12-60V D2 UF4004 Vb NC Hin K COM 4.7 Q1 G 6 FEEDBACK 4 D 10 F MOTOR S + K D1 – A Fig.3: the high-side driver (IC2) generates its floating supply across the 10µF capacitor in a bootstrap mode, enabled by the switching of Mosfet Q1. speed), to 2V (full speed). In other words, the back-EMF will be tied to the positive rail and will have the opposite sense. There are two ways to cope with this problem. One method is to build a level-shifting inverting op amp circuit but op amps that can cope with a supply voltage and common mode voltages running to 60V or more are expensive and hard to get. The way around this is to use level-shifting circuit using discrete transistors and this approach was presented in the Circuit Notebook pages of the December 2016 issue. In this case though, we just reduce the back-EMF voltage to no more than 5V and let the microcontroller figure it out. So, looking for a moment at the right-hand side of the circuit, we take the feedback (back-EMF signal) from the commoned source electrodes of the Mosfets (positive side of the motor) via link LK7 for the high-side switching circuit and from the commoned drain electrodes of the Mosfets via link LK8. The feedback signal is fed via resistor R2 to the “Adjust Feedback” 10kΩ trimpot VR6. The voltage from the wiper of VR6 is limited by 4.7V zener diode ZD3 and filtered to remove motor hash by the 10µF capacitor and then fed to pin 12 of the microcontroller, IC1. The value of R2 is varied according to the supply voltage, as shown in Table 1 below. Table 1: resistor, zener and jumper settings for various battery voltages. Nominal R1 supply & R2 JP1 voltage 12V 10kΩ Jumper inserted 24V 27kΩ No jumper 36V 47kΩ No jumper 48V 68kΩ No jumper ZD4 No zener 10V 1W 20V 1W 30V 3W We need to tell the microcontroller whether the circuit is high-side or low-side switching and that is done with SENSE jumper link JP2, connected to the RB1 input at pin 7. Normally, the sense input is held high (5V) via an internal pullup current and in that condition, the software works for a high-side driver. If the sense input is tied to 0V with link JP2, then software works for low-side switching. Speed limiting and PWM frequency You can set the maximum motor speed in the following way. Press the speed limit switch S2 (connected to the RB2 input, pin 8) and set the throttle to the desired maximum siliconchip.com.au Inside the Motor Speed Controller – full construction details will be presented next month but will be slightly different from this prototype. The links on the motor PCB have been set up for high-side operation. speed and then release the switch. Once the maximum speed is set in this way, you can apply more throttle but the duty cycle of the Mosfet switching will not increase beyond the limit. IC1’s PWM output switching frequency at pin 9 is set by 50kΩ trimpot VR7, the 4.7kΩ series resistor and the 22pF capacitor connected to pin 16, the RC oscillator clock input. VR7 allows you to set the PWM frequency over the range from 100Hz to 1kHz, as previously noted. Mosfet switching The PWM output signal from IC1 is fed to IC2 and it can drive the N-channel Mosfets in high-side or low-side switching without any circuit changes being required. Fig.3 (above left) shows a portion of the circuit of Fig.2. The PWM signal from IC1 is fed to pin 2 and IC2’s pin 7 drives the gate (or gates) of the Mosfets. IC2 has an internal floating supply that can raise its output up to 600V higher than the 12V supply rail, Vcc, applied between pins 4 & 1. The internal floating supply is between VB and Vs and is essentially a “bootstrapped” diode pump circuit. It depends on the Mosfet and load (in this case the motor) being connected. The Mosfet source connects to Vs (pin 6) and the gate connects to pin 7. With the Mosfet initially off, diode D2 charges the 10µF capacitor that’s between pin 8 (Vb) and pin 6 (Vs) via the motor windings. At this point, the floating supply is sitting at about 12V and can provide a 12V gate signal to the Mosfet. When the Mosfet gate is taken to 12V, it switches on and January 2017  41 Parts List – DC Motor Speed Controller Controller board 1 PCB, coded 11112161, 107 x 82mm 1 set of panel labels 1 diecast box 119 x 94 x 57mm (Jaycar HB-5064) 2 3-way screw terminals with 5.08mm spacings    (as part of CON7 & CON8) 3 2-way screw terminals with 5.08mm spacings (as part of CON7 & CON8) 1 SPST toggle switch (S1) 1 emergency shut-down switch latching DPDT pushbutton; S3; optional (Altronics S 0820) 1 momentary PCB-mount switch (Jaycar SP-0601,    Altronics S1120; S2) 1 DIL18 IC socket 2 2-way pin headers with 2.54mm spacings (JP1,JP2) 2 jumper shunts 1 knob to suit speed potentiometer 4 rubber feet 4 M3 tapped x 6.3mm spacers 10 M3 x 6mm screws 2 M3 nuts 1 cable gland for 4-8mm cable 1 500mm length of medium duty hookup wire    (or 5 100mm lengths of medium duty hookup wire      of different colours) 8 100mm cable ties 5 PC stakes (optional) Semiconductors 1 PIC16F88-I/P microcontroller programmed    with 1111216A.hex (IC1) 1 IRS21850SPBF high-side driver (IC2) 1 LM2940CT-12 low dropout regulator (REG1) 1 7805 three terminal regulator (REG2) 4 5mm LEDs (LED1 [green], LED2 [yellow], LED3 [amber], LED4 [red]) 1 UF4004 1A fast diode (D2) 1 1N4004 1A diode (D3) 1 zener diode (ZD4) (see table 1) 2 4.7V 1W zener diodes (ZD2,ZD3) its source is pulled up to the positive battery supply. The source voltage pulls the negative side of the 10µF floating supply to the battery voltage (which can be up to 60V in our circuit) and the positive side of the 10µF capacitor is then 12V above the battery supply. Diode D2 is then reverse-biased. When the gate signal drops to zero, the Mosfet switches off and the 10µF capacitor is recharged 12V. In this way, IC2 can always deliver an adequate gate pulse voltage to turn on the Mosfet and drive the load. However, for this process to work, the gate pulses can never have a duty cycle of 100%, ie, permanently high, because that would stop the diode 42  Silicon Chip Capacitors 1 10µF 63V PC electrolytic 9 10µF 16V PC electrolytic 1 100µF 16V PC electrolytic 3 100nF 63V or 100V MKT polyester 1 1nf MKT polyester 1 22pF ceramic Resistors (0.25W, 1%) 1 10kΩ 1 4.7kΩ 1 2.2kΩ 5 1kΩ 1 4.7Ω R1,R2: see Table.1 6 10kΩ miniature horizontal trimpots (code 103) (VR1-VR6) 1 50kΩ miniature horizontal trimpot (code 503) (VR7) 1 10kΩ linear potentiometer (VR8) Power board 1 PCB coded 11112162, 111 x 85mm (70µm copper) 2 50A red Jumbo binding posts (Altronics P9225)   (CON3,CON5) 2 50A black Jumbo binding posts (Altronics P9226) (CON4,CON6) 1 30A PCB mount standard ATO/ATC blade fuse    holder (Altronics S6040) (F1) 1 40A* ATO/ATC blade fuse (*rating to suit motor) 1 3-way screw terminals with 5.08mm spacings (CON2) 1 2-way screw terminals with 5.08mm spacings (CON1) 1 200mm length of 0.7mm tinned copper wire 1 600mm length of medium duty hookup wire    (or 6 100mm lengths of medium duty hookup    wire of different colours) 2 M3 tapped spacers, 12mm long 5 M3 x 10mm screws 2 IPP023N10N5AKSA1 120A 100V N-channel   Mosfets (Q1,Q2) or FDP2D3N10C 1 IDP30E65D1XKSA1 60A 650V diode (D1) 1 15V 1W zener diode (ZD1) 2 4.7Ω 0.25W resistors pump involving D2 from working. In practice, the PWM duty cycle can reach 99% without the floating supply discharging. This is why the PWM duty cycle can not ever reach 100%, as noted earlier in this article. In the low-side switching configuration, the floating supply in IC2 remains at ground level, due to Vs being connected to ground. IC2 is then used as a high current Mosfet gate driver that translates the 0-5V from the PWM output of IC1 to 0-12V. High-side & low-side switching configurations It may not be obvious, but the change from low-side switching as shown in Fig.1(a), to high-side switch- ing in Fig.1(b), is done by two sets of links and as already noted, only one set of these links must be installed on the PCB. So for the high-side switching, you would install the parallel links LK1, LK2 & and LK3, as well as the feedback link LK7. Similarly, for low-side switching, you must install paralleled links LK4, LK5 & LK6, together with feedback link LK8. These linking options essentially swap the positions of the Mosfets and motor, to agree with Fig.1(a) or Fig.1(b). Next month we will complete the DC Motor Speed Controller with the construction details and setting up SC procedure. siliconchip.com.au