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.
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.
ArduinoPat:
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).
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.
/*
* 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 !
ArduinoPat:
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.
/*
* 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.