Pages: [1]   Go Down
Author Topic: PC8574 Driving LED , LOW LED Brighting  (Read 892 times)
0 Members and 1 Guest are viewing this topic.
Netherlands
Offline Offline
Newbie
*
Karma: 1
Posts: 49
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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,
« Last Edit: November 11, 2012, 09:21:53 am by ArduinoPat » Logged

Patrick ,The Netherlands

Valencia, Spain
Online Online
Faraday Member
**
Karma: 145
Posts: 5458
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

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

Netherlands
Offline Offline
Newbie
*
Karma: 1
Posts: 49
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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,


Logged

Patrick ,The Netherlands

Valencia, Spain
Online Online
Faraday Member
**
Karma: 145
Posts: 5458
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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).

Logged

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

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Valencia, Spain
Online Online
Faraday Member
**
Karma: 145
Posts: 5458
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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... :-(


« Last Edit: November 11, 2012, 10:59:00 am by fungus » Logged

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

Netherlands
Offline Offline
Newbie
*
Karma: 1
Posts: 49
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks For Reply Both  ( Fungus and dhenry),

The code is from the Cookbook , Recipe:13.7

Code:
/*
 * 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,
« Last Edit: November 11, 2012, 11:05:11 am by ArduinoPat » Logged

Patrick ,The Netherlands

Valencia, Spain
Online Online
Faraday Member
**
Karma: 145
Posts: 5458
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

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

Netherlands
Offline Offline
Newbie
*
Karma: 1
Posts: 49
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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


Logged

Patrick ,The Netherlands

Valencia, Spain
Online Online
Faraday Member
**
Karma: 145
Posts: 5458
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

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

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Try this:

Code:
/*
 * 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.
Logged

Netherlands
Offline Offline
Newbie
*
Karma: 1
Posts: 49
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Still less bright LEDS , in combination with the PCF8574  smiley-sad



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

Best Regards ,

ArduinoPat,
Logged

Patrick ,The Netherlands

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: