Welcome to Synthiam!

The easiest way to program the most powerful robots. Use technologies by leading industry experts. ARC is a free-to-use robot programming software that makes servo automation, computer vision, autonomous navigation, and artificial intelligence easy.

Get Started
United Kingdom
Asked — Edited

Running A Led Of Port D6

Hey guys.

I have a couple of general questions regards running LED's off a digital port.

1. I hooked up a 3V LED to the signal and ground pins on D6 on my v4 earlier today, made a little digital on, sleep 5 seconds, digital off script to test it but all it would do is very quickly flash once. I changed it over to port D12 and it worked fine. Any reason why D6 didn't work? The port is fine as I tested it with a servo. I was just wondering if it's because D6 is also a UART port as well and this may have caused the issue.

2. Any ideas if I could power a set of 20, 3v fairy lights off the V4 signal and ground pins? I lent my multi meter out so I can't test the amp output of the LED's. They normally run off two 1.5v AA batteries. Could 20 bulbs be too much?

Thanks.:)


ARC Pro

Upgrade to ARC Pro

Harnessing the power of ARC Pro, your robot can be more than just a simple automated machine.

AI Support Bot
Related Content
Synthiam
Based on your post activity, we found some content that may be interesting to you. Explore these other tutorials and community conversations.
#1  
How many mA is that led drawing? Anything over 20mA would be bad for the digital port... I have an ezb that has ports that will drive a servos but won't do digital on/off.... But that was my fault as I think I blew those ports...
#2  
Maybe you could be right.. the fact that D6 is the receive of UART port 1 may make it behave different from other regular ports....
United Kingdom
#3  
Hey Richard. I was (and still am) unable to test the mA from the single LED as I don't have my meter right now. It's interesting about the UART possibility. I wonder if anyone else has had similar issues with the digital UART ports?
#4  
I have a bunch of LEDs. I'll try d6 vs other ports tonight or tomorrow night.

As far as amps, even my big superwhite is only 20ma. I am sure you could run 20 off a v4. You should be able to run them all off a single port (wired in parallel, so the voltage stays the same).

Alan
#5  
@Alan... 20 if you use 20 ports... I don't know of any LED that draws only 1ma.. Each digital pin can only supply 20mA... You draw more than 20ma from the signal pin and you risk losing the port... So one LED per port...

I have a bunch of these 2 wire 20ma leds I got off of eBay... I only drive one per port.... You can buy leds that use power from the + power pin and the signal to drive it from the digital pin... I have some of those too, but they are 3 wire LEDs... They consume more than 20ma but they get their power from the + pin so it doesn't matter how much power they consume...
#6  
Right..... I was confusing the VCC+ with the signal. Thinking 5 amps would drive 250 20ma LEDs, but no, not on the signal pins.


Still, little fairy light LEDs will be way less than 20ma, so multiple per port, but need to measure more carefully.

Alan
United Kingdom
#7  
Wow, this was only ment to be a general question but I'm kinda glad I asked now, as I don't want to kill one of my ports and glad I didn't try hooking up the fairy lights first. So Richard, you reckon hooking up a 20 bulb strand to one port is not a good idea then?

@Alan. In regards to the D6 issue, it will be interesting to hear your results when you try it.
#8  
@Steve G... Not if you are powering them from the signal pin... Guaranteed your light strand is pulling more than 20mA.... My advice is don't hook them up until you actually determine how much current they are drawing...

I'll try too (D6 and a 20mA led) tomorrow, Steve... Will let you know...
United Kingdom
#9  
Cool. Thanks guys.:)
#10  
An LED works for me on D6. Both with set digital and with PWM.

Alan
United Kingdom
#11  
Consider using a TIP122 transistor switching circuit and a voltage regulator, you will have 5A to play with that way which should be enough for a string of LEDs.

If building the TIP122 is beyond you email me, I will happily send you one.
United Kingdom
#12  
@Alan. Interesting. Well thanks for testing it. I must have a dud port then. I don't remember putting anything on the pin to damage it though. *confused*.

@Rich. Me going on about the signal pins, I completly overlooked using the Vcc pin and a regulator *sleep*. Probably stating the obvious but the regulator would need to be 5v tolerant correct? Thanks for the tip, and for the offer. I might just take you up on that.:)

One thing, how would I control the LED strand (On/Off) using the Vcc and ground pins. Am I right in saying that the Vcc pin supplies a constant power feed?
United Kingdom
#13  
Here's the circuit for the transistor circuit that's floated around the internet since the beginning of time;


User-inserted image


When a voltage is supplied to the base of the transistor it makes connection between the collector and emitter thus completing the circuit for the Vcc/Ground circuit.

Setting the digital port that's connected to the base to high will enable the transistor and whatever is connected to it will become energised, be it an LED, a lamp, a motor etc. setting the port to low it will disable the transistor and the connected device will become de-energised.

Since the V4 EZ-B has 3.3v logic the 1k resistor needs to be changed, I do not know off the top of my head what it should be but believe it's around 660 ohms, it's mentioned somewhere else in the forum though so a simple search will find it.

Here's a tutorial on how to make the circuit on proto board, it is a very simple circuit however if it is beyond you I am sure I have some proto board, tip122s and resistors left lying around.

You can regulate the VCC pin to 5v or any other voltage you want. You could just use resistors to bring the voltage down too however that would be inefficient.
#14  
I use one of these to turn on and off external devices like a high output LED...Relay It plugs directly into one of the ezb's digital ports and is simply controlled by toggling the digital port high/low.....
United Kingdom
#15  
Thanks for the info guys. Just reading through my last post...

Quote:

