Drive Large Number of LEDs

Beta Testing discussion on mikroC PRO for PIC.
Author
Message
nayantha88
Posts: 33
Joined: 26 May 2012 14:36

Drive Large Number of LEDs

#1 Post by nayantha88 » 09 Feb 2014 15:08

Hello Everyone,
Im developing a system for a factory. Its about the Breakdown Repairing
In that case i wanna interface 30 bi color LEDs from SIP of I2C.
Is any one knows a suitable LED driver that have that capability.
Also what is the difference between 2 leads and 3 lead bi color LED
Any Help?

tpetar
Posts: 593
Joined: 27 Apr 2012 18:44
Location: Pancevo, Serbia

Re: Drive Large Number of LEDs

#2 Post by tpetar » 09 Feb 2014 16:36

nayantha88 wrote:Hello Everyone,
Im developing a system for a factory. Its about the Breakdown Repairing
In that case i wanna interface 30 bi color LEDs from SIP of I2C.
Is any one knows a suitable LED driver that have that capability.
Also what is the difference between 2 leads and 3 lead bi color LED
Any Help?
Hello,

Do you need matrix led driver?
All LEDs are grouped together or they are on different places?
What is logic of LEDs usage (matrix, 7-seg, independently, something else...)?
Did you mean on power bi-coloured LEDs such as CREE products (multicheap LEDs)?

MaximIntegrated have interesting LED drivers
http://maximintegrated.com/

A bi-colour LED has two LEDs wired in 'inverse parallel' (one forwards, one backwards) combined in one package with two or three leads. Bi-colour LED with two leads can have only one LED turned on at one time and they are less useful than the tri-colour LEDs.


As additionally see this:

The Charlieplexing
http://www.pcbheaven.com/wikipages/Charlieplexing/

30 LEDs Projects
http://www.talkingelectronics.com/proje ... cts.html#9



Best regards,
Peter
Attachments
bicolor_two_lead.PNG
bicolor_two_lead.PNG (3.9 KiB) Viewed 9945 times
xColourShift2.GIF
xColourShift2.GIF (2.16 KiB) Viewed 9945 times
triled.gif
triled.gif (1.74 KiB) Viewed 9945 times

nayantha88
Posts: 33
Joined: 26 May 2012 14:36

Re: Drive Large Number of LEDs

#3 Post by nayantha88 » 11 Feb 2014 15:23

Hi,
Thank you for your help.
Sorry for the late reply. In my application I need to use the LEDs for show the state of the output(machines) one color is for 'breakdown' indication and other is for 'repairing'. I'm planning to set no color for running condition.

Also there is a LCD display, keypad, bar-code scanner(No idea how to configure) and a RF transceiver.

so there will be no room for 30 led outputs. In that case i may have to use some other IC that have the capability to communicate via SPI or I2C.

Also do Anyone know how to use a bar-code scanner with a PIC. It can be USB or Serial. I need to send bar-code data to a Computer using RF transceiver via RS232. so I do not know which scanner to choose.

Thanks....

st5
Posts: 192
Joined: 04 Jan 2011 14:14
Location: 3090 Belgium

Re: Drive Large Number of LEDs

#4 Post by st5 » 11 Feb 2014 16:25

nayantha88 wrote:...so there will be no room for 30 led outputs. In that case i may have to use some other IC that have the capability to communicate via SPI or I2C....
MikroE uses the MCP23S17 for this, it uses SPI. If you want I2C, choose the MCP23017.

They have it on a PCB: http://www.mikroe.com/click/expand/
You can put 8 cards on the same SPI bus, witch gives you 8x16bits = 128 leds you can drive.
3x PicPlc16V6 1x EasypicV7

Going from programming on PC to embedded programming is like working in the dark with sunglasses on.

nayantha88
Posts: 33
Joined: 26 May 2012 14:36

Re: Drive Large Number of LEDs

#5 Post by nayantha88 » 11 Feb 2014 17:33

MikroE uses the MCP23S17 for this, it uses SPI. If you want I2C, choose the MCP23017.

