Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Control 80V DC Motor/Bulb Using Netduino 2


  • Please log in to reply
21 replies to this topic

#1 xmen

xmen

    Advanced Member

  • Members
  • PipPipPip
  • 72 posts

Posted 24 July 2014 - 03:00 AM

I'm very new to electronics and I really like netdiuno, it can do exactly what I need. But I dont know how, at all. I will be very thankful if anyone can help. So I've attached an image to explain in details what I want to do.
 
I want to control a motor or bulb using 80V DC. I have DC output coming, but I dont know where to attach its +ve and -ve wires in netduino, or custom build something ?
 
In more simple way, when I press Start/Stop button, it should execute code something like this
 
 
 

static boolean MotorState = false;
static void StartButton()
{
  MotorState = true;
  while(MotorState)
  {
      motor.Start();
      Thread.Sleep(200);
      motor.Stop();
      Thread.Sleep(200);
      motor.Start();
      Thread.Sleep(10);
      motor.Stop();
      Thread.Sleep(100);
       //some sort of pattern
  }
}
static void StopButton()
{
  MotorState = false;
  motor.Stop();
}


Thanks

Attached Files



#2 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 24 July 2014 - 04:33 AM

First answer: DO NOT do it!

Working with voltages above, let's say, 30V can be really harmful for your health. Several good practices *should* be applied for a safe operation, and *must* be applied whereas the final project require a certification (e.g. CE in the EU).

 

Second answer: DO NOT do it!

You can't drive even a small motor directly with a Netduino (or Arduino, I mean). The absolute maximum voltage on almost any pin is around +5V. Moreover, the current flowing through any pin is *very* limited to some milli-Ampere. A motor typically requires at least hundreds of mA.

 

Third answer: since you have no experience with electronics, possibly use another motor working at a low voltage (e.g. 12V). Of course, the power source must follow the motor requirements.

Then, purchase any suitable DC-motor shield so that your final task is just wiring some parts together and start coding. Browse within this forum, because for sure there are people having driven motors with a Netduino.

 

Now, my questions to you...

In your code snippet, the "pattern" contains several pretty short intervals. Are you sure that the motor inertia is so low to be able to follow the expected timing?


Biggest fault of Netduino? It runs by electricity.

#3 xmen

xmen

    Advanced Member

  • Members
  • PipPipPip
  • 72 posts

Posted 24 July 2014 - 08:35 AM

Thank you Mario. As I mentioned, it can be either a motor or a bulb. So for beginning, I would surely use a bulb to know how things are going. Yes 80V are too much, but I wrote it because I have a range 8-80V. Writing max V seemed correct. If motor will be too much, I will simply use the a bulb. Just for demonstration.

After browsing through many sites, I've seen if more voltage is required, there is some kind of hardware-driver that takes high input and runs the motor and that driver can be controlled by netduino.

About the pattern, thats exactly what I thought, because motor needs time to catch up the speed or rotation. I can not change the pattern but I think I'm stick to bulb now.

Could you please help, assuming motor is a bulb and DC output is 12V(external, not from netduino).

Thanks again :)

#4 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 24 July 2014 - 12:01 PM

So,

  • *IF* your demo will use a *safe* voltage, let's say 12V, and
  • *IF* your demo will drive a normal bulb, then

you can try this simple circuit I made time ago:

http://www.tinyclr.i...-power-led.aspx

It's in Italian, but the circuit is trivial.

 

Please notice, the above recommendations are not a joke!

The circuit is NOT designed for working at high voltages (up to 30V). Moreover, a motor requires extra hardware (due the inductive part) which a bulb or a led does not have.

 

Good luck!


Biggest fault of Netduino? It runs by electricity.

#5 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 24 July 2014 - 12:03 PM

Could you please help, assuming motor is a bulb and DC output is 12V (external, not from netduino).

 

In this simple scenario, i.e. controlling 12V DC bulb from Netduino, you can use just a transistor switch.

 

You'd need to calculate the load current IL = P/V, where P is the bulb power rating and V is the voltage, so for example for a small 4W automotive light bulb the current is 4/12 = 0.33 A. Then you select a transistor that can handle such current, preferably a MOSFET. In this particular case of relatively small current, you should be able to find a suitable MOSFET that has 'logic level' control, i.e. gate voltage threshold <3V, so you can control it directly from [3.3V] Netduino pin. Otherwise, you'd need another 'general purpose'/'small signal' transistor (BJT or MOSFET) to control the 'big' power transistor (which typically requires ~10V gate voltage for the rated current).

 

Regarding the DC motor control: if you only need simple control, i.e. on/off switch, then the 'bulb switch' circuit can be used in the same way, assuming the transistor has appropriate current rating; and it is recommended to add a flyback diode (to handle current spikes generated when motor changes its state). Otherwise, I would consider using a specialized motor driver ("H-Bridge"), as suggested by Mario. (You can use H-Bridge for the bulb too.)

 

There is a lot of information available on the Internet about how to control a transistor switch from a microcontroller output, including complete circuit schematic, part selection etc.



#6 xmen

xmen

    Advanced Member

  • Members
  • PipPipPip
  • 72 posts

Posted 24 July 2014 - 05:42 PM

Mario : Thanks for the info and cautions. I watched the video inside the link you've provided. Seems very nice project there. But I dont know whats going on there, what are ICS for, is there something I can start with ? something for begginners, or maybe if its okay for you, you can draw wire lines to the picture I attached to first post.


CW2 : Thank you too, but Im very sorry. I'm very new to these things, so half of things you said, just bounced off my head. But yes I'm learning through web sites, as always not easy. :)

#7 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 24 July 2014 - 07:31 PM

CW2 : Thank you too, but Im very sorry. I'm very new to these things, so half of things you said, just bounced off my head. But yes I'm learning through web sites, as always not easy. :)


There is really no need to apologize. How about this article? (replace Arduino with Netduino, and of course the application code has to be different, but the principle remains the same).



#8 xmen

xmen

    Advanced Member

  • Members
  • PipPipPip
  • 72 posts

Posted 25 July 2014 - 12:37 AM

There is really no need to apologize. How about this article? (replace Arduino with Netduino, and of course the application code has to be different, but the principle remains the same).


Oh my god, dude you are awesome!! Thank you soooooo much. This is exactly what I'm trying to do, except buttons.

Thanks again

#9 xmen

xmen

    Advanced Member

  • Members
  • PipPipPip
  • 72 posts

Posted 25 July 2014 - 01:22 AM

CW2: I have few questions, do I need PWM ? I just need to turn on and off, not controlling the voltage.

and if I dont need PWM, how do I suppose to send 5V to MOSFET gate to complete the circuit ?

#10 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 25 July 2014 - 07:29 AM

Well, you could use PWM, but for simple on/off control it is easier to start with a digital pin:
 

public static class Program
{
  public static void Main()
  {
    // Motor/Bulb connected to D3
    var motor = new OutputPort(Pins.GPIO_PIN_D3, false); // Initially off

    while(true)
    {
      motor.Write(true);   // On
      Thread.Sleep(500);
      motor.Write(false);  // Off
      Thread.Sleep(500);
    }
  }
}

Technical notes about the RFP30N06LE transistor (datasheet pdf) used in the bildr.org article:

  • It has maximum voltage 60V - enough for 12V bulb, but not enough for 80V motor.
  • It can be controlled directly from Netduino pin, it requires at least 2V gate voltage (Netduino has 3.3V output).
  • It is rated for 30A continuous current, it can switch about 20A at 3.3V gate voltage. You'd need higher gate voltage for higher load current, i.e. another small transistor to control this power MOSFET.


#11 xmen

xmen

    Advanced Member

  • Members
  • PipPipPip
  • 72 posts

Posted 25 July 2014 - 08:11 AM

Thanks, now few things are confusing me. If you look at the picture from the following link.
http://bildr.org/blo...o-lightbulb.png

My question is, why we are giving -ve to Ardiuno board GND, if we are only using pin3 ?
Other question is, when I do wiring of electronic wall board(the one where we plug the phone chargers). I put +ve to the switch, and -ve always connected to the socket. So when the switch is off, it just breaks the +ve. However, its completely opposite in that article, +ve is constant while we are switching off the -ve. I dont know but that doesn't feel right to me. Am I missing something ?

#12 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 25 July 2014 - 08:22 AM

The voltage naming notation is a little bit confusing in the article - just use "GND" (0V) for the black wire and and "+V" (12V .. 80V) for the red one. The transistor in the circuit act as a switch that terminates or connects the load to GND (ignore the voltage numbers in the picture):

 

tr8.gif

 

 



#13 xmen

xmen

    Advanced Member

  • Members
  • PipPipPip
  • 72 posts

Posted 25 July 2014 - 08:35 AM

I couldn't understand the picture clearly. But the drain is +ve in this one, however its -ve in that article. Can I switch things ?

one more question, what would happen if I do this ?

 

rfp30n06le_arduino_lightbulb.png



#14 k_madsen

k_madsen

    Member

  • Members
  • PipPip
  • 22 posts
  • LocationEsbjerg Denmark

Posted 25 July 2014 - 08:43 AM

I'm very new to electronics and I really like netdiuno, it can do exactly what I need. But I dont know how, at all. I will be very thankful if anyone can help. So I've attached an image to explain in details what I want to do.
 
I want to control a motor or bulb using 80V DC. I have DC output coming, but I dont know where to attach its +ve and -ve wires in netduino, or custom build something ?
 
In more simple way, when I press Start/Stop button, it should execute code something like this
 
 
 