Probably stating the obvious but the regulator would need to be 5v tolerant correct?
#16  
@Steve... What do you mean 5amp tolerant? The first time you said it was correct I think... "5v tolerant"... The digital pins (signal pin) on the ezb are 5V tolerant.... My relay solution is a simple switch, plug and play... What is the voltage rating for your led light string?
United Kingdom
#17  
Lol, sorry I'm confusing myself now :P. Let's try again.

Rich mentioned using the Vcc pins with a TIP122 circuit which will allow me to use the 5 amps from the Vcc pin. What I wanted to confirm was that using a regulator, that would have to be 5 amps too. For example, the 5v regulator from the shop only supplies 1 amp and would not be sufficient. Is that right?

I have two sets of 20 bulb LED strands, one is 3v and the other is 4.5v. I'm only looking at using one of these.
United Kingdom
#18  
It depends on the current draw of the LEDs. 1A will drive 50 x 20mA LEDs (1A/0.02A).

The regulator can be whatever you need it to be. You can't have too many amps but you can have not enough. A 1A may do but it will depend on the current draw of the LEDs.
#19  
The Tip circuit is more or less just a switch.... It probably has a limit to how many amps can be pulled through it, but I don't think we're talking about any number we need to worry about... I have a 12V high output 24 super bright led array that only draws about 200ma (at 12V).... So I think your led light strip is probably going to be in the same neighbourhood... So I would have to say the voltage regulator from the store would be fine... So your light strip is 5V meant for an RC controller? You can also do the same with a LM7805 voltage regulator....
United Kingdom
#20  
No, the "light strip" I'm referring to are the battery powered Xmas fairy lights. Anyway thanks for explaining and clearing that up guys. I've been testing things in a couple of the spare ports on K-9's EZ-B. I'm ordering a new one at the end of the month and my new project will be using pretty much every available port (digital and analog), so not much room for error.

Thanks again Rich and Richard.:)
#21  
No worries Steve.... If you're curious you could pull out the ole' multimeter and see how much the light strip is pulling in the way of mAs..... The higher the voltage the less power the strip will use (mA wise).... So I would try and use the max voltage that the strip is rated for... if you can that is....
United Kingdom
#22  
Yeah... multimeter. Sore point with me at the mo. I lent it to a friend "for the evening" over a week ago. Still waiting for it. *mad*
United Kingdom
#23  
@Richard.

Hey, you mentioned about using a relay switch like the one you linked to and I just found this on Amazon. I just wanted to ask about hooking it up. I get the Ground, +5v and signal in the right, but what are the terminals on the left (NO, COM, NC), and to which ones would a need to connect a two wire LED string?

User-inserted image
United Kingdom
#24  
NO = Normally Open (i.e. when the relay is not powered/the EZ-B isn't set to high) the contact is open
COM = Common
NC is normally Closed (i.e. when the relay is not powered/the EZ-B isn't set to high) the contact is closed.

So, you would have your Vcc to Com. The LED, light, motor whatever connected to NO and the other side of it to ground. When the signal pin of the digital port is On/High it would close the contact and whatever is connected would work.

If you wanted it to work when the EZ-B signal was low/off (including if the EZ-B is powered off) then connect between Com and NC.
United Kingdom
#25  
A bit more info/diagram for clarity;


User-inserted image


The switch in the relay is moved by the electromagnet from NC to NO when the relay is energised.
United Kingdom
#26  

Quote:

the other side of it to ground


Thanks Rich. Just to confirm from what you said, the other side (LED wire) goes to a ground on the battery. So this doesn't need a common ground then?

EDIT: Forget what I said about common ground. I'm going to power the LED's (with a 5v reg) from spare ground and Vcc pins on a port which a ping echo uses.

Thanks again buddy.
PRO
Synthiam
#27  
If you ask Jeremie - he can help you with a mosfet schematic that can connect to the PWM of the ez-b and give you brightness control:D
United Kingdom
#28  
Thanks DJ. I may just do that.;)
#29  
As I recall those relays need 5V to operate and the EZ-BV4 is 3.5V. You will require a converter like a EzSBC.com LS1
United Kingdom
#30  
@bookmaker32

Indeed they are 5v. I'm going to power it from spare ground and Vcc digital pins through a 5v regulator (post#27). Thanks though.:)
PRO
Canada
#31  
Here's the thread that I believe @DJ is referring to. P-Channel FETs are used for switching/dimming the positive voltage side. But as the other folks on the forum have suggested a TIP high current transistor would work, or an N-channel MOSFET (for switching the negative side of the LEDs) would work as well.

@Bookmaker32 funny enough some relay coils will still respond to a lower voltage. I remember switching a 9V relay with 5V in the past.
United Kingdom
#32  
Thanks Jeremie. I'll take a look.
#33  
@jeremie I agree however I have learned the hard way with these cheap Chinese relays.
#34  
@Steve...As mentioned before... I have and use these and they are guaranteed plug and play with the ezb4... They can switch up to 2 amps and are pretty cheap.... 5V relay
#35  
@Steve Good find! The Songle pictured in reply #24 will definitely not work with 5v.
Edit: I meant 3.5 volts.
United Kingdom
#36  
@bookmaker.

Quote:


5V 1-Channel Relay interface board, and each one needs 15-20mA Driver Current
Equipped with high-current relay, AC250V 10A; DC30V 10A
Standard interface that can be controlled directly by microcontroller, such as Arduino , 8051, AVR, PIC, DSP, ARM and so on
Contact independent wiring, safe and reliable
With screw holes for easy installation
Size: 42 x 24 x 20mm
Package Include:
1* 5V 1 Channel Relay Module Board


According to the write up, it should work at 5v.

EDIT: I've just seen your edit. No worries.;)