A DIY Electronic Speed Control ? is that viable?

  1. A "DIY" Electronic Speed Control ? is that viable?

    The concept of 3-stage brushless motors does seem very simple to me. Simply power the 3 different stages at different times, use 2 at the same time and the 3rd as a magnetic sensor. When the sensor goes on you flip the stages, one goes off and other on, one stays the same.

    Why is this concept so hard to integrate into programming? Do I really need to spend 100$ to buy an electronic speed controller, can't I just integrate it somehow into an arduino using transistors and resistors etc.

    Oh and why can't an arduino use an I/O as both input and output at the same time?

    When I am programming I always need to define it as EITHER input or output, but if they are designed to work as both, why can't I incorporate that into the code? Is the arduino assembly language too limited to allow for input and output in a port at the same time?

    I am talking about when the electromagnet changes from being power to becoming a sensor, it shouldn't be as hard as it is, but for some reason this is very un-user friendly technology.

    I simply don't get why you cannot code an ESC into a microcontroller using perhaps a transistor to amp up the power on each of the three stages.

    Any thoughts on this?
  2. jcsd
  3. sophiecentaur

    sophiecentaur 14,730
    Science Advisor
    Gold Member

    I don't see why this should be a problem in the software. Doesn't an Arduino handle Interrupts?
  4. An I/O device always uses one or the other at any given time. Live with it.

    As Sophie said, the Arduino has plenty of interrupt capability so you should have no problem creating your "DYI ESC" as you choose to call it.
  5. jedishrfu

    Staff: Mentor

    There could be a slight lag that prevents your motor from running efficiently or running fast enough. You're detecting a change of state and then required to switch something off and another thing on. A pure electronic solution will always operate faster than equivalent software.

    You may have to do some experiments as to how fast the CPU (arduino) can respond and act on an interrupt. It has to be faster and be completed before the next interrupt comes in.
  6. sophiecentaur

    sophiecentaur 14,730
    Science Advisor
    Gold Member

    The clock speed of an Arduino is in the region of 16MHz. That means delays in the order of a couple of microseconds, at the most. This can hardly be relevant when dealing with a few tens of Hz of motor supply. If that really turns out to be a problem then you would need to have a separate driver oscillator, controlled by the Arduino but that sounds like standing up in a hammock, to me.

    Look up the spec of the Arduino. It'll all be in there somewhere. Personally, I wouldn't rely on what you read here to determine your plan. You're the one who is investing time and money :biggrin: - it's just well-informed (mostly) guidance that you can get on PF.
  7. Yep but now it's starting to seem simpler to just the parts to make a pure non software ESC, it shouldn't be so hard buying the parts and following some cirquit map of an ESC. I'd rather have it perfect and smooth, since It'll be running on high voltage and high RPM, then at that speed this delay could start affecting and messing up the cycles bad.

    Btw thanks for the help guys, the arduino forum is pretty useless for electronics questions.
  8. I do however wish that a programming language and microcontroller system would exist that handles defining Ports as both outputs and inputs at the same time, you'd just choose in the beginning of a loop weather it's an input or output...

    maybe in the future, who knows.
  9. sophiecentaur

    sophiecentaur 14,730
    Science Advisor
    Gold Member

    Why ever would you want to do that? Most real circuits are either inputs or outputs- or the two functions would fight each other. You may need to take some feedback from a system which you are supplying with power (as in this case and many others) but that will involve two different 'wires' to and from the circuit. You can't be that short of connecting wires that you need to be multiplexing an input and an output - which is really what you're proposing.
    I think you need to reassess what you really need for this circuit. What actual hardware did you have in mind? (The fragment of circuit that would interface as you seem to propose.)
    On the processor, a port can't be the same thing (I and O) at the same time so what advantage is there in wanting to connect the same port to two parts of your circuit? In processor circuits, where there are hundreds of wires, it is common to use a Bus system and once IC will use it to send and receive - but at different times; never (?imo) at the same time.

    [Edit:I was thinking of the problems they have with Radio Transceivers and Radar sets where they need to use the same antenna for transmit and receive. It's a real pain to protect input from output.]
    Last edited: Dec 11, 2013
  10. I was never meaning sending and recieving AT THE SAME TIME. I was meaning interrupting the sending of voltage to recieve instead. A port sends out or recieves voltage, depending on what you tell it to do. But when creating a program, in said program(as far as my programming experience goes) you define the port as an output or input.

    What I am proposing is for the program to create loops that first define ports, inside the loops, as inputs or outputs, like in java f. ex.

    you do

    int i = 1

    then loop{ if i < eworijgaoij etc}

    but you can also define i inside the loop and do

    loop{ if int i < eag } and so fourth.

    Yes I know these are not actual programming samples but you get what I mean, the constants are defined when you want to, and they are not limited to being defined outside of loops or static functions.

    This is what I want for ports, I'd like them to be definable wherever you want in the program, so you could use an antenna for transmitter or reciever just how it suits you, or lol a magnetic loop as an electromagnet of electromagnetic sensor, depending on your loop or function. The advantage would simply be to reduce wire clutter...

    I have no idea if this exists or not, you have described that it does naming some "bus" system. But I i'm not sure that's like the thought I am describing. I hope you get what I mean as it may not be very clear.
  11. sophiecentaur

    sophiecentaur 14,730
    Science Advisor
    Gold Member

    It's a long time since I did any serious programming, using interfaces with the outside world, but processors are very fast, now and compilers can optimise speed. You seems to be confusing the software aspects of defining what ports produce or 'see' and the ports themselves. Where is the problem with looking at the signal on one port and then putting a signal out on another port? Why should that take any longer to execute?
    You may find that the Arduino forum is not as useless as you think, once you start thinking along the right lines. After all, they use Arduinos in many types of control systems. There is nothing magically different about a brushless motor.
    Are you familiar with the concept of Interrupts and Interrupt Handling? Object orientated programming languages make them much easier to deal with, I believe. They can be configured to have very high priority so, as I have said before, your worry about delays is quite unfounded (small fractions of a degree of phase jitter are of no consequence when you consider the inertia of a motor). Furthermore, I am not sure why your idea would prevent the same effect.
  12. I'm sure this delay has a significant effect when dealing with communication technologies if using a single port which is switching between inputs and outputs.

    but yes, that is true, you can simply use 2 ports instead of one

    also it is true that this delay probably does close to nothing to brushless motor performance.

    I am not familiar with the concept of interrupts but I will check it out, it may be what I am looking for, if not I might just think about this I/O problem some more and trouble myself.
  13. ESCs are super cheap, and my understanding the programing varies greatly between applications. I would be very very surprised to learn that at anything but very low RPMs the ESC does any monitoring of rotor position at all.

    Surely a magnetic field rotating at 35,000 rpm ( x3 from the FETs on/off perspective) has some unique challenges with respect to timing an electromagnetic field to "push" off of. Can't be some simple linear scale.
    Last edited: Dec 11, 2013
  14. sophiecentaur

    sophiecentaur 14,730
    Science Advisor
    Gold Member

    Haha - it's not the delay that messes up radio transceivers - it's burning out the receive circuits with massive transmitter powers. I was using the principle to point out the difficulties of communing up inputs and outputs. Basically, you have to switch them in and out (as with your project) and they, of course, use different circuits for each. That corresponds to different 'ports'.
    The nearest thing I can think of for what you are talking about would be an intelligent Comms port in which the Tx and Rx functions are shared by the same connection, as with Coax Ethernet transceivers. The Tx only transmits when the RX senses that the line is clear of other high level signals. That's done with dedicated circuitry - but the data rate is much higher than the poor old Arduino's clock rate even.
    Find out about Interrupts and I think you'll find out that they are the way to go.
  15. sophiecentaur

    sophiecentaur 14,730
    Science Advisor
    Gold Member

    I read this link which was interesting and put me right about a lot. It appears that they use a Hall sensor on motors where they want to have good control. I am sure some sampling at regular intervals of the emf in the 'off' coils of a sensor less motor could give Phase information and, thus, a measure of the error to enable control.
  16. As I read this it seems that you are thinking of the BLDC as a 3 phase stepper - and looking to feed it a straight DC pulse-- while that is feasible, these motors are typically controlled in PWM - with the Switching Frequency usually 20x the fundamental, being fed a sine wave - basically looking like 3 phase AC, variable voltage(current) and variable output frequency ..... this is probably why you are not finding much literature. I have not heard of this type motor being called a 3 Stage ( 3 phase yes) - so part of your problem in finding info is the language you are using.
    As for the Aarduino - you can post on Sparkfun or other "application" side sites.
    Regarding defining GPIO - as both INPUT and OUTPUT -- can you define a CIRCUIT that you would use in this case? Arduino uses ATMega uC chips typically - so that DS will tell you more about the "spec" at that level. But as mentioned before - I can not see a practical application of doing this.
  17. This link talks about Arduino processor IO capabilities.
    Looks like some Arduino Analog inputs can become digital inputs or outputs, but not PWM outputs. But there is no reason you can't connect each winding to both a PWM output and an analog input and dynamically control whether the PWM is driving or tri-stated (which is basically what you are asking for). It would require some external PWM to voltage controllers with tri-stateable outputs.

    Building a motor speed controller is a closed loop system and the system latency just becomes part of the loop equation.
  18. Arduinos can do PWM : http://arduino.cc/en/Tutorial/SecretsOfArduinoPWM. The question is how long will it take ( cycles) for the ATMega to change the output back and forth?

    Also - being related to switching a power circuit - any input even remotely connected will be noisy - useless, that is why sensing (inputs to the uC) are separate and dedicated.

    This is the trees for the forset thinking - that gets many academics delayed -- just because it CAN be done does not mean it sould or that is even makes sense. If you we switching a basic circuit like battery charge then battery sense - and want to save inputs, this is a slow, non time critical case - but real time control of a motor...ahhhh
  19. Now that you mention that, it seems wildly unpractical. No way to know when to switch, etc.
  20. haha -- Forrest for the Trees.... not forset! Should not sould... uh - I need help!
Know someone interested in this topic? Share this thead via email, Google+, Twitter, or Facebook

Have something to add?

Draft saved Draft deleted