Not getting certain pins to work.

Hello all,

We are three students on the university of technology in Eindhoven, The Netherlands. We are working on a project where we want to create a kind of toy that changes color depending on the surface it is on. Software was not my particular area I had to work on in this project but the person actually responsible for this is gone for a few days so it seemed smart to me to already post it.
Might be that I explain something wrongly but he will take over when he returns (also answer questions).

Anyway, we already made the hardware for this. This includes a color sensor that can succesfully send information to the Arduino and a set of lights that will produce the light.
We are using the Arduino Deci. and Arduino 0011 programming.

PIC1

However, we came across a problem that we are not able to solve. Let me remind you that this is the first time we work with the Arduino and we have only just learned how programming in java environment (arduino) works.

We have the lights (+) attached to pins 8 to 11 (red, green, blue, yellow) and the - to the GND.

PIC2
PIC3

(I admit the pictures could be better.)

When running the following program:

PIC4

Only the red light turns on or none at all. Since the script is so short we are not able to indicate what is wrong or what we are missing. It does work when connecting a LED directly to the pin and to ground.
Also, the lights work like they should (tested with a battery).
The Arduino should be capable of producing the required voltage/current (I do not know the exact number but my team mate does). Even if it was only able to produce 50% of the current, we should still see the lights (although they might be very dimmed).

We did not have the chance yet to see whether the pins actually produce a current.

Excuse me if this is posted in the wrong forum but it is a problem related to multiple areas (also hardware).
Hope that we can solve this problem as soon as possible.
Thanks in advance, and of course.. a merry christmas to everybody :slight_smile:

Since I'm not able to post links in first posts and I might be a spambot or something spamming these forums with nasty images... here are the links:

PIC 1:

PIC 2:

PIC 3:

PIC 4:

We have the lights (+) attached to pins 8 to 11 (red, green, blue, yellow) and the - to the GND.
:
Also, the lights work like they should (tested with a battery).

So it works with LEDs but not with your light-bulbs?
Typically an AVR output is not powerful enough to drive an incandescent light bulb; LEDs use much less current. (However, I think I see transistors on your light-bulb board - just how is it wired up?)

Your code does nothing except turn one light on and as you say that is what is happening then your system is working perfectly.

If you want it to do something put a few digital writes high and low to the other pins followed by some delays in the loop() function.

Thanks for your replies. First of all, happy new year everybody!
It took a little longer for us to reply but I have a little more information now.

However, I think I see transistors on your light-bulb board - just how is it wired up?

This is correct. We use transistors to ensure it is able to supply enough current. I can't remember how exactly it is wired up but since they work, I guess it's right.

The problem is that we have no idea what goes wrong and why it does what it does. Let me tell you what we did:

We ran the following program on the same circuit with the arduino powered by USB:

  int BulbR = 8;
  int BulbG = 9;
  int BulbB = 10;
  int BulbY = 11;
  

void setup(){

  pinMode(BulbR, OUTPUT);
  pinMode(BulbG, OUTPUT);
  pinMode(BulbB, OUTPUT);
  pinMode(BulbY, OUTPUT);

}

void loop(){

digitalWrite(BulbR, HIGH); 
digitalWrite(BulbG, LOW); 
digitalWrite(BulbB, LOW); 
digitalWrite(BulbY, LOW); 
delay(100);
digitalWrite(BulbR, LOW); 
digitalWrite(BulbG, LOW); 
digitalWrite(BulbB, HIGH); 
digitalWrite(BulbY, LOW); 
delay(100);
digitalWrite(BulbR, LOW); 
digitalWrite(BulbG, LOW); 
digitalWrite(BulbB, LOW); 
digitalWrite(BulbY, HIGH); 
delay(100);
digitalWrite(BulbR, LOW); 
digitalWrite(BulbG, HIGH); 
digitalWrite(BulbB, LOW); 
digitalWrite(BulbY, LOW);  
delay(100);      
}

When we unplug (remove the pins) from the YELLOW, GREEN and BLUE bulbs, the RED works exactly like it should; blinking every 0.5 sec or something.
When we introduce the GREEN again, they keep on blinking as they should (short delay). But when we then introduce another light (YELLOW), all of the lights turn off and it has to be reset.

The next time we tried this, the RED and GREEN start blinking at the same time, with the same code :o

When we change ports or lights the problem persists. All bulbs work as they should though and produce the expected amount of light.

Is the Arduino not able to switch power fast enough ? Should the delay be longer?
We haven't been able to test the whole system yet with LEDs (to replace the bulbs) since we don't have them around. Would this be a wise thing to try out ?

Thanks in advance

But when we then introduce another light (YELLOW), all of the lights turn off and it has to be reset.

This makes me think that it's a power supply problem. Where does the power for the lights come from? From the Arduino's own 5V output? Or from another, bigger supply?

Ok, thanks for all your replies.

There was indeed something wrong with the transistor. It appeared to be an PNP transistor while it should have been a NPN.
Solved :wink:
I will definitly be using the Arduino a lot more in the future.