PIC32 PCB, LED 7seg drive

Discussion in 'The Projects Forum' started by takao21203, Jan 22, 2013.

  1. takao21203

    Thread Starter Distinguished Member

    Apr 28, 2012
    I am going to make a new PIC PCB.
    Since the price difference is neglible, I will use a small PIC32 (TQFP44 IC).

    I have designed a display drive which can use any 7segment display, and it can also use custom LED matrix boards.

    24 bits are available, and upto 8 and any 8 of these can be used as MOSFET sinks. Therefor small wire jumpers are needed (these are soldered at the time of assembly), and small wire pieces for the MOSFETs.

    It is possible to drive displays directly from a PIC, but there is tradeoff: brightness variation, and only 16F or 18F PICs can do it. As well many I/O lines are required. So I use 74hc595 buffers.

    Also a 3.3v switching regulator will be present which is suitable for USB or batteries.

    I will add solder pads for a serial TFT display, and a serial FLASH chips, as well a few pushbuttons and LEDs.

    Any suggestions for this PCB?? Don't be confused by the PIC model number in the picture, it is not going to be used.

    Other options are to ditch the 7seg stuff altogether and only use a TFT display. Or to produce a small as possible 7seg board with direct drive. I made one 16f54 7seg PCB with serial interface, but it is a nuisance to use even for myself- I don't use it actually. It is quite hard to assemble as well. The serial protocol I use really is not so nice.

    If I use a larger chip, it does not fit under the display anymore.

    I have really been thinking about all options for a long while, and decided to build a PCB with flexible layout, and MOSFET sinks. It could drive a matrix as well upto 16x8 (on a seperate PCB).

    USB, the switcher IC, LEDs and pushbuttons will not be mandatory to populate. And of course a 32KHz as well 4 MHz crystal!
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    You may want to peek at what Mikroelectronica has for reference designs. They have some nice PIC32 platforms.

    One huge thing that would be great is the ability to turn off power via the PIC to any and all other parts... so the real time clock can operate off a battery with very low power.
  3. takao21203

    Thread Starter Distinguished Member

    Apr 28, 2012
    The 74hc595 chips have quitescent current 80uA each.
    I will use a 3 MHz DC/DC converter which can be turned off.
    Then maybe I provide pins for a supercapacitor.

    Also the dc/dc chip isn't mandatory (it costs more than 1 Euro).
    I will provide pins for 3 diodes to reduce the 5 volts from USB.

    It is just a generic LED 7seg and LED matrix board!
    I want to keep costs low.

    I figured out however some PIC32 only cost 2 dollars.
    So why use a 16F or 18F- they are quite limited.

    If I use a cheap 16f59, it can drive displays directly at 5 volts, but does not have hardware serial port. I was thinking about that.

    In the end, the savings are not that much. One dollar more or less don't really count. If the PIC32 would cost 10 dollar, this would be different.

    The only thing is the configuration for PIC32, which is more complicated. It is just not the same as a simple 16f59.
  4. takao21203

    Thread Starter Distinguished Member

    Apr 28, 2012
    So if anyone is interested in such a PIC 32 PCB, I could order more PCBs.

    For myself I will only do a 10pcs. run right now.

    This is not the first PCB I am designing. So I have learned a lot from the mistakes I made with ealier PCBs.

    Price will be about $15, depends how much the PCB is populated.
    There will be a mini-USB socket on the PCB.

    The PIC32MX210F016D will be used for the PCB, this is a USB PIC.

    Many different LED displays can be used, and a full display drive circuit is included.
  5. GopherT

    AAC Fanatic!

    Nov 23, 2012
    A multiplexed LED display takes a lot of programming overhead to keep updating the display. I am not sure you want to include this overhead in every quick program you want to hobble together for an experiement. Each LED needs to be "refreshed" about 60 times per second to keep it from flickering, then back to your main program, then back to updating, (repeat)...

    Programming would be much easier with an LCD module - send and forget (until the display needs to be updated with new information).

    If you really want LED displays, then some bus wires leading to latched 7-segment display drivers for each digit and a multiplexer and clock might be a better option. Just update each latch and let it run off-board.
  6. takao21203

    Thread Starter Distinguished Member

    Apr 28, 2012
    The code isn't the problem- I have done it many times.
    I have PCBs here which hold all the ICs + a controller, but it contains too much extra stuff, and a powerless 2K chip (16f716).

    Also single digits take more effort to solder + need more PCB tracks.

    I can get 3-digit displays quite cheap, and also 4-digit displays for $1.30

    Serial TFT LCD will be an option.
  7. takao21203

    Thread Starter Distinguished Member

    Apr 28, 2012
    I have ordered 20pcs. PIC32

    Options for the board are:

    -Lithium Ion battery CR123 + charger IC (from USB).
    -16 megabits serial FLASH.
    -Pads for serial 1.8" TFT display.
    -3 MHz switching regulator for USB or other power input.
    -2x 3 digit displays or 2x 4 digit displays (or none).

    USB connector and 8x MOSFETs are always present on the board.
    Using diodes to reduce voltage is an option if the board is only used from USB.

    The 3MHz switcher IC has a 1 uH coil!
    This is not pointless, it saves power if you run the board from a small laptop.

    Just the blank PIC32 chip cost me about 2.50 Euro all inclusive.

    If you are interested for the board + TFT display, there will be code examples included to draw font, lines, and to load BMP files.

    It can also drive LED matrix, upto 16 columns + 8 rows.
  8. takao21203

    Thread Starter Distinguished Member

    Apr 28, 2012

    I saw these LCDs. LED displays need too much power!

    So I will change the design. A secondary PIC (16f59) is used to drive the LCDs. It can also drive LED displays directly.

    It will have a serial bus connection. This makes layout much easier. No MOSFET bank, no jumpers. LED displays can be used, with some brightness variation. They are not that important anymore.

    I have worked out serial software bus already, it is not very good since on the 16f54 I must use multiplexing. The 16f59 has extra pins, so I can have a non-multiplexed RDY signal, and on the PIC32, I use an interrupt.

    Here is how it looks on the PCB!
  9. takao21203

    Thread Starter Distinguished Member

    Apr 28, 2012
    Made some progress with the PCB.

    All the extras cost a lot of money actually.
    And it will take a lot of effort to mount all the SMD components.

    However most of the components won't be neccessary in many cases.

    With all the parts included the price will move towards $30.

    -CR123 lithium ion battery + holder + charger IC
    -1.8" TFT + 16 MBit serial FLASH
    -4 keys + 4 LEDs
    -Mini USB connector, PIC32 USB controller, 3 MHz switching IC
    -16F59 + 2x 3 digit LCDs or LED 7seg displays

    With just the 16f59, LED displays + PIC32 (but no charger IC, no USB, no TFT, no CR123 battery) cost will be around $10.

    There are technologies which I never used before such as lithium Ion battery, and MOSFET switching of pheripherals. However I have used these TFT displays before, and I have used 16f5x to drive displays. If the dual LCD will actually work- I have to build a prototype. Maybe not. Dual LED will work in any case. The way it is built, any multiplexed display can be used!

    A STM32 board arrived here as well.
  10. takao21203

    Thread Starter Distinguished Member

    Apr 28, 2012
    Revolutionary. Now two PIC 16f59 will be used for display drive. The layout complexity is greatly reduced.

    -The PIC32 board can be used without displays. It has 4x LEDs and 4x keys with serial drive, so it won't use so many of the PIC32 pins.

    -The display can be used without the PIC32! I have to do some experiments for the two PICs. I want to use a clocking coil, not 2x 500 KHz resonators + capacitors. But frequency should be low to save power. Not too sure about the coil value, I will at first try a 500 KHz resonator and then select a coil which matches to that somehow.

    PIC chips arrived today.
  11. takao21203

    Thread Starter Distinguished Member

    Apr 28, 2012
    Prototype circuit for the LCDs.

    The idea is the chips would auto configure no matter what is the clocking frequency. It is not so easy to implement. The 16f59 has nothing- only one timer, no interrupts.

    I have to use the watchdog timer for this.

    Wiring up displays is far too much work to do it each time.
    Even Hitachi character displays are too much effort to wire them up.

    I have built a serial system with 3 PICs before. 3x 16f54 were used, and 2x LED displays. The serial protocol was so weird I did not even myself use the PCBs at all. It needs several balancing resistors.

    It is not as bad on the 16f59 since there is one full 8bit port remaining. Where on the 16f54 nothing remained and I had to multiplex the serial bus with the display drive.

    Imagine this on breadboard. 132 pins + 48 LCD pins.
  12. takao21203

    Thread Starter Distinguished Member

    Apr 28, 2012
    I've got the LCD working.

    One of them but the other is exactly the same.
    They are not multiplexed. So each PIC provides upto 24 I/O bits.

    It is all based on years of experience.

    1. LCDs can be controlled directly through I/O, as long as the waveform is AC. Therefor, it is XORed with the backplane drive.

    2. Advanced decoding techniques are used. The pin connections can be random. For each port a segment table is built, and they are ORed together. So any display or matrix can be used.

    3. PICs can drive LED displays directly- at least the baseline and 16F chips.

    4. A 3-wire serial bus is used to clock in the display data. There is a new idea I want to use, to transfer an acknowledge on the RDY line.This allows for better control of timeout. I had a board with 3x 16f54 already- with the serial signals multiplexed with the display. I did not want to use it even myself at all.

    5. Clocking. A 1000uH coil is used, as it is more flat than a resonator, and crystals for low frequencies do not exist. I have calculated about 650 KHz.

    There is an issue the 2nd PIC will slowly drift even if the OSC1 is shared. I want to try and connect the OSC2 as well. This has to be solved for the PCB. But why use two coils when only one is needed? Eventually I will use a resonator on the PCB anyway.
  13. takao21203

    Thread Starter Distinguished Member

    Apr 28, 2012
    I have started the thread because I am not too sure about a few things.

    Should I make a display PCB only, or also add a more powerful controller but keep components to a minimum, or should I develope a fully featured PIC32 board?

    With all the things I want it will cost me more than $20. For sure not every board needs the lithium battery and the TFT display.

    I have been thinking about this for a while and now I favour a display board only. But it is undecided.

    Over the years I have invested at least $1000 just for microcontroller display PCBs, and have made 3 different PCBs. Which all work but none of them is perfect. I also made a PIC PCB with just 4 LEDs which I sold off for less than $10. I did not really make money with it, but got some developement cost back.

    Right now I have various types of displays here, really all kind of LED 7seg, LED matrix, LCD, and color TFTs.

    LED 7seg are interesting because their low cost, and good visibility in the dark. They can also be very small. There are really tiny LED displays which you maybe don't know. But they need a lot of current, you can run them a few days from a button cell at maximum.

    Static LCDs are the best for low power. But they need a lot of wires, and are not easy to find. Old-fashion a bit but also look nice.

    Hitachi character LCDs also don't need much power, but 1mA or 2mA is still a lot for a button cell. 100uA or 200uA are much better for a button cell. The way to use them is well known but the parallel bus is way too much effort. Needs shifting register (for instanc).

    TFT LCDs are new technology, most are 3V, and need SMD handling, as well larger controllers, even FLASH chips + the technology to program FLASH. They have become cheap recently.

    So maybe dump all the old technology, only use 32bit + TFT + Lithium ion battery.

    The display board I want to produce can handle all static LCDs, LED 7seg., and also any custom made or ready-made LED matrix.

    I have researched the tech, and have built prototypes. A countless effort of work. And I figured out the 16f5x actually can drive LEDs and LED displays directly without any extra components. Maybe the 18Fs can too at low voltage- blue 7seg at 3V would only take a few mA. Which I have not tried, they are more expensive as well.

    I have Hitachi displays here, but I do not always want to use them. It is not always needed! Take 1mA at least + another mA for the controller you need at least 1 MHz or so. I want to use static LCDs, because they are cool and I also can get them new for low price. Same for LED displays, one type I can get for 50 cents (3 dig), another for 70 cents (very small 3 dig). 4-digit cost me about $1.

    I made one 16f54 PCB already for LED displays- wanted to use it for radiation counter, but then did not even wire it up completely. Somehow I did not want to proceed and to use this display PCB. Even if it is small, and looks good. Maybe I should simply proceed. In the future I won't be using TSSOP chips anymore- as the PCB pads are very small, it is difficult to solder these.

    I am waiting for some of your ideas and opinion. And I need to decide which kind of PCB I should produce. I am playing with the idea just to produce a plain display PCB- the PIC32 chips are here anyway as well most of the components.
  14. takao21203

    Thread Starter Distinguished Member

    Apr 28, 2012
    I have not received much advice.

    What I believe the serial interface with PIC 16f59 will be uncomfortable for most people- so maybe not many people would want such a board.

    Therefor, I will change the design.

    2x STM8 chips will be used, which have a serial port, and are TQFP32 chips.

    Unfortunately, PICs with TQFP32 don't exist, and TQFP44 is just on the margin to fit under the display, as well nearly double as expensive.

    I have not yet decided to make a seperate display PCB, or integrated with PIC32.

    For myself the 16f59 is good to use.

    Made a LED display timer, needs about 50% of both RAM and FLASH space. Runs from a 9.8304 MHz crystal.

    Maybe I should even make single display PCBs. Let's see if the ST8 can drive LED displays at all.

    I made the PIC 16f59 proto circuit, but the serial protocol is too much dependend on certain timing, better say, it needs some delays at the beginning. Only minimal, but if the master MCU has a high frequency, the code needs modification.

    People will be uncomfortable with that, and will need to see the source code.

    Use 9600 baud, bury the firmware, no source code.
  15. takao21203

    Thread Starter Distinguished Member

    Apr 28, 2012
    I have made a breakthrough with my older display prototype.

    It is powered by 16f54 and assembler.
    The displays work fine, however the serial protocol is so bad I don't use it myself. Of course I made it working but it needs several resistors, and certain delays, which must be adapted to the MCU clock.

    Also waiting is required for quite a long while since the serial lines are multiplexed with the display.

    Now the idea: (which I had after reading the STM8 reference manual)

    Throw the serial display into reset, then wait for the data bits to be clocked in. No timeout. No waiting required at all. No external resistors required anymore.

    Very simple serial protocol now.

    I am going to put them up for sale soon. I am thinking about 6 dollar for each of them. It is a lot of effort to mount the small TSSOP chips.

    Since assembler is used, each bit only needs a few cycles. LED displays so the 16f54 runs at high frequency.

    It can however wait even for the slowest clock. No timeout. If all bits are clocked the display will generate signals which can be tested if need be.


    Getting rich from people visiting the forum + buying stuff from my eBay.
    70 dollar/month, with 20 dollars fees. Not net profit, sales.

    I would need 100x times as many customers to call this a business. Selling stuff is a hobby for me, nothing else.