static boolean MotorState = false;
static void StartButton()
{
  MotorState = true;
  while(MotorState)
  {
      motor.Start();
      Thread.Sleep(200);
      motor.Stop();
      Thread.Sleep(200);
      motor.Start();
      Thread.Sleep(10);
      motor.Stop();
      Thread.Sleep(100);
       //some sort of pattern
  }
}
static void StopButton()
{
  MotorState = false;
  motor.Stop();
}


Thanks

 

go to your local elektrician an get som relayes,
Here in DK it is only for for educated peoble to assamble elektroniks with a higher voltage than 36V.
You need a relay area that control the 80v and with 3.3v aktivate line.
Its a simple and good project. If you is fooling around it could make your fire incurence worth less.



#15 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 25 July 2014 - 11:50 AM

You cannot switch voltage polarities, you'd need to use different kind of transistor (N-channel vs. P-channel MOSFET).

 

Technically, you can change values, as long as the difference is the same. Voltage is electrical potential difference between two points, so 0 .. 60V is the same as -60 .. 0V which is the same as 37.2 .. 97.2V (because 60 - 0 = 0 - (-60) = 97.2 - 37.2 = 60V); but switching wires 60 .. 0V is different (0 - 60 = -60V, negative). You can destroy electrical parts with wrong voltage.

 

If you don't connect Netduino ground and your power supply ground, the circuit most likely will not work (unless there is a common ground connection, for example when you power the Netduino from the same power supply as the motor/bulb).

 

By moving the resistor, you've completely changed the circuit behavior - previously, the resistor (between gate and ground, "pull-down") ensures safe 'off' state, it means the switch is guaranteed to be off until you set Netduino pin to high. Now, the resistor in series (between Netduino pin and gate) just limits the current - it does not do any harm, but it is also useless, because MOSFET is driven by voltage, not by current (you'd need this resistor for BJT transistor, to limit base current). Additionally, you've lost that 'safe-off' feature, and you could get unexpected behavior, because Netduino pin is in 'floating' (high-impedance) state during startup, until you create the OutputPort instance, thus switching it to digital output mode.

 

If you really want to understand how the electronic works, have a look at sites like All About Circuits or Electronics Tutorials, they can explain it much better than me :)



#16 xmen

xmen

    Advanced Member

  • Members
  • PipPipPip
  • 72 posts

Posted 25 July 2014 - 12:25 PM

whoa, so I need Positive-Channel MOSFET, right ? Because I want to control positive. Okay if there is positive one, whats the advance of N-Channel one ? Is it cheaper ?

 

Thanks for the links, I will read further more on that site :)



#17 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 25 July 2014 - 12:52 PM

Yes, if you want to control the positive wire, you'd need P-channel MOSFET. The control logic is inverted, low gate voltage is 'on', high gate voltage is 'off'; and there should be a "pull-up" resistor between gate and +V to ensure safe 'off' state.

 

Yes, N-channel MOSFET is cheaper than P-channel; N-channel is a little bit better (lower resistance, which means lower power losses, which means smaller heatsink : )



#18 xmen

xmen

    Advanced Member

  • Members
  • PipPipPip
  • 72 posts

Posted 25 July 2014 - 01:02 PM

Yes, if you want to control the positive wire, you'd need P-channel MOSFET. The control logic is inverted, low gate voltage is 'on', high gate voltage is 'off'; and there should be a "pull-up" resistor between gate and +V to ensure safe 'off' state.

 

It should look like ?

-ve wire going to bulb and GND of netduino

+ve wire going in MOSFET's Source, along with pull up restistor attaching to pin 3

MOSFET's Drain going to Bulb's +ve



#19 xmen

xmen

    Advanced Member

  • Members
  • PipPipPip
  • 72 posts

Posted 25 July 2014 - 01:07 PM

Is this right ? (oops, +/- signs are wrong, but color is right)

rfp30n06le_arduino_lightbulb.png



#20 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 25 July 2014 - 01:54 PM

There is one major problem with interfacing P-channel MOSFET to a microcontroller when switching [relatively high] voltage - when the control circuit closes, the switched voltage (i.e. 12, 60 or 80V) is applied to the microcontroller pin and it will be destroyed, because Netduino max pin voltage is less than 10V.

 

You have to use second N-channel MOSFET (or NPN BJT) placed between Netduino pin and P-channel MOSFET gate to control it. The proper circuit looks like this:

 

MOSFET_high_side_driver.png

 

You can replace Q3 + R3 with N-channel MOSFET (use R3 as pull-down, connected between gate and ground to ensure safe 'off' state).

 

I would recommend you to get a few different transistors and try low voltage (3.3V - 5V) circuits first, switching simple loads like LED and evaluate the possible configurations. After you understand how they work, you can 'upgrade' to higher voltage and current. Random messing with wires without understanding the basics is not going to end well...






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.