They have it on a PCB: http://www.mikroe.com/click/expand/
You can put 8 cards on the same SPI bus, witch gives you 8x16bits = 128 leds you can drive.

Thanks you are a GOD

st5
Posts: 192
Joined: 04 Jan 2011 14:14
Location: 3090 Belgium

Re: Drive Large Number of LEDs

#6 Post by st5 » 11 Feb 2014 18:43

nayantha88 wrote: Thanks you are a GOD
I know. Unfortunately for me, the cheap version :-)

Keep in mind, SPI and I2C are made for short distances, on the same PCB.
So putting a PIC in one enclosure, and the port expanders close to the Leds, can cause problems if the distance is big.

A better solution if the distance is big, is using an extra PIC, and make them communicate to eachother by something simple like Uart. Or use flatcables from the port expanders to the leds.
3x PicPlc16V6 1x EasypicV7

Going from programming on PC to embedded programming is like working in the dark with sunglasses on.

tpetar
Posts: 593
Joined: 27 Apr 2012 18:44
Location: Pancevo, Serbia

Re: Drive Large Number of LEDs

#7 Post by tpetar » 12 Feb 2014 05:20

Hello,

For interfacing barcode reader you can see materials on this address (you can find schematic and source code example):
https://instruct1.cit.cornell.edu/cours ... /index.htm

In addition to I2C and SPI, you can use 1-wire and for example DS2408,... 1-wire bus length can be longer around few hundreds of meters. I2C can go up to several meters (I saw 10m).

Guidelines for Reliable Long Line 1-Wire Networks
http://www.maximintegrated.com/app-note ... mvp/id/148

As already mentioned above by st5, I2C is ideally suited to communication between ICs on PCB, or communication between a uC PCB with nearby sensors with small cable capacitance. The lower the bus speed, the more cable capacitance that can be tolerated, and the longer the cable limit. Higher bus speeds require shorter cables.

For reference, shielded 22AWG TP (Twisted Pair) cables have capacitance in the range of 100-240pF/m. So the maximum bus length of an I2C link is about 1m at 100Kbaud, or 10m at 10Kbaud. Unshielded cable typically has much less capacitance. My suggestion is Cat7 or cat8 TP cables.

Keep in mind that higher cable length is achieved with appropriate line drivers and receivers.

Extending the SPI bus for long-distance communication
http://www.ti.com.cn/cn/lit/an/slyt441/slyt441.pdf


Do you plan to use this in industrial environment with industrial machines, is there fluorescent neon lights ?


Best regards,
Peter

st5
Posts: 192
Joined: 04 Jan 2011 14:14
Location: 3090 Belgium

Re: Drive Large Number of LEDs

#8 Post by st5 » 12 Feb 2014 08:13

Nice to read this addition. Didn't know the DS2408 before.
3x PicPlc16V6 1x EasypicV7

Going from programming on PC to embedded programming is like working in the dark with sunglasses on.

tpetar
Posts: 593
Joined: 27 Apr 2012 18:44
Location: Pancevo, Serbia

Re: Drive Large Number of LEDs

#9 Post by tpetar » 12 Feb 2014 08:17

Hi,

Yes, DS2408 is nice IC, also in one short moment Maxim-Dallas offered 16 channel version of IC with very very high price, but now I can't find that IC in Maximintegrated products.


Best regards,
Peter

nayantha88
Posts: 33
Joined: 26 May 2012 14:36

Re: Drive Large Number of LEDs

#10 Post by nayantha88 » 12 Feb 2014 17:29

Dear Mr. Peter,

Thank you very much for your collaboration.

this is a garment factory. there will be lots of fluorescent lamps.
My project is to detect sewing machine breakdowns.
Also the MCU and the LEDs there will be not that much of a distance
I've Attached a sketch.

The process is not simple as mentioned. there are more than 1 unit and they have to communicate with a master computer using wireless system. Now the main thing is if i use bar-code scanners with RS232 I don't think it will be helpful with my communication part. In that case i have to use USB. I've never used USB devices with PIC MCUs. I dont know will it be work or not. I need to send the scanned bar-code to the computer. I hope if I used 18f4550 PIC mcu that will be success.
have any one tried something like this before?

Thank you

st5
Posts: 192
Joined: 04 Jan 2011 14:14
Location: 3090 Belgium

Re: Drive Large Number of LEDs

#11 Post by st5 » 12 Feb 2014 18:46

nayantha88 wrote:... Now the main thing is if i use bar-code scanners with RS232 I don't think it will be helpful with my communication part. In that case i have to use USB. I've never used USB devices with PIC MCUs.
I know of an old program in C on windows, that read barcode scanners with PS2. It worked exacly like a keyboard.
So scanning or typing the numbers gave the same effect.

I see MikroE has a PS2 library and a PS2 Connector Board. Maybe it's the easyest way to go?
On the other side, if the barcode scanner just uses Uart-over-USB, It's click and go, also.

Image
3x PicPlc16V6 1x EasypicV7

Going from programming on PC to embedded programming is like working in the dark with sunglasses on.

nayantha88
Posts: 33
Joined: 26 May 2012 14:36

Re: Drive Large Number of LEDs

#12 Post by nayantha88 » 13 Feb 2014 10:59

I wanna know one other thing also. What is the modern trend of barcode scanners?
Are there still ps2 barcode scanners available?
Because in my project there will be a barcode scanner in every unit. So if ps2 scanners are rare i will fail the project. according to ebay, alla are available in usb. So if i plug a usb to ps2 converter will it be possible?

Thank you

st5
Posts: 192
Joined: 04 Jan 2011 14:14
Location: 3090 Belgium

Re: Drive Large Number of LEDs

#13 Post by st5 » 13 Feb 2014 12:50

nayantha88 wrote:So if i plug a usb to ps2 converter will it be possible?
I think that might be possible, the way that also USB keyboards work on a USB to PS/2 dongle, but it depends on many things.
Try to find out what kind of USB the barcode scanners use. I'm sure there is a simple solution for it.
3x PicPlc16V6 1x EasypicV7

Going from programming on PC to embedded programming is like working in the dark with sunglasses on.

nayantha88
Posts: 33
Joined: 26 May 2012 14:36

Re: Drive Large Number of LEDs

#14 Post by nayantha88 » 13 Feb 2014 14:29

can anyone tell me how to communicate with 2 devices with using UAR. Are there any microchip devices with 2 or more uart capabilities

Or can I use tje feature just like cascading SPI or I2C devices?

st5
Posts: 192
Joined: 04 Jan 2011 14:14
Location: 3090 Belgium

Re: Drive Large Number of LEDs

#15 Post by st5 » 13 Feb 2014 22:03

nayantha88 wrote:Are there any microchip devices with 2 or more uart capabilities
Yes there are. The Pic18F45K22 for example that I'm using now, is one of many that have 2 UART ports.
For things like this I look at the Microchip page, go to the PIC-selector, there you can choose every detail in a table.
nayantha88 wrote: can anyone tell me how to communicate with 2 devices with using UAR.
RS485 is still often used to communicate with a lot of devices on 1 bus. The Uart-to-RS485 converter like found on the PICPLC16V6 board simply sets the bits for every device on the bus, every connected RS485 device receives it. Then everything depends on the connected rs485 device.

-you have rs485 to usb device that have a hardware coding switch. If you put it on "3" the PC will only receive messages for unit "3"

-you have rs485 to usb devices that simply give all data to a PC. A program on the PC has to filter the messages.

-you have rs485 to rs232 converters with a hardware coding switch. If you put it on "3" only the messages for unit "3" will be given to the rs232 side

-you have rs485 devices like an industrial precision scale. A rotary switch on it gives him his number. In the extended manual is described what it reads and writes.

There are also RS232 port multiplexers, but this is a very ugly way, often used in after-engineering stage, to stick "solutions" together, the electrical way.
It seems simple and very understandable in the beginning but will drive you into the dust when the details pop up.
3x PicPlc16V6 1x EasypicV7

Going from programming on PC to embedded programming is like working in the dark with sunglasses on.

Post Reply

Return to “mikroC PRO for PIC Beta Testing”