using a picaxe to produce 0 - 5V,

Discussion in 'Embedded Systems and Microcontrollers' started by justinpugh1, May 21, 2012.

  1. justinpugh1

    Thread Starter New Member

    May 21, 2012
    HI all..

    I`m trying to work out how to produce a Voltage, 0 - 5 V

    The Voltage will need to be controlled with two buttons. Essentially up and down. There needs to be 5 steps. Therefore, 1st step = 1V 2nd step = 2V,,,,,,5th step - 5V

    The voltage will be used to control a Brushless motor controller. The BM controller has a potentiometer attached to control speed but also has an alternative method of speed control via a pin connection which allows the user to control the speed by supplying a voltage 0 - 5V.

    I am open to anyway of doing this. I don't want to use a potentiometer (ie mechanical) but I could use a digital Pot.

    It has been suggested that this could be relatively easy using a PIC micro controller,,but I`m very very,,,,,VERY Novice!

    If some one has an easy work around with few components, Id appreciate
    your help.

    However if this can be done with a PIC alone and no POT then please could you tell me how, which one and what would I need to do it. ie program boards etc.

    Thanks in advance for any help.
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    You could do this with a PWM output followed by an RC.

    That means you toggle a pin with a pulse wave, and a resistor and cap extract the average DC value to send to your motor controller. You get lots more steps then 5 this way.

    It can be slow to change but you shouldn't notice with a motor as the controlled element.
  3. cravenhaven


    Nov 17, 2011
    The M2 parts like the 08M2 have a DAC built in. I havent used it but I think the resolution is quite low (5 bits from memory).
  4. be80be

    Senior Member

    Jul 5, 2008
    31 steps from 0 to 5 volts is what it can do
  5. jwilk13


    Jun 15, 2011
    I like the PWM solution. I use PIC18FxxK20 series devices, and their PWM resolution is 10 bits, which sounds like more than you need. It could also give you the 5 steps you described above if you want. Enabling the PWM properly (setting up registers) and incrementing the value in CCPR1L will give you 8 bits of resolution. Simply set it up to increment CCPR1L on a button press and decrement it on the other button press and you'll have 255 different speeds.

    You'll have PWM at a specified output pin (RC2 is a typical one), and all you have to do is low pass filter that as Ernie described and you would have your analog voltage. Total components would be a PIC, some bypass caps, a voltage regulator (if needed, for power to the PIC), resistor and capacitor for LPF, two buttons.