Beaglebone Black–gpio Switch LED (transistor and Relay experiment)

Source: Internet
Author: User

On a, with GPIO direct power to the LED, with high and low level for switch, not reliable. A GPIO is a signal, not a power supply. Moreover, a GPIO can only give poor 5mA or so, take more will burn (I did not burn do not know if it is really going to burn, but the instructions above is written). This is not playing, so I did the following transistor experiment.

2N3904 parameters please click here. This is not recommended, LCM is 200mA, but I only have it, no way. Transistor, I use it as a switch.

Try the bread plate first:

I am going to use the BBB 3.3V, 2N3904, LCM 200mA, is the C foot only 200mA upper limit, to use resistance drop, I have a little resistance type, took a 24ω, and then C feet. I used 470ω to drop 3.3V to 7mA analog GPIO high-level output to B-pin. At this point, after the power supply, B feet high level, E-foot about 2.8V, and then use 150ω to 19mA or so to the LED (note: Led more than 25mA will burn). The Green Line is connected to the B foot by a resistor, and the light is turned off. That's it on the breadboard.

On the whole, blind. Try it with BBB first. Turn off the power supply in case of wiring. The p9_1 is a 3.3V power supply with the p9_13 (GPIO number 31) as the control signal output:

One boot you will find that the LED is on. Enter the system operation SYSFS, as follows:

When you change the direction to out, the light goes out and the value is zero. Turn the value to 1 and the light will light up again.

I am not satisfied with the result. Again, this time lose that troublesome transistor, switch to relay:

This is 3.3V, suitable, on the other side can withstand AC 240V 7 A, or DC 28V 10A. Most of the relays are enough to play, but I this is 3.3V, connect the BBB direct plug, convenient.

The experiment was to use BBB to control the 5V DC circuit and test it first:

The Breadboard supplies 5V, concatenates two LEDs, and adds a 47ω resistor. Lit. Here the current 21mA is close to the limit of the LED can withstand (said to be 25mA, I read that led normal operating current is 18-20ma).

Then connect the relays and BBB. I was afraid of destroying the BBB, so I added a 470ω resistor in the GPIO. I'm not sure what will happen if I don't add this resistor. When connecting, of course, all power is turned off.

On the relay control side, the 3.3v,gnd of the BBB is connected to the gnd,in signal of the BBB to connect the BBB p9_13 (GPIO number 31). Note, however, that the circuit connection on the other side of the relay must be followed by the manufacturer's instructions. In general, the middle of the relay is connected to the FireWire (positive), the other two ports are normally open negative and normally closed negative. I am the negative of the normally closed one, that is, the LED does not light up before the high level signal of BBB is received after power on.

After the check is correct, BBB power on the board and the breadboard is power-up. I have this relay with light, the light is on behalf of the control side of the power has been connected.

Then, operate the BBB:

For these doubts, please see the previous few simple operations on SYSFS.

When the output is high, the two LEDs are illuminated after echo 1 > gpio31/value:

Of course, the lights go off when echo 0 > Gpio31/value.

So far, the experiment was successful. The code is not written. If you wonder what this is all about ... Relays can withstand AC 240V, that is, you can use the BBB control appliance power. But for the moment I did not think of my home appliances to be torn down to play. Do not use BBB, a Wifi module is done.

Next article is, esp8266,¥12.5 one, next article with BBB serial port operation it.

Beaglebone Black–gpio Switch LED (transistor and Relay experiment)

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.