PIC 16LF1709 LED matrix PCB

Discussion in 'General Electronics Chat' started by takao21203, Dec 22, 2014.

  1. takao21203

    Thread Starter Distinguished Member

    Apr 28, 2012
    I am announcing the release of this new PCB design for next January.

    It will be available as DIY kit (for soldering yourself),
    assembled with LED (available in most colors),
    without LEDs soldered, and small TFT displays available as well (with serial port).

    The LED matrix is 5x10.
    The controller is a newly released 8bit PIC, with many powerful pheripherals,
    such as 8bit D/A converter, and logic cells.
    New for this PIC, the pheripheral IO can be routed freely with a multiplexer.

    There is a small display drive onboard, which also can be used for 7segment, and LED dot matrix modules.

    Besides that there are no extra devices except a SOIC pad for 8 pin IC, and row headers, as well
    space for pushbuttons.

    Investing to release a PCB takes a lot of resources, and it takes months until samples become available then maybe it starts to sell off slowly, stretching over half a year. So I started to sell regular components too. It makes it easier to design PCBs. I havent abandoned the plan to release PCBs!

    Its almost like a small Arduino.

    Did you know most Arduino sketches can run on new PICs? Only minor changes for the IO are neccessary.

    With this new PCB, people can forget about the 16F84 or 16F628- they are just too limited with their small 1K memory.

    Source code to use the serial TFT will be available too.

    LED matrix has many advantages- long life, high brightness, can work in cold and harsh environment, doesnt break as easily as LCD glass. If the text is too large, it can scroll trough slowly. With this controller, its no problem, it has enough FLASH and RAM. No assembler is required to save code space.

    Maybe you saw the scrolling message bagde already some time- its similar just a more powerful controller.

    I really think 16F84 and the like should be considered outdated, something like the 16F1709 could be the starting point for using small 8 bit controllers.

    With a small LED matrix + LED display drive, example source codes for this, and TFT source code, such a PCB will now become available, at a fraction you'd pay for a regular development kit, pricing compareable to a plain Arduino.

    Commercial business? I had 20000 LEDs here of which maybe half are sold now, and have ordered 12000 more, with another 6000 scheduled. Just to give you an idea.

    First batch will be 50pcs, probably gold plated.

    DSC03146.jpg pcb.jpg schematic.jpg 151437133_624.v1352888449.jpg
  2. takao21203

    Thread Starter Distinguished Member

    Apr 28, 2012
    there is a facility for MCP1640 too, which is a step up DC/DC converter.
  3. nerdegutta


    Dec 15, 2009
    You know, there is an export funtion in Eagle, to export the schematic as an image...
  4. takao21203

    Thread Starter Distinguished Member

    Apr 28, 2012
    there is nothing on the PCB besides a small display drive, and provision for MCP1640.
    Its just row headers, and anyway, the parts arent in the library, so it would look strange.

    Its just a breakout board like an Arduino, with LED matrix.
  5. takao21203

    Thread Starter Distinguished Member

    Apr 28, 2012
    If you help me make some $100 sales I could afford an external TFT panel for my small netbook + make a larger screenshot. Its not possible now. No seriously, would you like to see the schematic in 1:1 size? Its not a big deal to export it. Yes I know of it.
  6. nerdegutta


    Dec 15, 2009
    OK, just asking. :)
  7. takao21203

    Thread Starter Distinguished Member

    Apr 28, 2012
    ok its really not a big deal.

    Maybe you have any suggestions what should be on the PCB? The Display drive is appropiate for small number of LEDs, it has digital MOSFETs, so there isnt as much brightness variation when driving directly through IO.

    That would need a larger TQFP44 IC and still tie up many pins, while it is simple to turn off the /OE from the serial registers, and free up the IO.

    I have built this kind of display drive many times.

    If no LEDs are used, small modules can be attached directly on the surface in that area.

    There is no crystal by default! But there is a grid area where some small parts can be soldered. And pads for one SOIC8 IC directly.
  8. takao21203

    Thread Starter Distinguished Member

    Apr 28, 2012
    in case you wonder about the capacitors under the LED matrix, its just pads for multiplexed keys
  9. nerdegutta


    Dec 15, 2009
    Do you mean C4-C8? Why not use the proper pads symbol instead?
  10. takao21203

    Thread Starter Distinguished Member

    Apr 28, 2012
  11. takao21203

    Thread Starter Distinguished Member

    Apr 28, 2012
    you can use the new Code Configurator with this MCU.
    Basically you see the pheripherals, and instead of consulting the datasheet and dabbling with binary patterns, you set it interactively.

    It has many new special pheripherals and the intended buyers for the PCB would want to try them out eventually.

    If you need a total beginners MCU evalution board with a larger space and more plenty of keys and LEDs, you can get them from Microelectronica.

    there will be a PDF too, explaining the PCB, and how to use the components.
    Basiccally, the pheripherals now can be routed internally with a matrix, so its no longer needed to print it on the PCB. Its a big advantage!

    This MCU has OpAmps, logic cells, zero crossing detection, D/A converter, larger stack, larger RAM, serial ports.
    I'm using these ICs now for new PIC circuits.
  12. takao21203

    Thread Starter Distinguished Member

    Apr 28, 2012
    a while ago i sold some of this PCB.

    While it is also a relatively new PIC, and it serves some purposes, it wasnt ideal,
    so I didnt produce another batch. It also has MCP1640 converter, so can work from a single battery cell.

    The tiny LEDs were actually reflowed you cant get it exactly straight with manual soldering.

    The photo was made on the evening before the Fukushima incident, I watched "Dark Cauldron", a disney cartoon.

    The new PCB is about 92 x 60mm, also relatively small. The PIC is a SOIC, easy to solder manually (just not with a point tip). The SOT23 MCP1640 I can also do with 50W station, after some experience, its not easy but can be done holding the broad tip at a certain angle. I tried reflow but since no stencil was used and the solder paste was dilluted again with lighter fluid, it needed rework anyway. SOT23 needs a stencil and solder paste in perfect suspension condition.
  13. takao21203

    Thread Starter Distinguished Member

    Apr 28, 2012
    Eventually this one wasnt reflowed. What annoyed me was the attaching of the pushbutton it was quite difficult since the gap was too small.
  14. takao21203

    Thread Starter Distinguished Member

    Apr 28, 2012
    The PCB currently is produced in Shenzen. I will have them here in less than a week probably.

    It will be available as scrolling message tag, and also as DIY for soldering yourself. With source codes too.
    LEDs in many colors are available.
  15. takao21203

    Thread Starter Distinguished Member

    Apr 28, 2012
    The PCB was produced. I will have a few here soon.
    Actually it doesnt have capacitive touch sensing.


    PIC 16LF1709
    MCP1640 possible for single battery / double primary cell
    pads for I2C SOIC8 chip
    5x10 LED matrix with serial drive circuit + MOSFETs
    prototype area
    space for row header connectors can carry components too
    6 pushbuttons possible
    serial LED driving circuit can be detached completely (wire bridges)

    absf likes this.
  16. takao21203

    Thread Starter Distinguished Member

    Apr 28, 2012
    i just paid $300 for the PCBs probably I will have them next Monday.

    It doesnt sound much money maybe, but the PCB needs LEDs too, controller chips, and other parts.
    $1000 or close to it!

    Thats why I started selling electric parts, so I can just pay for a PCB and life goes on as normal.

    Some will maybe sell over time, but it will take months. And i want to produce more PCBs!

    I have taken some photos today for the AM radio kits, and some more parts I'm going to list.

    Next I plan a large 7-segment PCB, made from 2x3x4 rectangle LEDs.

    Different colors are possible, its larger, very bright, and has serial interface.
    For instance emerald green! It needs 5 volts tough, 2 LEDs in series, have to test that soon, if it is bright enouigh, or needs a complicated high voltage drive (sinking with the PIC + enabling with PNP transistors).

    I have the prototype wired up now, all segments light up, looks pretty good!
  17. takao21203

    Thread Starter Distinguished Member

    Apr 28, 2012
    OK DHL has them here since Monday, took them until today to clear it, then failed to deliver it.
    I saw the guy driving around with the van, 5 phone calls, still fail.
    Maybe tomorrow. I'm not particulary happy about it.
  18. takao21203

    Thread Starter Distinguished Member

    Apr 28, 2012
    Here's a picture, currently assembling one of PCBs.

    I will sell it as DIY kit for low cost, but I need to charge at least $20 for assembly- it takes quite a while and needs to be done carefully.

    The DIY kit would be good to learn SMD- instructions included. Basically you just need a broad soldering tip.

    The pushbuttons fit exactly- thats good luck, I didnt actually check.

    Demonstration source code will be available free, I only need to port it.
    The serial display can be disconnected easily or just disabled, these signals are labelled. The other IO connections are straightforward.

    Capacitors are mounted near all chips, 4.7uF 0805

    There is a small prototype raster area, and unconnected row header holes, as well traces for a SOIC8 IC such as serial FLASH or I2C device.

    There is a seperate LED with resistor too.

    You need a PICKIT3 for this MCU, and the code configurator can be used.

    Price point for a DIY kit is $10 to $12, depends if the MCP1640 is populated or not. I'd do that for the customer since SOT23-6 isnt easy manually. Fixed voltage but it can be changed on the PCB (basically a voltage divider for the feedback).

    I havent found any errors bugs or mistakes so far, well the clearance for some vias is a bit sharp.

    LEDs are available in almost all colors.

    Discounts are available for instance just PCB + MCU, do it all yourself

    The PIC 16LF1709 has large program memory + large RAM, and many interesting devices, for instance 8 bit D/A, and logic cells (the board could be programmed in software to emulate a few small digital logic gates + this can be changed on the fly in software).

    Its a brand new MCU, and I did choose it because I think its a good starting point for 8 bit MCUs.
    LED matrix display is tolerant for temperature and shock exposure, bright, and available in many colors. Low currents such as a few mA are possible with modern LEDs.

    Numeric values or text can be scrolled through, source code for this is supplied, and comfortable menu is possible with 6 pushbuttons.

    The MCP1640 allows operation from a single or 2 batteries, with stable output voltage over all the battery life.

    Source code to use a small serial TFT will be supplied too. It can be mounted in the row header area, and only needs a SPI connection.

    No crystal is needed but it can be added close to the MCU in the row header area.
  19. takao21203

    Thread Starter Distinguished Member

    Apr 28, 2012
    It seems to be working. Wrote some code, and immediately some LEDs started to blink

    Code (Text):
    2. /******************************************************************************/
    3. /* Files to Include                                                           */
    4. /******************************************************************************/
    6. #if defined(__XC)
    7.     #include <xc.h>         /* XC8 General Include File */
    8. #elif defined(HI_TECH_C)
    9.     #include <htc.h>        /* HiTech General Include File */
    10. #endif
    12. #include <stdint.h>        /* For uint8_t definition */
    13. #include <stdbool.h>       /* For true/false definition */
    15. #include "system.h"        /* System funct/params, like osc/peripheral config */
    16. #include "user.h"          /* User funct/params, such as InitApp */
    18. /******************************************************************************/
    19. /* User Global Variable Declaration                                           */
    20. /******************************************************************************/
    22. /* i.e. uint8_t <variable_name>; */
    24. /******************************************************************************/
    25. /* Main Program                                                               */
    26. /******************************************************************************/
    28. #define ser_rck LATAbits.LATA4
    29. #define ser_sck LATAbits.LATA1
    30. #define ser_dat LATCbits.LATC5
    31. #define ser_oe LATAbits.LATA5
    33. extern unsigned char flags;
    35. #define led_toggle_time 0x20
    36. #define flags_led 0x02
    37. #define flags_timer_int 0x01
    39. #define testprg
    41. #ifdef testprg
    42.  unsigned char line_ctr;
    43.  #define line_tst_data1 0x03
    44.  #define line_tst_data0 0xff
    45.  unsigned char MOSFET_tst[]={0x1,0x02,0x04,0x08,0x10};
    46. #endif
    48. unsigned char latch_a,latch_b;
    50. // latch B
    51. // 0x01 LED
    52. // MOSFETs
    53. // 0x40 line 8
    54. // 0x80 line 9
    56. // latch A
    57. // 0x80 line 7
    58. // 0x01 line 0
    60. unsigned char line_0,line_1,mosfets;
    61. unsigned char ctr;
    63. void toggle_led()
    64. {
    65.  if(flags&flags_timer_int)
    66.  {
    67.      flags&=0xff-flags_timer_int;
    68.      ctr++;
    69.  }
    70.  if(ctr==led_toggle_time)
    71.  {
    72.      ctr=0;
    73.      flags^=flags_led;
    74.      #ifdef testprg
    75.      line_ctr++;
    76.      if(line_ctr==5)line_ctr=0;
    77.      mosfets=MOSFET_tst[line_ctr];
    78.      #endif
    79.  }
    80. }
    82. void update_latches()
    83. {unsigned char tmp;
    84.    if(flags&flags_led)latch_b=1;else latch_b=0;
    85.    tmp=mosfets<<1;
    86.    latch_b|=tmp;
    87.    tmp=line_1<<6;
    88.    latch_b|=tmp;
    89.    latch_a=line_0;
    90. }
    92. void update_display()
    93. {unsigned char i;
    94.  for (i=0;i<8;i++)
    95.  {
    96.      ser_dat=0;if(latch_a&0x80)ser_dat=1;
    97.      ser_sck=1;latch_a<<=1;ser_sck=0;
    98.  }
    99.  for (i=0;i<8;i++)
    100.  {
    101.      ser_dat=0;if(latch_b&0x80)ser_dat=1;
    102.      ser_sck=1;latch_b<<=1;ser_sck=0;
    103.  }
    104. ser_rck=1;
    105. ser_rck=1;
    106. ser_rck=0;
    107. }
    109. void main(void)
    110. {
    111.     OSCCONbits.IRCF=0b1110;
    113.     ANSELAbits.ANSA1=0;
    114.     ANSELAbits.ANSA4=0;
    115.     ANSELAbits.ANS5=0;
    117.     ANSELCbits.ANSC3=0;
    119.     TRISAbits.TRISA1=0;
    120.     TRISAbits.TRISA4=0;
    121.     TRISAbits.TRISA5=0;
    123.     TRISCbits.TRISC5=0;
    125.     INTCONbits.TMR0IE=1;
    126.     INTCONbits.GIE=1;
    127.     OPTION_REG=0x85;
    129. #ifdef testprg
    130.     line_ctr=0;
    131.     line_1=line_tst_data1;
    132.     line_0=line_tst_data0;
    133. #endif
    135.     ser_sck=0;
    136.     ser_rck=0;
    137.     ser_oe=1;
    138.     ser_dat=0;
    140.     latch_a=0;latch_b=0;
    141.     ser_oe=1;
    142.     update_latches();
    143.     update_display();
    144.     ser_oe=0;
    146.     /* Configure the oscillator for the device */
    147.     ConfigureOscillator();
    149.     /* Initialize I/O and Peripherals for application */
    150.     InitApp();
    152.     while(1)
    153.     {
    154.     toggle_led();
    156.     update_latches();
    157.     update_display();
    160.     }
    162. }
    I found at 32 MHz, I need to set the clock signal two times, or the pulse is just too short. Maybe because the voltage is less than 5 volts?

    Now need to solder the rest of the LEDs, and write more code.
  20. takao21203

    Thread Starter Distinguished Member

    Apr 28, 2012
    Checker pattern was programmed. I've tightened the source a little, its just 100 lines now, using 4% of the memory.

    MCU runs at full 32 MHz, refresh isnt synchronized now (is repeated as fast as possible).
    The multiplexing is synchronized with a timer interrupt which also blinks the LED.

    Assembly actually takes quite a while. Had a short to a via under a LED, one other between LED pins.

    The 16LF1709 is easy and comfortable to work with, actually it is not (yet ?) supported in the code configurator.

    Runs at 3.0 volts now, brightness is appropiate for indoors, artificial light, probably wont be visible much in bright daylight.

    Code (Text):
    2. #include <xc.h>         /* XC8 General Include File */
    3. #include "system.h"        /* System funct/params, like osc/peripheral config */
    4. #include "user.h"          /* User funct/params, such as InitApp */
    6. #define ser_rck LATAbits.LATA4
    7. #define ser_sck LATAbits.LATA1
    8. #define ser_dat LATCbits.LATC5
    9. #define ser_oe LATAbits.LATA5
    11. extern unsigned char flags;
    13. #define led_toggle_time 0x20
    14. #define flags_led 0x02
    15. #define flags_timer_int 0x01
    17. #define testprg
    19. unsigned char MOSFET_drive[]={0x1,0x02,0x04,0x08,0x10};
    20. unsigned char display_mem[10];
    21. unsigned char latch_a,latch_b;
    23. // latch B
    24. // 0x01 LED
    25. // MOSFETs
    26. // 0x40 line 8
    27. // 0x80 line 9
    29. // latch A
    30. // 0x80 line 7
    31. // 0x01 line 0
    33. unsigned char line_0,line_1,mosfets;
    34. unsigned char ctr,phase_ctr,phase;
    36. #define phase_period 0x02
    38. void toggle_led()
    39. {
    40. if(flags&flags_timer_int)
    41. {
    42.      flags&=0xff-flags_timer_int;
    43.      ctr++;phase_ctr++;
    44. }
    46. if(phase_ctr==phase_period)
    47. {
    48.      phase_ctr=0;
    49.      line_0=display_mem[phase];
    50.      line_1=display_mem[phase+1];
    51.      mosfets=MOSFET_drive[phase>>1];
    52.      phase+=2;if(phase==10)phase=0;
    53. }
    54. if(ctr==led_toggle_time)
    55. {ctr=0;flags^=flags_led;}
    56. }
    58. void update_latches()
    59. {
    60.    if(flags&flags_led)latch_b=1;else latch_b=0;
    61.    latch_b|=line_1;
    62.    latch_b|=mosfets<<1;
    63.    latch_a=line_0;
    64. }
    66. #define la_1 ser_dat=0;if(latch_a&0x80)ser_dat=1;ser_sck=1;latch_a<<=1;ser_sck=0
    67. #define la_2 ser_dat=0;if(latch_b&0x80)ser_dat=1;ser_sck=1;latch_b<<=1;ser_sck=0
    69. void update_display()
    70. {
    71. la_1;la_1;la_1;la_1;la_1;la_1;la_1;la_1;
    72. la_2;la_2;la_2;la_2;la_2;la_2;la_2;la_2;
    73. ser_rck=1;ser_rck=1;ser_rck=0;
    74. }
    76. void main(void)
    77. {
    78.     phase=0;phase_ctr=0;
    80. #ifdef testprg
    81. display_mem[0]=0b00100001;display_mem[1]=0b00000000;
    82. display_mem[2]=0b01110011;display_mem[3]=0b10000000;
    83. display_mem[4]=0b11111111;display_mem[5]=0b11000000;
    84. display_mem[6]=0b01110011;display_mem[7]=0b10000000;
    85. display_mem[8]=0b00100001;display_mem[9]=0b00000000;
    86. #endif
    88.     OSCCONbits.IRCF=0b1110;
    89.     ANSELAbits.ANSA1=0;ANSELAbits.ANSA4=0;ANSELAbits.ANS5=0;ANSELCbits.ANSC3=0;
    90.     TRISAbits.TRISA1=0;TRISAbits.TRISA4=0;TRISAbits.TRISA5=0;TRISCbits.TRISC5=0;
    91.     INTCONbits.TMR0IE=1;INTCONbits.GIE=1;OPTION_REG=0x85;
    93.     ser_sck=0;ser_rck=0;ser_oe=1;ser_dat=0;
    94.     latch_a=0;latch_b=0;ser_oe=0;
    96.     /* Configure the oscillator for the device */
    97.     ConfigureOscillator();
    98.     /* Initialize I/O and Peripherals for application */
    99.     InitApp();
    101.     while(1)
    102.     {toggle_led();update_latches();update_display();}
    103. }
    There is a website which will be populated soon

    Actually there is no brightness variation, the digital camera is fooled by the multiplexing.