Arduino level conversion boost output driver 9v/12v element

Source: Internet
Author: User

Reason

There are a number of tutorials on the network that allow the Arduino 5V level to be converted to 3.3V levels, and to communicate with the chips working in 3.3V. But if you want to drive a chip above 5V, you can't find the tutorial. So today I'm going to introduce a way to get Arduino's output port to drive an electronic component that needs 5~12v input. The following is an example of 12V.

Effect
    • The ability to achieve one-way (from Arduino to 12V chips) for communication purposes
    • The level of the Arduino pin output is reversed, that is, the Arduino output is high, the chip receives low, and vice versa.
Hardware Preparation
    1. Arduino One
    2. Switch type NPN transistor (8050) one
    3. 4.7k,10k resistor each one (seemingly not this resistance can also, as long as not too small can)
Circuit connection

Bread Plate Diagram:

(assuming that the nano on the right is the 12V thing we need to drive)

Schematic diagram:

Software development

Be sure to remember: the Arduino pin output level will be reversed, that is, the Arduino output high, the chip receives low, and vice versa! As long as you know this, the rest is almost the same as developing the normal output pin.

Let's try out a test project first.

In the test project, we use the multimeter voltmeter (20V stop) to simulate the 12V chip, that is, the red line of the multimeter, the blue wire, the multimeter black Ground (black lines in the picture). Because the input mode of the chip is equivalent to a voltmeter, it can be used as an alternative to see the effect. When the 12V chip should receive high, the voltage on our universal meter will appear near 12V, and the low will appear 0V.

Create a INO project with the following code:

#define Test_pin 7void  setup () {    pinmode, OUTPUT);    Pinmode (test_pin,output);} void Loop () {    digitalwrite (!digitalread ());    Digitalwrite (Test_pin,!) Digitalread (Test_pin));    Delay (n);}

Connect the circuit to see the effect. If all is well, you will see that when the light on the Ino is on, the multimeter displays 0V and the 12V is displayed when off.

Principle description (For people with no foundation)

Transistor this thing high school physics actually don't teach ... So I studied for a long while to barely understand a little. Feel a lot of books/tutorials are too complex, like what alpha value, beta value, magnification, and so on, the real application is not necessarily used, so I am here to briefly talk about the part of the transistor used.

There are two types of transistors, NPN and PNP, and I'll talk about NPN here, which is what this article uses. First, we want to remember this diagram and its three pin corresponding to the argument: C (collector), B (base), E (emitter) (want to understand the name of the principle to see itself).

Let's first look at the path with the Arrows (b->e): The easiest way to do this is not to think about what happened on the C-side, but almost as a b->e diode. b voltage is greater than e a certain degree (that is, B to e is large enough potential difference, generally 0.3V, etc.), there will be electric current, and vice versa. In our circuit, B is connected to the Arduino pin. Therefore, when Arduino high, the be has a 5V potential difference, but there is a current-limiting resistor, so there is a small electricity;

Then look at the other path, C->e: This one is a lot of sadness, is completely b->e that one tube. If the be has no current, no matter what happens, CE will not have current, this can be seen as C, E is disconnected. If the be has current, the CE will be allowed to generate current. In our circuit, be has the current is the CE connectivity, that is, the C-point grounding, so the 12V chip received low, conversely, received high. In fact, this part alone, is a pull-up resistor. See below.

By the way, "current intrusion" problem: If the transistor is now replaced by a piece of a conductor, then it is obvious that the C voltage is higher than B, so there will be a current to fill the B, resulting in a variety of arduino problems. But we don't have this problem in our circuit (it's actually been tested), because transistors can help B stay out of the intrusion. But according to legend, if the C voltage is above B too much, then the intrusion will still occur. If there is a real intrusion, a (possibly) feasible strategy is to install a rectifier diode at B to keep the current flowing backwards.

Acknowledgement

Thank Agou (Old Workshop master) in the circuit guidance!

Arduino level conversion boost output driver 9v/12v element

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.