Netherlands
Offline
Newbie
Karma: 0
Posts: 40
|
 |
« on: November 11, 2012, 09:15:34 am » |
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=directlinkBest Regards, ArduinoPat,
|
|
|
|
« Last Edit: November 11, 2012, 09:21:53 am by ArduinoPat »
|
Logged
|
Patrick ,The Netherlands
|
|
|
|
Valencia, Spain
Online
Edison Member
Karma: 65
Posts: 2236
|
 |
« Reply #1 on: November 11, 2012, 10:11:11 am » |
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
|
|
|
|
|
Netherlands
Offline
Newbie
Karma: 0
Posts: 40
|
 |
« Reply #2 on: November 11, 2012, 10:26:54 am » |
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
Edison Member
Karma: 65
Posts: 2236
|
 |
« Reply #3 on: November 11, 2012, 10:48:45 am » |
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
|
|
|
|
|
Offline
Edison Member
Karma: 114
Posts: 2205
|
 |
« Reply #4 on: November 11, 2012, 10:51:42 am » |
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
Edison Member
Karma: 65
Posts: 2236
|
 |
« Reply #5 on: November 11, 2012, 10:57:02 am » |
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
|
|
|
|
|
Netherlands
Offline
Newbie
Karma: 0
Posts: 40
|
 |
« Reply #6 on: November 11, 2012, 11:00:21 am » |
Thanks For Reply Both ( Fungus and dhenry), The code is from the Cookbook , Recipe:13.7 /* * 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
Edison Member
Karma: 65
Posts: 2236
|
 |
« Reply #7 on: November 11, 2012, 11:04:09 am » |
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
|
|
|
|
|
Netherlands
Offline
Newbie
Karma: 0
Posts: 40
|
 |
« Reply #8 on: November 11, 2012, 11:08:09 am » |
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
Edison Member
Karma: 65
Posts: 2236
|
 |
« Reply #9 on: November 11, 2012, 11:21:11 am » |
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
|
|
|
|
|
Offline
Edison Member
Karma: 114
Posts: 2205
|
 |
« Reply #10 on: November 11, 2012, 12:05:19 pm » |
That piece of code is very retarded, in my view. Try this: /* * 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
Newbie
Karma: 0
Posts: 40
|
 |
« Reply #11 on: November 11, 2012, 12:33:18 pm » |
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,
|
|
|
|
|
Logged
|
Patrick ,The Netherlands
|
|
|
|
Offline
Edison Member
Karma: 114
Posts: 2205
|
 |
« Reply #12 on: November 11, 2012, 03:50:18 pm » |
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
|
|
|
|
|
|