Saturday, December 15, 2012

12-24v High Current Motor Speed Controller Part 2

In first part we discussed about the detail of circuit, back EMF and Mosfet protection; in the second part we will cover these:

Other protection measures
As already mentioned, diode D1 provides reverse polarity protection for microcontroller IC1 and the switchmode supply (IC2). Zener diode ZD1 is self-protecting in the case of reverse supply connection. However, if the supply is reversed, there will be a heavy conduction path via fast recovery diode D3 and the internal substrate diodes in the four power MOSFETs. If you are lucky, the 50A fuse will blow before the MOSFETs are damaged, but there is no  guarantee of this. SO dOn’T rEVErSE THE bATTErY cOnnEcTIOnS!


In a similar vein, if the outputs are shorted while power is applied, high current will flow  through the MOSFETs. Again, if you are lucky, the 50A fuse will blow before the MOSFETs go up in smoke. In reality, the 50A fuse is there to stop a fire! SO dOn’T SHOrT THE OUTPUTS TO THE MOTOr.


If the motor is under heavy load and becomes stalled, high currents will flow in its armature.  Depending on the motor’s rating, this may or may not blow the fuse. If the fuse  does not blow during stall conditions of the motor, the MOSFETs should survive, although they may get very hot.

Warning buzzer
If the circuit is overloaded, the battery voltage should drop to the point where the warning buzzer sounds.

LED1 and its 470ohm current-limiting resistor are switched by a high level on the output of  pin 3 of the microcontroller. This is configured as a simple digital output. It also turns on  transistor Q4 and the piezo beeper. This output is controlled by the firmware and can be disabled.


A 1kohm pull-up resistor is used on pin 4 (reset) of the PIC16F88-I/P. This ties the reset pin high, which means that the microcontroller is reset only at power-on.


Finally, the rest of the outputs of the microcontroller, namely pins 7 to 13 and 15 to 17, are used to drive the optional display board.


Display board

Fig.1 shows the optional display board circuit. It connects to the main board via 12-pin  header CON1 and a ribbon cable.


 The display board consists of two pushbutton switches, four 7-segment displays, which are multiplexed by the firm-ware, four transistors and some resistors, as well as a 74HC595 shift
register (IC3).


Pins 1 and 2 of the 12-way connector CON2 supply +5V to the display board. Pin 3 is  connected to a digital input of the microcontroller (pin 17) and is pulled high by a 1kohm resistor on the main board. Conversely, it is pulled low by the display board.


This is used by the microcontroller to detect whether the display board is connected or not.
Pins 4 to 7 of CON1 are used to drive transistors Q9 to Q12 on the display board. These transistors switch the 7-segment display cathodes (K).


Pins 8 to 10 of CON1 are respectively the CLK, DATA and OUTPUT ENABLE lines and these go to the 74HC595 shift register (IC3). The microcontroller drives these lines to load a new 8-bit value into the shift register. The outputs of the shift register are connected across the four 7-segment displays and drive the anodes.


Finally, pins 11 and 12 are connected to pushbutton switches S2 and S3 on the display board. They are also connected to digital inputs on the microcontroller (which have internal pull-ups enabled) and these inputs are used to monitor the pushbuttons.


DC Motor Speed Controller: Software Features and Set-up:

ThE STRuCTuRE of the firmware for the DC Motor Speed Controller is shown overleaf in Fig.2. The transitions between the various menus are made using the switches on the display board and are indicated with labelled arrows.

There are four possible switch presses, either ‘Short’ or ‘Long’ and either the Left (L) or  Right (R). Thus, for example, ‘Short R’ refers to a short press of the right pushbutton.


Main menu

The Main menu is as shown in Menu 1. It consists of the letter ‘P’ (for ‘percentage’) and three digits with a decimal point indicating the range 00.0% to 99.9%. The percentage value indicates the fraction of full speed the motor is currently running at.


In this mode, the motor’s speed can be adjusted by varying the pot. The letter ‘P’ will flash while the motor’s speed increases or decreases to the new setting. When the current speed reaches the speed set by the pot, the letter ‘P’ will stop flashing and there will be a short beep (if enabled).


Since there is a small periodic window when the pulse width modulation (PWM) is turned off by the firmware in order to read the back-EMF, at full speed the reading will not indicate 99.9% but will achieve its maximum at around 98% or so.


Monitoring the input voltage

From the Main menu, press ‘Short R’ once and you will be taken to the display shown in  Menu 2. It consists of a ‘b’ (for battery) followed by three digits with a decimal point indicating a level from 00.0V to 99.9V, to monitor the battery. For good voltage accuracy, it is important that the +5V supply rail be precisely set using trimpot VR2.


In practice, with the supply rail to the microcontroller set at 5V, the level will not register any higher than around 40.1V. This is because the voltage divider used to derive the voltage reading consists of 33kohm and 4.7ohm resistors. The relatively high series resistance of 37.7kohm was chosen to avoid damaging the input of IC1 if the input voltage goes any higher than around 40V.


To go back to the Main menu, either press ‘Short L’ or press ‘Long R’. If you press ‘Long L’, you will set the low-battery alarm level to 91.6% of the current voltage input level (and then return to the Main menu). This is a shorthand way to set the low-battery alarm level when you know that the batteries are fully charged.


For a typical 12V battery, they are fully charged at around 13.8V (with charger connected) and should not be discharged beyond 11V.


Press ‘Short R’ to go to the low battery alarm level menu.


Setting the low-battery alarm
From the Main menu, press ‘Short R’ twice. You will be taken to the low-battery alarm level menu as shown in Menu 3. It consists of an ‘A’ (for alarm) followed by three digits, which indicate a level between 00.0V and 41.6V. This will show the current setting of the  low-battery alarm or rather, the voltage level below which the alarm will sound (if enabled).


Whenever the input voltage is below this level, the display will flash (with increasing  frequency as the voltage drops) while if the alarm sound is enabled, there will be a flash from LED1 and a beep. 


To set the low-battery alarm level press ‘Long L’. The ‘A’ will start flashing and then the  low-battery alarm level can be modified by adjusting the pot setting. To turn the alarm off completely, simply set the level to 00.0V.


When you have reached the required level, simply press any button and the level will be recorded (and stored in EEPROM). Then there will be a beep (if enabled) and you will be taken to the Main menu.


Note that the motor will be turned off automatically when setting the low-battery alarm level.


Setting the PWM frequency

From the Main menu, press ‘Short R’ three times. You will be taken to the frequency menu, as shown in Menu 4.


This consists of an ‘F’ (for frequency) followed by three digits with a decimal point indicating a level between 0.48khz and 7.81khz. This is the current PWM frequency. As the frequency increases, the resolution of the PWM setting decreases.
 

At 0.48khz (actually 488hz) the resolution is 10 bits. This decreases to six bits at 7812hz. Thus, the resolution is at worst six bits or 64 levels, and at best 10 bits or 1024 levels.

While in this menu, press ‘Long L’ and you will be able to set the frequency. The ‘F’ will start flashing and then the frequency will be modified according to the pot setting.


When you have reached the required frequency, simply press any button and the level will be recorded and stored in EEPROM. Then there will be a beep (if enabled) and you will be taken to the Main menu.


Note that the motor will be automatically turned off when setting the frequency.


Enabling and disabling audible cues

From the Main menu, press ‘Long L’. You will be taken to the settings menu as shown in Menu 8. It consists of ‘A’ (for alarm) followed by either ‘0’ or ‘1’ (0 = disable, 1 = enable) and a ‘b’ (for beep) followed again by either ‘0’ or ‘1’ (0 = disable, 1 = enable). In this menu, pressing ‘Short L’ will toggle the alarm setting (enable/ disable) and pressing ‘Short R’ will toggle the beep setting (enable/ disable).


When the alarm setting is disabled, there will be no beeping when the input voltage falls below the alarm level. There will still be a warning flashing on the display, however. To  disable the latter, simply set the alarm level to 00.0V. When the beep setting is disabled, audible beeps emitted by the firmware at certain points (as when setting certain values or when the desired speed is reached) will be blocked.


If you do not want any beeping from the piezo buzzer, simply set ‘A’ to 0 and ‘b’ to 0. In this menu, pressing ‘Long L’ will take you to the Reset Menu, as explained below. Pressing ‘Long R’ will take you back to the Main menu.


Reset menu
From the Main menu, press ‘Long L’ twice. You will be taken to the Reset Menu, as shown in
Menu 9. 


It consists of the letters ‘CL’ (for clear) followed by two digits and a decimal point of the form X.X. The X.X represents the current version of the firmware, which for this release stands at 3.0. It is possible that future releases of the firmware will add new features or

refinements to critical sections of the code.


While in this menu, press ‘Short L’, ‘Short R’ or ‘Long R’ to go back to the Main menu.


Note, however, that pressing ‘Long L’ will reset all settings to the default values and the speed controller will lock until power is turned off. When a power-on reset next occurs, the default values for the frequency, low-battery level alarm and audible beeps will be restored.


This feature is useful for initialising the firmware variables and for making sure that you begin from a known state. Most of the time, it will not be used.


Memory speed mode

From the Main menu, press ‘Short L’ to enter memory mode. The display will be as shown in
Menu 6.


It consists of the letter ‘C’ (for constant) followed by a digit from 1 to 8 (indicating one of the eight available memories), in turn followed by two dashes.


Now adjusting the pot will select one of the eight memories. When the pot becomes stable for a short period, the speed of the motor will be set according to the current value of that memory.


The display will change as shown in Menu 7. This display still consists of the letter ‘C’  followed by the number of the memory, but it will then have a decimal point followed by two digits representing the speed percentage from 00% to 99% (the first two letters will flash
until the set speed is reached).


Adjusting the pot will now change the selected memory and the speed setting will be recalled from one of the eight stored memory speed settings (after a short beep, if enabled).


To go back to normal mode, where the motor speed is controlled directly by the pot, simply press any key, long or short.


Setting the memory

To set one of the eight memory speed values you press ‘Long R’ from the Main menu. The display will change as shown in Menu 5. It consists of the letter ‘C’ (for constant) followed by a digit from 1 to 8 (indicating one of eight memory settings) and two dashes.


Now adjusting the pot will select one of the eight memory settings to store the current value of the speed of the motor.


When the pot becomes stable for a short period, the speed of the motor will be stored at that

particular memory. This can be recalled later by entering memory mode, as explained in the previous section.


There will be a short beep (if enabled), indicating that the value has been stored and you will be taken back to the Main menu.



EPE

3 comments:

  1. I am Hamid Manzoor.
    Belong to Chakwal.
    Where do you live.
    and Mr Muhammad Zohaib what is your e-mail address.

    ReplyDelete
  2. Situs Agen Judi SBOBET, Agen SBOBET Terbesar, Agen SBOBET Dengan BOnus New Member, Agen SBOBET Bola Online, Judi Bola Deposit Termurah, Bandar SBOBET CS 24 Jam, Judi Online SBOBET, Daftar SBOBET Dengan Mudah, Cara Daftar Judi SBOBET, Bonus Besar Judi SBOBET, Judi SBOBET Deposit Pulsa, Judi SBOBET Terbaik, SBOBET Sepak Bola, Main Judi Bola Online SBOBET Sekarang, Judi Tembak Ikan Joker123, Tembak Ikan Joker123 Deposit Termurah, Judi Sabung Ayam Bonus 8x Win, Sabung Ayam Live Streaming, Judi Adu Ayam Online, Judi Sabung Ayam Online, Tembak Ikan Online Termurah, Game Ikan Deposit Termurah, Game Ikan Deposit Pulsa, Game Ikan Bonus Deposit, Game Ikan Dengan Jackpot Besar

    Judi Tembak Ikan Online

    bonus besar Sepak Bola

    Bandar judi Sepak Bola

    Judi Tembak Ikan Online

    bonus besar Sepak Bola

    Bandar judi Sepak Bola

    game online uang asli indonesia

    ReplyDelete