Connect with us

micro chip info

Discussion in 'Microcontrollers, Programming and IoT' started by hamonza, Mar 10, 2011.

Scroll to continue with content
  1. hamonza

    hamonza

    7
    0
    Mar 10, 2011
    hey guys

    i am new to microprocessors can anyone please tell what does the PWM module and the ADC module do in a micro in relation to running a DC motor

    thanks
     
  2. rob_croxford

    rob_croxford

    262
    0
    Aug 3, 2010
    The ADC module of a microcontroller can be hooked up to a potentionometer... the variable voltage is then converted to a digital voltage (level dependant on the resolution of the ADC) this digital value can then be used by the PWM module to set the duty cycle of the PWM signal. This signal (with a few external components) can be used to control the speed of a DC motor.
     
  3. hamonza

    hamonza

    7
    0
    Mar 10, 2011
    hey thanks for that
    so yo know where i could find a schematics for running a dc motor through a microchip in other words speed test of a dc motor
     
  4. rob_croxford

    rob_croxford

    262
    0
    Aug 3, 2010
    All you really need is a FET with a gate to drain resistance high enough that it will drop all the way to zero. Either that or a pull down resistor that goes to -5 volts on the gate pin of the FET.

    Like this:

    Imagine that pin five is your PWM output from the pic and the motor to be in paralell with the diode.
     

    Attached Files:

    Last edited: Mar 11, 2011
  5. hamonza

    hamonza

    7
    0
    Mar 10, 2011
    PWM micro schematics

    hey guys can anyone help me with sample schematics to run a DC motor (speed control) with a 18pin pic18F2550 or any 18 pin micro
     
  6. rob_croxford

    rob_croxford

    262
    0
    Aug 3, 2010
    Exactly the same as the schematic posted early however the gate pin of the FET is connected to the PWM output of the pic
     
  7. hamonza

    hamonza

    7
    0
    Mar 10, 2011
    hey thanks for that rob will it also be possible to use inbuilt DAC to drive a panel meter (0 – 200mV input) or similar???
     
  8. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,482
    2,830
    Jan 21, 2010
    Quite probably. The DAC may have an output ranging from 0 to 5V, you should use that full range so that you have the most "bits" to play with. Depending on your panel meter, you may be able to add a series resistance, or use a voltage divider to reduce the 0-5V range to 0-200mV. In either case, you will probably want to have an adjustment so that the full scale reading is achieved accurately.

    If you have more information about the panel meter (input impedance - if digital, or the current required for full scale deflection - if analogue) then we can suggest exactly what you need. Oh, we would also nsed to check the specs of the device you're using to se what range of outputs it has.
     
  9. hamonza

    hamonza

    7
    0
    Mar 10, 2011
    oh ok i get what you mean ill post you back the info about the panel meter in the meantime can you let me know what kind of specs you need ???
     
  10. rob_croxford

    rob_croxford

    262
    0
    Aug 3, 2010
    Specs of the PIC for instance how many i/o pins? Resolution of the DAC? clock frequency? etc..
     
  11. hamonza

    hamonza

    7
    0
    Mar 10, 2011
    Microcontroller ATmega328
    Operating Voltage 5V
    Input Voltage (recommended) 7-12V
    Input Voltage (limits) 6-20V
    Digital I/O Pins 14 (of which 6 provide PWM output)
    Analog Input Pins 6
    DC Current per I/O Pin 40 mA
    DC Current for 3.3V Pin 50 mA
    Flash Memory 32 KB (ATmega328) of which 0.5 KB used by bootloader
    SRAM 2 KB (ATmega328)
    EEPROM 1 KB (ATmega328)
    Clock Speed 16 MHz
     
  12. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,482
    2,830
    Jan 21, 2010
    What you want is a divider coming from the ADC output to ground with a total resistance of between 5k and 10k, and with the lower resistor approximately 1/24th of the value of the upper one.

    The ADC will swing from 0 to 5V and the voltage across the lower resistor will swing from 0 to 0.2V If you need to adjust this to get an exact reading, you should reduce the value of the upper resistor by about 5% and place a trimpot with total value about 10% of the resistance of this resistor in series with it. e.g. if the upper resistor were 4k7, then you might want to reduce it to around 4k4 and place a 500r pot in series with it.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-