Sinking vs Sourcing current with Arduino

Поділитися
Вставка
  • Опубліковано 8 вер 2024

КОМЕНТАРІ • 15

  • @arathorstarlight5517
    @arathorstarlight5517 3 роки тому +1

    Great video, the drawing helped a lot, thanks!

  • @mark8664
    @mark8664 2 роки тому

    I have been trying to control a higher voltage than 5 volts by connecting a PNP transistor to the Arduino but it doesn't seem to work. But Urika!!! I finally got it to work with using two transistors first an NPN and then a PNP!

    • @TasteTheCode
      @TasteTheCode  2 роки тому

      What doesn't work? You need to be more specific so I can help.

    • @mark8664
      @mark8664 2 роки тому +1

      @@TasteTheCode I was spacific enough but anyway what I was saying is that I was trying to use an Arduino to drive another part of my circuit that runs on 15 volts, that would burn up the Arduino so first I thought I could just use an NPN transistor to do that but it wouldn't work... This is going to be a very lengthy explenation so I will have to make a video myself.

  • @andygay7305
    @andygay7305 2 роки тому

    Very helpful! Can you also run current to an LED when sinking current and digital output is HIGH? If so, how would you wire that?

    • @TasteTheCode
      @TasteTheCode  2 роки тому

      That is exactly my example in the video :D

    • @andygay7305
      @andygay7305 2 роки тому

      @@TasteTheCode Sorry I'm confused then. I thought you switched the digital output to LOW in the code when the current was sinking? Overall I'm trying to figure out how to wire 4 different LEDs given the 4 cases: Turn on LED 1 only when current sourcing and driven High. Turn on LED 2 only when current sourcing and driven Low. Turn on LED 3 only when current sinking and driven High. Turn on LED 4 only when current sinking and driven Low.

    • @TasteTheCode
      @TasteTheCode  2 роки тому

      @@andygay7305 There are no 4 states with current sinking/sourcing. If the pin is driven HIGH, it presents the input voltage on the output. It can only be connected via the LED and its resistor to LOW so the current can flow. That is sourcing. In the other case, if the LED and its resistor are connected to HIGH already, the only way current can flow is if the Arduino is driven LOW so there is a potential difference. If the LED is already connected to HIGH and the pin is HIGH, they are both at the same potential and no current will flow so the LED stays off. I hope that this makes it clearer.

    • @andygay7305
      @andygay7305 2 роки тому +1

      @@TasteTheCode Thank you so much for your help. I just found out the part of the example I was giving above was a trick question. Now it makes perfect sense!

    • @TasteTheCode
      @TasteTheCode  2 роки тому

      @@andygay7305 Awesome! I'm glad you figured it out!

  • @nayrbsworld3048
    @nayrbsworld3048 Рік тому

    is it the same wiring in the the plc?

    • @TasteTheCode
      @TasteTheCode  Рік тому

      What plc? I'm not sure that I understand your question...

    • @nayrbsworld3048
      @nayrbsworld3048 Рік тому

      @@TasteTheCode i mean wiring a d.i. in PLC programmable logic controller like Allen Bradley PLC.

    • @TasteTheCode
      @TasteTheCode  Рік тому

      @@nayrbsworld3048 I'm not familiar with those but they should be just glorified microcontrollers so the wiring should be the same. It is best to consult their manual or documentation.