Jump to content
43oh

New guy needs advice on protection circuit and code


Recommended Posts

Hello everyone, I'm just getting into microcontrollers and would like some advice to make sure my array is as efficient and trouble-free as possible.

 

First up is protection...I've read a ton of material and have designed a circuit based on those readings but would like advice from the pros. I have an MSP430G2231 feeding a TLC5916 with an 8x4 array (the three center strings will not be controlled by the TLC). The unregulated input voltage will be going through a switching regulator down to 9.0V (the LEDs will be run off of this output). From the switching regulator will be a 5.0V regulator then a 3.3V regulator. The 5.0V regulator is purely to take some load off of the 3.3V reg.

 

I cannot post a photo yet so my schematic is available at the following - please let me know if there's anything I should change.

 

ht tp:// w w w.acmewebpages.c o m/leds/chmsl/uc_schematic.jpg

 

Next up is the coding. As I said all I did was adapt an existing code for my use. It was originally made for two TLC5916s linked together so there may be some things that need to be changed. Keep in mind I know nothing about C... My code is below:

 

#include 
#include "BinaryConst.h"

#define SDI BIT5
#define CLK BIT4
#define OE  BIT6
#define LE  BIT3

int StepDelay = 20888;  //12288

void SendData(unsigned int data);

void main(void)
{
unsigned int StepData[8] = {
	B16(00011000,00000000),
	B16(00111100,00000000),
	B16(01111110,00000000),
	B16(11111111,00000000),
	B16(11100111,00000000),
	B16(11000011,00000000),
	B16(10000001,00000000),
	B16(00000000,00000000),

	};
int CurStep = 0;
unsigned int count;

WDTCTL = WDTPW + WDTHOLD;

P1OUT = 0;
P1DIR = 0;
P1DIR |= (SDI + CLK + OE + LE);

while (1)
{
	for (CurStep = 0; CurStep < 8; CurStep++)
	{
		SendData(StepData[CurStep]);
		for (count = 0; count < StepDelay; count++) {}
	}
	/*for (CurStep = 7; CurStep >= 0; CurStep--)
	{
		SendData(StepData[CurStep]);
		for (count = 0; count < StepDelay; count++) {}
	}*/
}
}

void SendData(unsigned int data)
{
int i;
P1OUT &= ~(CLK + OE + LE);

for (i = 0; i < 16; i++)
{
	if (data & 0x01)
		P1OUT |= SDI;
	else
		P1OUT &= ~SDI;
	P1OUT |= CLK;
	P1OUT &= ~CLK;
	data = data >> 1;
}
P1OUT |= LE;
P1OUT &= ~LE;
}

 

 

I greatly appreciate any help given!!

 

Evan

Link to post
Share on other sites

Here is a click able link to the schematic from the first post.

http://www.acmewebpages.com/leds/chmsl/uc_schematic.jpg

Is there a particular reason you are using the PTN78000?

 

The TLC5916 is actually rated up to 20V on the LED output pins, so you could use the 13.8V input to drive the LEDs directly. However depending on the current you might want to add some series resistors.

 

The amount of regulators in your design is actually unnecessary. The first regulator is actually capable of producing the 3.3V for the MSP/TLC.

 

Also, all your regulators are rated at 1A, which would mean a large chunk of their capacity is unused as you're just powering the logic inside the TLC5916 and the MSP430 is a very low power device so it doesn't draw much current.

 

The way you have arranged those diodes is incorrect. The diodes are there to prevent negative voltages from destroying whatever electronics come after it, in your design however the diodes don't serve a purpose, and also don't allow the capacitors to do their job. If you look at the datasheets of the parts you used, you'll notice that there are no diodes in the example circuits, especially on the output. Diodes are normally used at the very start of the design, to protect the circuit from reverse polarity(the user reversing the + and - terminals). The diode should be connected with the arrow pointing into your circuit, so it should be in between the 13.8V and the input of your first regulator.

 

The capacitors are there to smooth out any noise that might be superimposed(added) to the regulated signal. Noise comes from pretty much anything that has current flowing through it, so we filter it to prevent it getting into our circuits(you've done more of this with the .1uF caps next to the MSP and the TLC chips). Now the way you have the capacitors connected now, they will only charge up once, when you power on your circuit and will not discharge because the diodes are blocking the discharge path. To allow the capacitor to work you will need to take out the diodes and put a connection across the place where they used to be. It's also good practice to have capacitors close to the input of the regulators as well as the outputs. This makes the output they produce smoother(less noise).

 

EDIT: Found a simple circuit with a well known regulator:

000097.GIF

Link to post
Share on other sites

I realized the error of my ways with the diodes and have corrected the issue. In a previous design I used diodes to prevent the capacitors from discharging back into the regulators because the power supply will be very intermittent (though their placement allowed for the capacitors to do their job). This application is for the high-mount stop lamp on a car.

 

No particular reason I chose the PTN78000WAH over any another switching regulator. I don't want to run the LEDs off of the main input because it isn't a steady supply. The LEDs will be run from a 9V regulated input. I could have a separate 9V LDO linear regulator just for the LEDs but the switching regulator is more efficient so I'd prefer to use it.

 

RobG, I'll definitely look into the LM2576 to go from 9.0V to 3.3V.

 

The LEDs are Osram PointLEDs in red. Actual measured Vf is 2.15V @ 26mA. Each string will use 8.6V, hence why I choose to power them with 9.0V.

Link to post
Share on other sites
...I don't want to run the LEDs off of the main input because it isn't a steady supply.

TLC5916 is a constant current driver, so you don't have to worry about how steady your supply is. The two things that matter are TLC5916's power dissipation and supply voltage spikes. If you decide to power TLC5916 directly from 12V, you may want to add couple more LEDs per string to reduce heat. Something similar to R2/D3 may help you with spikes.

 

post-197-135135561737_thumb.png

Link to post
Share on other sites

I had chosen to regulate the LEDs' input voltage because with one TLC5916 I only have 8 outputs but my array will have 11 series (3 of which weren't to be controlled by the TLC). The only way to run my LEDs from an unregulated input is to either use a second TLC5916 or a TLC5940. I do have plenty of 5916s...

 

So 5 LEDs in series per string, all strings from either two TLC5916 or one 5940. By the way, I measured the input voltage again and it is only 12.5V so I could not run 6 LEDs in series (12.9V).

 

Would using only the PTN7800WAH to drop the Vin to 3.3V be acceptable or should I use a second regulator to ensure a smooth supply?

Link to post
Share on other sites

Another question - when I added the second TLC5916 and seven more LEDs the output was not stable. I had to power the TLCs from 5V rather than sharing 3.3V with the MSP. Should I be concerned about this in my final piece? My current Rext for the TLCs is 560ohm.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...