Hi everyone, im having a great deal of trouble trying to sync 2 of the RGB leds i have for my robots eyes.
Just spent the last 2hrs, and some other days trying to get them to sync, so i thought it best i turn the ezb off and ask for assistance because its greatly delaying my current project...and meanwhile giving me zero confidence to start the next project for if i can't sync 2 leds... tired
Ive been close with it, but then they stray off and start to do their own thing, no matter what i do i just can't get them to join in holy matrimony.
Any help would be greatly appreciated, ive spent around 3-4 hrs total trying to figure it out as embarrassing as it is for me to say..and the more i try it seems to all go backwards and becomes much worse than when i started.
Do you have a circuit diagram? How are the RGB LED's Connected?
Hi Wayne, one led is connected to D0 and the other to D1.
Hi @NEWAGETOMY
I believe why Wayne is asking for a circuit diagram is because we don't really have a good idea of what kind of RGB LEDs you are using. Are you using BlinkM's, EZ-Robot RGB Eyes, Neopixels, or just standard RGB LEDs?
If you were using standard RGB LEDs connecting one to D0 and one to D1 doesn't make much sense because RGB LEDs require 3 signals each plus a Common Anode or Common Cathode connection. 8 connections total.
If you were using BlinkM's this wouldn't make sense either since BlinkM's use an I2C connection. 4 connections.
If you were using 2 x EZ-Robot RGB Eyes this wouldn't make sense either since they also use an I2C connection. 4 connections.
The only logical explanation that I can think of is that you are using Neopixel RGB LEDs directly connected to D0 and D1. Unfortunately, I hate to be the bearer of bad news but the EZ-B can't reliably drive Neopixel RGB LEDs directly; you would have to use an Arduino to drive them or wait until the EZ-Robot Neopixel Blaster is released
@jeremie,
thanks for your reply!
Im just using standard rgb leds-Red/Blue/Green.
When they are powered on they go through their red/blue/green sequence fine, never had a problem with them, just for the life of me i can't get them to operate at the exact same time.
These led's only need positive and negative im sure. There is an led on D0 and D1.
Not sure why i would need a diagram, it is just your normal standard led, with one on D0 and the other one on D1.
That's where I'm confused, as I said:
Unless you are using 2 pin special automatic self-cycling RGB LEDs, if that's the case the circuit inside them is never purely in sync from one LED to another. It's likely impossible to sync them.
Can you post a picture of your setup?
Edit: Weird, I didn't see the picture you posted until now. You definitely have self-cycling RGB LEDs. Convert to regular RGB LEDs, more connections but tried and true results.
This is a standard RGB LED
@Jermie,
thanks so much!
Ok so the one's i have aren't standard at all..thats great for it gives me an excuse to install a few more led's now.
Just looking at these led's again...there are 4 pins...how would i go about wiring them up now?
Do i have to run the ground/negative wire somewhere else?
Wish i knew what i was missing, 4 pin rgb leds but i only have 3 digital out pins, etc?
Sorry little confused here. sleep
Fairly sure i simply need to run a ground wire to another location?
edited to remove incorrect information. My info matched Jeremie's diagram, but not your's, and I had my cathode and anode terms mis-matched.
@PTP is correct, as usual.
Alan
There 2 types of rgb leds:
common anode common anode to the vcc (use the 3.3 regulated red pin) 3 x cathodes to the digital pins led will light on Low/ON
common cathode common cathode to the gnd (black pin) 3 x anodes to the digital the led will light on High/OFF
Your led is type 1) Jeremie is type 2)
deleted post
FUD detected !
@thetechguru
Not correct Anode is Positive goes to a Positive +
@Nomad 6R
wrong also the picture is confusing both red and black ?
Common Anode connections:
The led pcb has 4 pins like RGB Led Common Anode: Red (Cathode) Green (Cathode) Blue (Cathode) 5v (Common Anode) Purple cable
Purple Cables (Common Anodes) are connected to regulated 3.3v (Analog Pins Bank):
RGB Cathode Pins are connected to the digital pins:
*** Common Anode RGB LED ***
Notes: ON = LED OFF OFF = LED ON PWM 1 or OFF = Max Brightness PWM 99 = Min Brightness
indigo and brown lights, no doubts :
php
i mean red&black on ezb.thank for the pics.i would love to have tri color, led whit flat head.
@Nomad 6R
One or the other, and there are 3 types of voltages: VIn (Red) VCC (Red) GND (Black)
For common Cathodes Led: you connect the common (4 leg) to the GND(Black)
For common Anode Led: you connect the common (4 leg) to the VCC (red) Digital Pins's VIn (red) is not regulated we need the VCC (red) 3.3v from the analog bank.
if you want blink two common anode rgd leds at same time:
edited my incorrect post. Missed the difference in the two diagrams and mixed up cathode and anode terms.... For something so simple, it sure does get complex.....
Alan
someone told me all leds have diff speeds. you have to by a bag full leds and look for the 2 that have desame speed.
@nomad
What? In what way?when they change color from full leds.
I think @Nomad is talking about self-cycling RGB LEDs. They are never the same speed from one to another. They are bit analog that way.
@Nomad 6R, Plain (diode only) RGB leds don't have speed.
RGB led is a single component, but the reality are 3 different leds in a single container.
Not all leds are equal, so is important to check the led details
RGB led example:
All the 3 leds share the same forward current 20 ma with a max of 30 ma (before blowing up)
Different colors = Different wave lengths
Different colors different forward voltages, this means in similar conditions the brightness will be different.
ohm law: I = V/R
R = 330 (builtin EZB/Iottiny resistor)
I (Red) = (3.3 - 2.0) / 330 => 3.93 mA I (Green/Blue) = (3.3 - 3.2) / 330 => 0.30 mA
This means Red will be more bright than Green and Blue
jeremie yes i didn now the name of these leds.
php learn some again.rgb have no speed.
@Nomad 6R stop calling me php
am sorry PTP
anyone has a link for the tri color rgb led whit flat head? i want to rebuild robosapien v2 to ezbv4.
I recently tried the 4 pin cathode led, but they ended up being worse than the other ones i was using, i couldn't even get them to cycle, so i'm just going to run a single led for one eye now.
I wanted the eyes for emotion, red for anger, green and blue for whatever, but i'm now stuck with red only..so red it is and red it has to be.
These leds have been the bane of my existence so im moving on.
tomy
you can,use a pwm for each color.
@Nomad,
thank you i wish i had of known that earlier..now its a little too late, his head has been painted and i put the factory eye piece back in so i just use the one LED.
Not what i wanted but it will have to do.
For the style of head it is, the one led for his eye will actually suit better.
I'll make sure for the next robot that i build will have all 3 colors sync for 2 eyes. I'll need to do that for little Robi, thats a must.
tomy
we will get there some day.
howmany volts do the rgb leds have to be to use on the ezbv4 ?
3.3v i think, not exactly sure Nomad.
Should get my volt meter out.
Hey Nomad...with the 4 pin led...do i need pwm to actually cycle them from red to blue to green?
So they don't random cycle like the 2 pin cathode's?
That just dawned on me, for me when i powered them on they just stayed red and never cycled.
i think each pin has a white (signal) that one goes whit the pwm. idd they dont cycle like 2 pin.am also still confused. you have 4 pins 1 goes to red (vcc) and 3 signal,where does the black one come from ?
I ran each color to the pins on D0 & D1, after that i became a little confused, for i had a 4th wire, so i ran that to another pin.
I simply don't understand the wiring aspect of it. 4 wires, only 3 pins to connect to, which is why i opted to go with just the one led for i'm out of my depth with this.
So my avatar really suits now doesn't it?
Why don't you just buy this for $20? 18LED RGB PCB Use it as eyes (JD does) then you can have all the colour combinations you wish synced up nicely with not one line of code... Also it's plug and play...
do you have a link for 3.3 volt rgb leds ?
No i don't have a link, i bought them from my local hobby shop.
I'm happy with having just one eye for this one Nomad, its becoming more of a hassle to get these led's working than the other one's, its going to make wiring messy also.
RR
i have one of those.am rebuilding a robot v2 and try to learn how to do.
@Richard,
thanks but those leds wouldn't suit my project at the moment, for another one they would be great.
@NEWAGETOMY
Did you read my posts ?
Post 14 # has 2 common cathode 4 pins RGB lights similar to yours. It's not clear the wiring ?
What you mean with cycle ? Is on/off, blink, different colors ?
Post #15 has two examples:
Post #18: has a blink example.
Did you tried them, do you have doubts, what's the result ?
@PTP,
omg its 5am here now, just looked back at older replies and i never saw them PTP!
Funny thing is im very half asleep right now and my jaw dropped when i saw them...not sure what i did, but i never ever saw those replies, if i did i would have at first thanked you and then posted back with results!
Many many thanks for that PTP, greatly appreciated, i need to look at your posts after another coffee or2
@ptp,
after seeing your pics i never had them wired like that, but i also realized theres going to be too much wiring for 2 leds, ideally i really want to run 6-8 leds all up, with just 2 being rgb. I need to run 23 servos and i don't see there being any room for the leds, but please correct me if im wrong?
The coding you posted...is there a way i can just copy and paste that into the code box? I tried and it doesn't let me paste it in, so do i just manually type it in?
highlight the text, press CTRL+C to copy. open the new script, click in the script text eindoe, press CTRL+V to paste.
@CochranRobotics,
thank you very much!
@PTP,
just tried running your code, all i got was blue and none of the other colors showed.
Is there something else i need to do to the code, edit something out, etc?
One of the leds looks more purple than blue i noticed. confused
I don't have RGB LED's to test with, but looking at the script in post 18, the one suggestion I would have is to increase the sleep time. It may be cycling too fast to notice the blink, but the fact that you are not blinking from orange to off but seem to be getting blue to violet makes me think you may not have the right pins connected to the right ports.
Before jumping into a script and trying to coordinate blinking, I would start by just creating a PWM slider and a Set Digital object for each of the ports and experiment with what each one does, and how they work in combination, and then take what you learn from that to adjust the script as needed (if you take notes, and tell us what the results are, we can help with the scripting, although using Blocky to learn to script is also a great exercise).
Alan
There are some people that, if they start to help someone, I don't jump in. The reason for this is that they are very knowledgeable and are able to assist in getting the issue resolved very well. PTP is one of those, along with Alan and some others. PTP is great at writing scripts, electronics, writing firmware for the EZ-B, coding plugins and a ton of other things. He will be able to assist in getting you going. Alan is also very good. I will stay out of that thread.
With that being said, is there anything else that you can be working on while waiting for the answer you are looking for? If so, don't stop here and go on to another part of the robot that needs to be completed until a solution can be provided or you find a solution. This is a minor bump for you. Don't let this be what stops you from learning and advancing.
@TTG,
many thanks for your reply.
I had the pins in the ports PTP had pictured, i then tried different ports and still had no luck.
I will look into it for my next project for sure, but the head of the robot has been changed now and recently painted so i can't change it back.
My next project is the Robi with the Lol Tiny and this is something i would really appreciate help with for syncing his eyes for emotion. Ive been using Blockly which i think is fantastic...even though im struggling to understand some of it.
Many thanks again.
Just to clarify, the script in post #18 is the one you should try, and it is specific for a common anode LED's which we think is what you have. It won't work for common cathode LED's, and in fact, seeing nothing but blue may be exactly what you would get from that (again, I don't have any to play with, but it kind of fits the symptom), thus my suggestion of testing the ports directly with controls before trying to script.
The code in post #15 is not a script, it is a listing of the individual relevant script commands. Trying to run that will absolutely not work.
Alan
@CochranRobotics,
thanks so much. Im very hard on myself, and not being able to do what i wanted really deflated me for ive seen others robots with their rgb eyes perfectly in sync here.
Ive been working on many other things, building a humanoid for the first time is actually quite a task, well i wouldn't call building a robot a task, its too much fun to call it that..but that programming yes what a task...but i built it from scratch and it has been a blast to build, but very time consuming, you build it, strip it down, mock things up, remove, cut, trim, trial and error...i love all that, but having trouble programming something you want so badly to come to life, and spending hours trying and not getting anywhere is deflating...but i have to remember i only joined here 2 months ago...i think im expecting way too much way too soon...you guys agree..?
:)
@TTG,
ah i see....omg no wonder it wasn't working...hehe.
Im going to have my humanoid finished by this weekend, so will start a Robi thread next week and will be asking for assistance for that, thanks very much again for your help TTG.
Programming is simply a different mindset than building. I am a better programmer than builder, so I have been focusing on Building more than programming lately. I enjoy the building because it is on the fringe of my knowledge. Programming is understood so it becomes boring for me most of the time. I could get better at it for sure, but the building is setting there waiting for my attention.
It is easy to see results when building. It is not as easy to see results when programming so it feels like you slow down. Believe me when I say that you have the right platform for programming your robot. It just takes time to understand how to script things together properly.
Copying and pasting code is probably the best way to stay unfamiliar with programming. I tell my guys this all of the time. It is better to take the time to type out the code and try to understand what is going on while you are typing it. This will get you more familiar with the language much more quickly than copying and pasting it. Copy/paste is a quick solution to a problem, but it isn't the right solution to the problem, and often times isn't the correct solution to the problem.
Start with something familiar, learn the syntax and then push yourself to learn more. Its a process, but definitely doable.
Yup... I have been here 4 years, and am still mostly playing with Revolution bots. I have grand plans to make a robot steampunk dog from scratch, but every time I think I am ready to start, I see someone do something new and incredible here and rethink all of my plans. However, that means I have been able to spend a lot of time learning the programming and scripting, which is my core competency, while I slowly learn the construction and electronics, neither of which I have much experience in.
For instance, when I started, I could barely solder two wires together, I have now added a laser diode to my Roli's camera, which required both a 5v regulator and a transistor since it needed higher voltage, and higher amperage than the EZ-B digital port could provide, but lower voltage than the 7.4 v LiPo powering the robot. I used a combination of different posts and tutorials here to figure out how to build and program it.
Start things in little steps to understand how each part works, then take on the big task. Like with your RGB LED. Figure out how to get one to light in every color and how to control the brightness, then building a script to coordinate two of them together will be easy because you will understand what every line of the script does, and when it needs to execute.
Alan
@CochranRobotics,
100% agree with that, i use Linux and teached myself terminal commands which i like to use time to time, i type them out from memory now...if i could do that with programming that would be fantastic.
When you said i have the right platform for programming your robot...do you mean the Blockly interface, ARC?
@TTG,
yes i keep telling myself baby steps, but forget all too easily it seems.
Thanks for your help, im not going to showcase my first project, but for Robi i will and will ask for help then. At least for now i have one led(red) for an eye....i can control the brightness of it, thats something at least...oh my.
ARC in General. Here is why I say this. There is a level of progression that you can benefit from.
Scratch Blocky Scripting Plugins
I know of no other platform that allows you to start from no knowledge of programming through some advanced programming. At first, there was only scripting. Those who have been around here a long time prefer to use scripting because that is what we learned with. Now, you can be eased into Scripting, but for those programmers out there, you can make ARC into anything you want it to be by the use of plugins.
I been on and off with conference calls...
David, Thanks for the kind words, although i don't have:
in other words i don't own an exclusive lock for this thread So feel free to jump in, correct me or suggest other ideas sometimes i fail to identify very simple details, and i always go for inner details
Alan's suggestions are good, instead of jumping to script you can try:
For example, i try to keep red and black for power, and blend colors (white,yellow,grey) for input signals and strong colors (brown, blue, green, purple) for output signals, that way i know easily connecting two strong colors (two outputs) can cause a short-circuit.
So colors, sequences, etc help you to remember.
if everything is good, start with the second RGB led.
Scripting is a different thing, try first the visual tools (Blocky), to visualize control flow, individual actions etc.
Only then you should start with the EZ-Script tutorials.
I'll share view about robots:
Start with EZ-B, follow all the relevant tutorials and aim low your expectations or in other words define your goals only after you learn/accomplish something.
First you need to build your confidence, you need hands-on, try-failure-success.
The first time i bought a robot kit (6 years ago) i had huge expectations: navigate around the house, use the arm to pickup stuff, talk, voice recognition etc etc.
After i assembled and i run the first script, the robot could not drive a straight line, then i could not combine an IR Remote with a servo within the same micro-controller, than my code logic was to slow... etc etc.
So after 3 months i gave up, without knowing anything about the platform, i thought everything was easy and plug play.
Fast forward to the present moment, EZ-Robot makes your life Easy ...
but the reality is: robotics is more software than hardware, so after a few hardware combinations you need to use software (scripting, blocky) whatever to reach your goals.
And bear in mind some goals are very difficult or almost impossible without extra hardware/software.
Robot navigation, localization, object recognition, voice recognition are very difficult tasks you will need special/paid services to get there.
Glad you are getting help with this. There is some very good advice in this thread. Keep your head up, you are getting there. If I can do it, you can. There is no easier way to learn than with EZB and experimenting.
@PTP,
your awesome thanks so much.
My confidence is nowhere at the moment, so i need to re-establish that and then things will become more clear. I will certainly be trying that for my next project and wont stop until its done.
@Perry_S,
many thanks, these replies have helped me a great deal now, can feel the motivation seeping back in. I feel like doing my first project thread now, but would feel stupid doing so also, so best to wait until its at least 90% finished...but then again in the world robotics...define 90%?
tomy
howmany volts are your rgb leds ?
i just notest mine are 12 volts.
Im not sure Nomad. but they aren't 12v..the ezb has the resistors in there, so they are regulated to 3.3v i think.
Im going with a single red led for now Nomad, but for Robi i will need to get his eyes well and truly sorted out so they express emotion.
I wiil start a build thread for it soon.
i try ptp config
D0=RED RED ( anode ) analoge top D1=GREEN D2=BLUE
D4=RED red ( anode ) analoge below D5=GREEN D6=BLUE
i tested first all colors whit 3 volt batt and put same color wire on. what i have is the leds dont go out and have diff collors same time? i have 3 volt rgb leds.
tomy
here is the config from ptp but in easy way.
i used this picture.
and here a video
@Nomad,
thanks for that, will surely try it for project #2.
tomy
glad you like it.