Connect with us

Control the amount of current

Discussion in 'General Electronics Discussion' started by hemil, Jun 27, 2014.

Scroll to continue with content
  1. hemil

    hemil

    4
    0
    Jun 27, 2014
    Hi,
    I wanted to know if there was a way to control the amount of current flowing through a circuit from a computer or a microprocessor? You know,like there's a scroll bar and if I shift it to the right,the current passing through my circuit will increase?
    I some experience working with electronics,enough to know the basics,but that's it.
    I'll be helpful if you could help.
    Thanks.
     
  2. Arouse1973

    Arouse1973 Adam

    5,164
    1,080
    Dec 18, 2013
    This sounds interesting. Can you explain a bit more about what you want to do and circuitry you want to control.
    Adam
     
  3. hemil

    hemil

    4
    0
    Jun 27, 2014
    What I have is a standard electric motor and I want to control the amount of turns it takes using my computer and I don't know if there exists some circuit/code through which I can control the amount of current it receives.
    For eg,it controls the amount of rpm,or the amount it can open in a valve,or the amount of deflection.
    Something like that.
    Sorry if i'm not clear
     
  4. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    Anything can be done!
    Do you want this to be controlled by the computer... or with a potentiometer or buttons from a microcontroller?

    Regardless... if you are building the power supply yourself, you will need to measure the voltage drop across a shunt resister in series with your load to determine the current through the load.
    You will then need to increase or decrease the supply voltage to increase or decrease the current through your load. This can be done automatically with feedback to you power supply, or manually.


    (For the computer part of the circuit... I would recommend using a micro-controller as the brain, that will accept input either via usb, or serial to adjust the output current of your power supply.)

    *I like to edit my posts a lot...
    My first thought is a bit of a hack...
    Using a microcontroller's PWM, and analog input. Connect the PWM pin of the MCU to a FET or power transistor that will feed your load. Connect a shunt resistor between the load and ground. Connect the input of an opamp to the + side of the shunt resistor. Do some math to determine: your max supply current which will in-turn provide the largest expected voltage drop on the shunt resistor which you may need/want to amplify to have the microcontroller read a high analog value. Program the Microcontroller to increase the duty cycle on the PWM to increase current, or decrease PWM to decrease current to reach the desired current (which translates into a desired analog input value between 0-100%). Your microcontroller will have additional inputs to allow for serial input data to be transmitted from your computer. The read serial data will set the current 'target' current that your Microcontroller will aim for.
    Please note that this is a bit of a hack... and that the speed of the micro controller or the written program could result in adjustment times to be too slow! Please also note that this is the opinion of someone inexperienced in the field, there may be parts that I am not aware of yet that will provide better options.
    (Electronics is a like an RPG... You start to play and think you have a good line-up, then BAM! Some kid across the table lays down a part and annihilates your setup... You then look into said part and it becomes a favorite for a while until someone repeats the process. You will always learn and always evolve)
     
    Last edited: Jun 27, 2014
    hemil likes this.
  5. hemil

    hemil

    4
    0
    Jun 27, 2014
    Thanks gryd3.I'll try out what you said.
    I wanted it to be completely automatic without any buttons and such. Say I want to change amount of voltage from say
    0->25->86->39->47 %,then I'll write the code in the computer or the MCU,and it'll happen automatically,and I'll be standing 10 feet away.
    If anyone else has any thoughts,they'll be appreciated :)
     
  6. Arouse1973

    Arouse1973 Adam

    5,164
    1,080
    Dec 18, 2013
    For the current to change in the load you would have to do one of two things, change the applied voltage or change the resistance. I don't see how this can be done with a transistor being operated from a micro. The micro will output the same level regardless of PWM duty cycle and the transistor will switch fully on, you will only measure the maximum current at that time.
    Adam
     
  7. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    Yes, I had forgotten that you would need to filter the output to the load... or the input to the Micro.
    Changing the duty cycle of a PWM will change the average voltage which would therefore change the average current through the load.
    PWM is often used for motor control, and you can find examples in cordless drills and cpu fans. Heck, even Class-D amplifiers use PWM.

    I did miss the fact that measuring the PWM output with an analogue input would result in inaccurate readings without the use of a filter to average the PWM to a closer representation of an 'analogue' value.

    *Edit: Class-D information
    http://www.maximintegrated.com/en/app-notes/index.mvp/id/3977

    *Edit again:
    As I understand it, Micros have a small integral capacitor that they charge and discharge to determine the analogue value. I wonder if an external filter is needed if the PWM is at a reasonably faster frequency than the poll-time of the analogue input.. I will need to experiment!

    *Edit again again:
    More Links!
    Someone wanting to read the averaged value of PWM with an analogue input:
    http://forum.arduino.cc/index.php/topic,15709.0.html
    tl;dr use a low pass filter.

    More PWM info:
    http://www.thebox.myzen.co.uk/Tutorial/PWM.html
     
    Last edited by a moderator: Jun 28, 2014
  8. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    From earlier posts, I was thinking you would be controlling something line a motor and wanted to control current. Please remember that if you apply a constant voltage to a motor, and the motor encounters more resistance (ie, an electric motor travelling up-hill, or stalling...) then the current draw of the motor will increase. With a constant current supply, you could grab the output shaft of the motor, and the supply voltage will compensate to keep the current draw down.
     
  9. Arouse1973

    Arouse1973 Adam

    5,164
    1,080
    Dec 18, 2013
    If you did it in software and measured the peak current and then worked out the average time from your duty cycle. That would work
    Adam
     
  10. Arouse1973

    Arouse1973 Adam

    5,164
    1,080
    Dec 18, 2013
    Why would taking a motor up a hill cause it to draw more current?
     
  11. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    It's not the act of taking up the hill as much as having it 'drive up-hill'... the motor needs to exert more force.
     
  12. BobK

    BobK

    7,682
    1,686
    Jan 5, 2010
    You are not clear. It sounds like what you really want to control is how far the motor moves something, not the current to the motor. If that is the case, you want a rotary encoder or the motor shaft, which tells the computer how far the shaft has moved.

    Bob
     
  13. (*steve*)

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

    25,391
    2,775
    Jan 21, 2010
    ...or use a stepper motor.
     
  14. hemil

    hemil

    4
    0
    Jun 27, 2014
    Sorry about the ambiguity,I thought the amount of current supplied will control the amount of rotations.
    What I want to do is to control how much the motor turns.how will i go about doing that?
     
  15. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    If you want to control the number of rotations, or fine control over the rotation speed, you will need to:
    a) use an encoder for feedback to tell your circuit how far the motor has moved, and adjust accordingly.
    b) use a servo (There are continuous rotation hacks for many popular servos)
    - A servo accepts a pulse input to dictate it's motion and has it's own feedback so it will move reliably most of the time.
    c) use a stepper motor.
    - A stepper motor has a specific number of steps for each rotation, do the math and feed it however many steps you want as fast as you want to control position and speed. (There is no feedback... so if the motor is under too much load, it may miss or skip steps resulting in the motor turning more or less than intended.)
     
    Supercap2F likes this.
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

-