Go Down

Topic: PC8574 Driving LED , LOW LED Brighting (Read 986 times) previous topic - next topic

ArduinoPat

Nov 11, 2012, 03:15 pm Last Edit: Nov 11, 2012, 03:21 pm by ArduinoPat Reason: 1
Dear  All,

I have did a test with the PC8574AN , Example 13.7 < COOKBOOK >

All is working well , except the brighting of the LEDS,

I saw attached that the PC8574 has a lower capacity for the LEDS than the Arduino,
How can i mnake these LEDS blinking Brighter ?


Find attached the setup of this :
https://picasaweb.google.com/lh/photo/pxPJZVbTx3nI9z2dkKaGVtbkCAJCpyZcpW83LBCi5hY?feat=directlink


Best Regards,

ArduinoPat,
Patrick ,The Netherlands

fungus


Dear  All,

I have did a test with the PC8574AN , Example 13.7 < COOKBOOK >

All is working well , except the brighting of the LEDS,

I saw attached that the PC8574 has a lower capacity for the LEDS than the Arduino,
How can i mnake these LEDS blinking Brighter ?


Find attached the setup of this :


I don't see any current-limiting resistors on that so I'm guessing you overloaded the PC8574. The datasheet says that maximum current on all pins cannot be more than 100mA. Eight LEDs connected with no resistors will easily exceed that. There's no way you can light them all at once, you may even kill your chip if you try it.
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

ArduinoPat

Hello Fungus,

Thanks for reply,

Ok i understand this , the PC8574 only will give a current of 100mA
But is it possible to make the LED  brighter , without damage this PC8574 ?


Best regards ,

ArduinoPat,


Patrick ,The Netherlands

fungus


Hello Fungus,

Thanks for reply,

Ok i understand this , the PC8574 only will give a current of 100mA


There's nothing in the PC8574 limiting the current. You can draw as much as you want.

But ... don't expect the chip to have a long life if you exceed 100mA.


But is it possible to make the LED  brighter , without damage this PC8574 ?


For all 8 LEDs simultaneously? Maybe, but you have to add resistors to limit the current to 12.5mA for each one (100mA total).

The maximum for each output on the PC8574 is 20mA so you can run 5 LEDs at 20mA each (but you still need a resistor on each one to limit the current to 20mA or they might damage the chip).

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

dhenry

Quote
But is it possible to make the LED  brighter , without damage this PC8574 ?


The resistors are the least of your worries: if your problem is overcurrent, your leds would have been very very bright, the opposite of what you observed.

The problem is somewhere else, like your code / setup.

fungus

#5
Nov 11, 2012, 04:57 pm Last Edit: Nov 11, 2012, 04:59 pm by fungus Reason: 1

I saw attached that the PC8574 has a lower capacity for the LEDS than the Arduino,


How did you determine this?

If you just connect a LED to an Arduino pin you could be driving it at 50mA or more - bad for the LED and bad for the Arduino.

Yes, it would be very, very bright - for a while.

That's not a good reference point though because after a while it would be very, very dim... :-(


No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

ArduinoPat

#6
Nov 11, 2012, 05:00 pm Last Edit: Nov 11, 2012, 05:05 pm by ArduinoPat Reason: 1
Thanks For Reply Both  ( Fungus and dhenry),

The code is from the Cookbook , Recipe:13.7

Code: [Select]
/*
* I2C_7segment
* Uses I2C port to drive a bar graph
* Turns on a series of LEDs proportional to a value of an analog sensor.
* see Recipe 7.5
*/

#include <Wire.h>

//address for PCF8574 with pins connected as shown in Figure 13-12
const int address = 0x38;  
const int NbrLEDs = 8;

const int analogInPin = 0; // Analog input pin connected
                          // to the variable resistor

int sensorValue = 0;       // value read from the sensor
int ledLevel = 0;          // sensor value converted into LED 'bars'
int ledBits = 0;           //  bits for each LED will be set to 1 to turn on LED

void setup()
{
 Wire.begin(); // set up Arduino I2C support
 Serial.begin(9600);
}

void loop() {
 sensorValue = analogRead(analogInPin);             // read the analog in value
 ledLevel = map(sensorValue, 0, 1023, 0, NbrLEDs);  // map to number of LEDs
 for (int led = 0; led < NbrLEDs; led++)
 {
   if (led < ledLevel ) {
     bitWrite(ledBits,led, HIGH);    // turn on LED if less than the level
   }
   else {
     bitWrite(ledBits,led, LOW);    // turn off LED if higher than the level
   }
   // send the value to I2C
   Wire.beginTransmission(address);
   Wire.write(ledBits);
   Wire.endTransmission();
 }
 delay(100);
}



I have tryed 1 LED with ressitor , but still te same problem ( not very bright )

Maby you have any options ?

I have tryed without the PC8574 , An=d make only a Bargraph with the Arduino,
Now the LEDS are real bright !



Thanks ,

Regards,

ArduinoPat,
Patrick ,The Netherlands

fungus


I have tryed 1 LED with ressitor , but still te same problem ( not very bright )

Maby you have any options ?


Is it bright on an Arduino pin? LEDs go permanently dim if you abuse them.

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

ArduinoPat

I have tryed without the PC8574 , An=d make only a Bargraph with the Arduino,
Now the LEDS are real bright !


Patrick ,The Netherlands

fungus


I have tryed without the PC8574 , An=d make only a Bargraph with the Arduino,
Now the LEDS are real bright !


So maybe:

a) You've hurt your PC8574
b) Your not programming it correctly, eg. the LEDs can light up very dimly if the pins are set as inputs instead of outputs.
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

dhenry

That piece of code is very retarded, in my view.

Try this:

Code: [Select]
/*
* I2C_7segment
* Uses I2C port to drive a bar graph
* Turns on a series of LEDs proportional to a value of an analog sensor.
* see Recipe 7.5
*/

#include <Wire.h>

//address for PCF8574 with pins connected as shown in Figure 13-12
const int address = 0x38; 
const int NbrLEDs = 8;

const int analogInPin = 0; // Analog input pin connected
                           // to the variable resistor

int sensorValue = 0;       // value read from the sensor
int ledLevel = 0;          // sensor value converted into LED 'bars'
int ledBits = 0;           //  bits for each LED will be set to 1 to turn on LED

void setup()
{
  //Wire.begin(); // set up Arduino I2C support
  Serial.begin(9600);
  analogReference(DEFAULT); //set analog reference
}

void loop() {
  //sensorValue = analogRead(analogInPin);             // read the analog in value
  ledLevel = map(sensorValue, 0, 1023, 0, NbrLEDs);  // map to number of LEDs
  for (int led = 0; led < 250/*NbrLEDs*/; led++)
  {
    if (led < ledLevel ) {
      bitWrite(ledBits,led, HIGH);    // turn on LED if less than the level
    }
    else {
      bitWrite(ledBits,led, LOW);    // turn off LED if higher than the level
    }
    // send the value to I2C
    Wire.beginTransmission(address);
    Wire.write(led/*ledBits*/);
    Wire.endTransmission();
    delay(2); //some small delay
  }
  //delay(100);
}


You should see some blinking and some constantly lit (they are blinking too fast).

This will show you if your chip (pcf8574a). A2..0 tied to ground.

The code is the same for pcf8574, except the address.

ArduinoPat

Still less bright LEDS , in combination with the PCF8574  :(



I will investigate this and find out , till then i will send this at this Forum   :)

Best Regards ,

ArduinoPat,
Patrick ,The Netherlands

dhenry

That means your chip is ok, your wiring is ok, your led is ok, and your protocol is ok.

You just need to fix your code.

Go Up