Pages: 1 2 [3] 4   Go Down
Author Topic: Using BC327 instead of BC337 but not working as expected?  (Read 7626 times)
0 Members and 1 Guest are viewing this topic.
South UK
Offline Offline
God Member
*****
Karma: 5
Posts: 587
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Great stuff, just hooked up the circuit on one of the bulbs that arrived today (the last example posted by DC) and it works, with no excessive heat from the BC327.

The only thing is that the lamp will not turn fully off if I send 4095, very nearly off but not fully. Also I only notice any dimming effect at sends of approx >3500.

I have tried both 10 & 20mA current on the tlc with both configurations of the base pull ups - 4.8k pulled to 5v and 10k pulled to 12v but all of the above gives the same results?

Thanks!
Logged

Offline Offline
Faraday Member
**
Karma: 30
Posts: 2501
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Your original photo.


You'll find it's amplifying the current eg 1ma in 500ma out gain out of 500...

also the highest voltage out is base pin - voltage drop.. not the best way.


Logged

South UK
Offline Offline
God Member
*****
Karma: 5
Posts: 587
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry I don't quite understand what you mean?

It seems to me that the transistor is not switching on hard enough, any ideas why?
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 227
Posts: 6637
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The last example I sent uses an npn transistor e.g. BC337, not a pnp transistor like BC327. Your BC327 is acting as a diode. Replace it by an non transistor. This will make the dimming work the right way round e.g. 0 should be off and 4095 will be max brightness.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

South UK
Offline Offline
God Member
*****
Karma: 5
Posts: 587
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi DC, my mistake many thanks for pointing that out. I will try right away when I finish work!

Do you think this will solve the problem of the lamp not being switched all the way off when I send a 0?

Many thanks as always
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 227
Posts: 6637
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes. When you set the pwm to the maximum value 4095 then the output drivers are turned on for 4095/4096 of the time. So if you invert the pwm as you have done by connecting it incorrectly, with pwm set to 4095 the led will be on for 1/4096 of the time.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

South UK
Offline Offline
God Member
*****
Karma: 5
Posts: 587
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

IT WORKS! I'm very happy now, many thanks for the guidance David!  smiley-mr-green

I hooked up a POT and started some serial debugging to test and the range seems pretty good in corresponding to the bulb's brightness, but I think it seems to be weighted a little towards the ON end of the spectrum - in other words it gets pretty bright to early. How could I fine tune this?

The way it is hooked up now is with 10mA current set in the TLC (20mA works just as well) and with the 337 base pulled up to 12v through a 10k. Before I go ahead and build the 12 channels on some strip board and install the lot in my lounge ceiling I'd just like to check that this would be the preferred setup if you were making the same thing?

Pretty impressed with the TLC5940 now and the £2 3W eBay special bulbs are not too bad either smiley

Thanks again

Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 227
Posts: 6637
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I hooked up a POT and started some serial debugging to test and the range seems pretty good in corresponding to the bulb's brightness, but I think it seems to be weighted a little towards the ON end of the spectrum - in other words it gets pretty bright to early. How could I fine tune this?

The eye does not perceive brightness linearly. So you need to change the relationship between pot setting to LED power from linear to a power law or exponential law. Currently, you are probably doig something like this:

Code:
 unsigned int potVal = analogRead(pot);
  unsigned int ledVal = potVal/4;    // convert 0..1023 from analogRead to 0..4092 for TLC5940

A very simple modification is to use square law (warning: untested code!):

Code:
 unsigned int potVal = analogRead(pot);
  unsigned int ledVal = ((unsigned long)potVal * (unsigned long)potVal)/256;    // convert 0..1023 from analogRead to 0..4092 for TLC5940

Another way is to use exponential law (warning: untested code!):

Code:
 const float factor = 0.002;  // adjust this to get required response
  unsigned int potVal = analogRead(pot);
  unsigned int ledVal = (unsigned int)(4095 * exp(potVal * factor)/exp(1023 * factor));    // convert 0..1023 from analogRead to 0..4092 for TLC5940

The way it is hooked up now is with 10mA current set in the TLC (20mA works just as well) and with the 337 base pulled up to 12v through a 10k. Before I go ahead and build the 12 channels on some strip board and install the lot in my lounge ceiling I'd just like to check that this would be the preferred setup if you were making the same thing?

Using a 10K pullup to +12V is a good choice, and provides 1.2mA BC337 base current. This has to be sunk by the TLC5940 to turn the transistor off. So any current setting for the TLC above 1.2mA will do.
« Last Edit: January 15, 2013, 03:34:44 am by dc42 » Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

South UK
Offline Offline
God Member
*****
Karma: 5
Posts: 587
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks again David, I was not aware about the way we perceive brightness. I will certainly implement another law when I come to mapping values in the project smiley

I would also like to use 3 of the channels to control some RGB strips. I have a TIP122 wired up as per the attached schematic (not using a regulator though just a simple led load), linked from the arduino playground (base connected to TLC output via 1k and base pulled down to gnd through a 12k). But it does not work how I had hoped.

I have a LED hooked up through a resistor to 12v and the cathode to the emitter, but it is on full time with the TLC set anywhere between 0-4095.

Any ideas what could be happening here?
TIP122 datasheet: http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00000911.pdf

« Last Edit: January 14, 2013, 07:42:19 pm by dtokez » Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 227
Posts: 6637
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The circuit with the TIP122 and the regulator does not make sense. Please explain what you are trying to do.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

South UK
Offline Offline
God Member
*****
Karma: 5
Posts: 587
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi DC, I want to drive some high currents with the TLC5940 >1A so I found this site linked from the playground article on the TLC5940.

http://sonicrobots.com/2012/04/24/the-pwm-controller-tlc-5940-the-arduino-and-a-high-current-output-circuit/

I have built an identical circuit minus the 7805 regulator because I have a regulated PSU that I will use.

The LED is on all the time, I thought the TIP122 would control current flow to ground?
« Last Edit: January 15, 2013, 07:48:59 am by dtokez » Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 227
Posts: 6637
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The circuit given on that site is wrong. It might conceivably do something useful if the collector and emitter of the TIP122 were swapped and the 2K2 resistor were changed to a much lower value, i.e. 5V divided by the required LED current. But it's an extremely inefficient way of driving high power LEDs.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

South UK
Offline Offline
God Member
*****
Karma: 5
Posts: 587
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I thought something was a little strange there. Is there a way to have the link changed from the playground to stop others following it?http://playground.arduino.cc/learning/TLC5940

I thought that about swapping the emitter and collector around as it seemed wrong that the current passing through the LED would be collected by the emitter. This didn't work, the LED would light up say 50% on a TLC write of 0 and go to maybe 75% brightness at a write of 4095. Would it be worth changing the 1k or the 10k?

Is there a simple (but more efficient) method?

Many thanks!
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 227
Posts: 6637
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Please supply a link to the LED you want to drive from the TLC5940.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

South UK
Offline Offline
God Member
*****
Karma: 5
Posts: 587
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The idea is to control some RGB strips, (eBay specials) http://www.ebay.co.uk/itm/110834883443. I think they are common anode and require 12v. I will use probably 12 channels of the TLC5940 to control 12v MR16 bulbs in my lounge ceiling (as you have helped me to get working earlier in the thread) and use 3 of the left over channels for some RGB strip.

However at the moment for testing on the breadboard the load I am trying to control is a standard 20mA yellow LED connected through a 500ohm resistor.
« Last Edit: January 15, 2013, 11:14:36 am by dtokez » Logged

Pages: 1 2 [3] 4   Go Up
Jump to: