Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

BoostC Charlieplexed PWM 32

Status
Not open for further replies.
How would you connect a single push button switch to disconnect GP0/ICSPDAT and GP1/ICSPCLK from the LED circuitry when you push it and hold it down?
That's what I get for posting before coffee. :D Sure it could be done, but it would take more circuitry than it's worth. My "off the top of my head" electronics knowledge is poor. It seemed like a nice idea when I posted it, but when I actually started scratching it out on paper I realized it's not so simple.


Here's a simple little pwm animation thing for your blinky device:
Code:
	led[0] = led[19] = 31;
	led[1] = led[18] = 23;
	led[2] = led[17] = 18;
	led[3] = led[16] = 14;
	led[4] = led[15] = 11;
	led[5] = led[14] = 9;
	led[6] = led[13] = 7;
	led[7] = led[12] = 5;
	led[8] = led[11] = 3;
	led[9] = led[10] = 2;

	while(1){
		temp=led[0];
		for(x=0;x<19;x++){
			led[x]=led[x+1];
			delay_ms(3);
		}
		led[19]=temp;
		delay_ms(3);
	}
}
 
Nice effect. That's "a keeper".

I can see now how easy it will be to create hundreds of patterns and variations. We're definitely going to need that mode switch (grin).

I've still got the red led bars in mine and they're incredibly bright so I toned it down a little. I also wanted a little more dark area in there, so.....

Code:
  led[0] = led[19] = 12;
  led[1] = led[18] = 9;
  led[2] = led[17] = 7;
  led[3] = led[16] = 5;
  led[4] = led[15] = 3;
  led[5] = led[14] = 1;
  led[6] = led[13] = 0;
  led[7] = led[12] = 0;
  led[8] = led[11] = 0;
  led[9] = led[10] = 0;

  while(1)
  { temp=led[0];
    for(x=0;x<19;x++)
    { led[x]=led[x+1];
      delay_ms(3);
    }
    led[19]=temp;
    delay_ms(3);
  }
}
 
It may be difficult trying to animate the leds faster than the rather slow 62.5 Hz / 16 msec refresh rate. Also note that the BoostC delay routines will run about 42% slower due to the ISR 'overhead'.

Mike
 
I've still got the red led bars in mine and they're incredibly bright so I toned it down a little. I also wanted a little more dark area in there, so.....
Hey, that looks great!

Also note that the BoostC delay routines will run about 42% slower due to the ISR 'overhead'.
I had noticed that my delays were ridiculously short and yet worked fine. Figured (correctly) it was because it's a very busy chip. :D
 
I don't understand.

You wouldn't need a slide switch at all for GP3 because that would be connected to a normally open push button switch.

How would you connect a single push button switch to disconnect GP0/ICSPDAT and GP1/ICSPCLK from the LED circuitry when you push it and hold it down?

after the switch provision, GP3 could also be used as Futz put it in an earlier reply. Perhaps could expand the design further,using GP3 .
 
after the switch provision, GP3 could also be used as Futz put it in an earlier reply. Perhaps could expand the design further,using GP3 .
I think what Mike was suggesting was to use a momentary switch for GP3 instead of a slider. Hold the button down for programming mode. Either way, it's still a switch and you'd still have the use of GP3 for input. :)
 
Hi again,

The processor isn't that busy.

When you get a chance could you try this snippet?

I removed the delay within the loop to smooth out the transitions. I also synchronized the LED update to the 16 msec frame rate. Please tell me if you notice any difference? It looks incredibly smooth here...

Code:
  led[0] = led[19] = 12;
  led[1] = led[18] = 8;
  led[2] = led[17] = 5;
  led[3] = led[16] = 3;
  led[4] = led[15] = 2;
  led[5] = led[14] = 1;
  led[6] = led[13] = 1;
  led[7] = led[12] = 0;
  led[8] = led[11] = 0;
  led[9] = led[10] = 0;

  while(1)
  {
    temp=led[0];
    while(colpos != 0b00100000);    // sync' to 16-msec frame interval
    for(x=0;x<19;x++)
    { led[x]=led[x+1];
    }
    led[19]=temp;
    delay_ms(26);
  }
}
 
I think what Mike was suggesting was to use a momentary switch for GP3 instead of a slider. Hold the button down for programming mode. Either way, it's still a switch and you'd still have the use of GP3 for input. :)
Sorry for the confusion guys. I installed a push button switch on my board to use within the program for selecting different modes. Then I suggested that you don't really need the ICSP/RUN slider switch because the push button switch is normally open and it won't adversely affect PICKit2 programming operations.
 
Sorry for the confusion guys. I installed a push button switch on my board to use within the program for selecting different modes. Then I suggested that you don't really need the ICSP/RUN slider switch because the push button switch is normally open and it won't adversely affect PICKit2 programming operations.
OK, now I'm really confused. :p Doesn't the programmer need to hit VPP with 13V to program the chip? Or does it both connect VPP to ICSP and change modes at same time when pressed?

EDIT: Oh. It's connected to VPP until you press the button? That makes sense.
 
Last edited:
When you get a chance could you try this snippet?

I removed the delay within the loop to smooth out the transitions. I also synchronized the LED update to the 16 msec frame rate. Please tell me if you notice any difference? It looks incredibly smooth here...
Nice. Smooth as buttah! :D
 
Oh. It's connected to VPP until you press the button? That makes sense.
Well I don't have an ICSP jack on my board but if I did the switch would always be connected to the VPP pin on the ICSP connector so you would have to make sure you didn't press the push button while you were programming the PIC.

I suppose if I were to put an ICSP connector on the board I would just use three jumpers to isolate the GP0, GP1, and GP3 pins and ICSP signals from the rest of the circuit.

Again, sorry about the confusion.

Also updated my drawing (below) to show the new push button switch and to show the RS-232 connector which has been on the board (but not included in the schematic).

Mike
 

Attachments

  • PWM-20 schem 2.PNG
    PWM-20 schem 2.PNG
    55.9 KB · Views: 300
Last edited:
Well I can see there's a whole new set of skills I need to master to put videos up on YouTube (grin). You guys make it looks so easy (grin).

Anyway, here's a link to the video of that last program in operation; Charlieplexed PWM-32

The LEDs are still washing out or overloading the camera and I don't know how to tone it down to get good video. Those LED patterns are really very crisp and clear in person with a very nice fading effect.

I've also attached an updated program listing because the listing in the very first post is missing an instruction at the top of the ISR to clear the Timer 2 interrupt flag (oops!). Sorry guys.

Mike
 

Attachments

  • 12F683_Test_v1.txt
    7.8 KB · Views: 249
Well I can see there's a whole new set of skills I need to master to put videos up on YouTube (grin). You guys make it looks so easy (grin).

Anyway, here's a link to the video of that last program in operation; Charlieplexed PWM-32

The LEDs are still washing out or overloading the camera and I don't know how to tone it down to get good video. Those LED patterns are really very crisp and clear in person with a very nice fading effect.

I've also attached an updated program listing because the listing in the very first post is missing an instruction at the top of the ISR to clear the Timer 2 interrupt flag (oops!). Sorry guys.

Mike
Very Nice Mike! Perhaps top row can be from left to right while bottom on the reverse. like two trains traveling in opposite directions.
 
Thank you. It looks much nicer in person than it does in the video.

Looks like Futz has also put his version up on his site and it looks very nice. He mentioned my name too. Cool. I'm famous (grin)...

**broken link removed**
 
Last edited:
The LEDs are still washing out or overloading the camera and I don't know how to tone it down to get good video. Those LED patterns are really very crisp and clear in person with a very nice fading effect.
It's the sensors they use in these digi cameras. Mine can't take a decent picture of any LED, including LCD backlights. Colors are always wrong and blown out over-bright like you say.

One thing I noticed is that the Kodak that Atomsoft uses must have a different sensor because his LCD backlight pics look great! In fact, they look oversaturated to the point that it should be toned down a bit.

Kodaks almost always come out at the bottom of the pack in reviews, but they may be good for LED pictures. If I knew anybody who owned one I'd borrow it to confirm this hypothesis.
 
Futz, your photos and videos still look much better than mine. As I look at them it seems you have much better (brighter) lighting in many of them. Perhaps I'll give that a try when I have more time.

Mike
 
Futz, your photos and videos still look much better than mine. As I look at them it seems you have much better (brighter) lighting in many of them. Perhaps I'll give that a try when I have more time.
It's vitally important to have tons of light for macro photography. Here's a quote from an older post of mine
How did that pic get to be so white? Did you use flash? If so, here's my tip of the day. In general, NEVER use flash on macros. If you have a fancy remote flash that you can bounce off the ceiling or something to diffuse it, then fine. If it's just a garden variety point-and-shoot camera, disable the flash while shooting macros. Use daylight or artificial, but lots of it, because these little cameras have little lenses. They don't gather much light. Your light should be diffused and non glarey and from all directions to prevent sharp shadows

Use the tightest aperture (biggest F number) you can (AV Priority), to get decent depth of field. This means you gather less light (smaller aperture) so you have to pour the light to it.

Depth of field means that nearer parts and farther away parts of your photo will both be in focus. Shallow DOF (large aperture = small F number) means that your focus range might be as narrow as 1/2". Everything else is out of focus. But you need less light because of the bigger aperture. Deep DOF (small aperture = large F number) means that your focus range will be much larger. But you need more light because of the smaller aperture. (Aperture is the size of hole the light goes thru inside the lens to get to the film (or sensor, in digi cams)).

Using a smaller aperture (bigger F number) to get good DOF also means that, unless you can provide a LOT of light, you need to use longer exposures. That means using a tripod and the timer (unless you have a remote shutter release) to prevent your finger pushing the button from shaking the camera.

Digital cameras sort of emulate film by providing you with a range of ISO's. Depending on your camera, you might get away with as high as 200 - 400 (I stay down at 50 - 100), but the higher you go, the more noise. The pics get more grainy and crappy. Keep the ISO as low as possible. If your camera has auto-ISO, disable it for technical shooting. It's fine for pics of the fam damily outdoors, but not for tech shoots. This again means you need more light. Higher ISO films are "faster" and need less light. But their photo quality is lower.

And last, but not least, THE MOST IMPORTANT THING YOU MUST KNOW ABOUT DIGITAL CAMERAS is how to manage White Balance. Before you shoot any photo, put a piece of pure white paper or card stock where your target is going to be, and at the same angle, and custom set your white balance. Don't rely on auto white balance (AWB). The presets are sort of ok sometimes, but not very accurate.

Different shots at different angles, different times of day, different kinds of artificial and natural light, etc., all can strongly affect where your white balance should be set. For fun, custom adjust it to crazy colors, effectively telling the camera that green is white or blue is white or whatever.

If you don't set white balance correctly you'll spend lots of time in Photoshop or Gimp color correcting your photos. I color correct probably 90% of my pics anyway, at least a little, even with good white balance. That's another article. It's real easy to color correct with those tools, but the technique isn't obvious if you haven't done it before. The auto-color-correct filters in those programs DO NOT WORK. They might do an acceptable job on 1 out of 1000 photos, if you're lucky. You must do it manually.

For macro shooting, a dirt cheap homebuilt light box (or light tent) is a perfect cure for a lot of the above problems. They're very simple to make. Here's some links:
Light Box / Light Tent Photo Gallery by Bill Huber at pbase.com
**broken link removed**
**broken link removed**

End of lesson 1
 
Last edited by a moderator:
Mike please help me I have a problem.

I’m confused with the duty cycle & the refresh rate in a LED matrix system.

Are they are two different things or one?

In your schematic it says 20% duty cycle. Does it means each LED driving on 20% duty cycle? 20% means almost 1/5 from the brightness, which is too dim.

If I have a matrix of 5 columns & 8 rows is there any formula to calculate the best delay in between the columns? So I can display it nicely without flickering & with a decent brightness.
 

Attachments

  • FX7WSQ2FHM8R2A6.MEDIUM.jpg
    FX7WSQ2FHM8R2A6.MEDIUM.jpg
    29.5 KB · Views: 216
Mike please help me I have a problem.

I’m confused with the duty cycle & the refresh rate in a LED matrix system.

Are they are two different things or one?
They are two different things.

Duty cycle is the amount of time in a period that an LED is lighted. In that 5 column display each column is updated one at a time and so each LED in that matrix can be lighted for 20% or 1/5th of the time.

Refresh rate is how often you light each LED in the display over time. It's usually expressed in Hertz (cycles per second). In that 5 column display each column is lighted for 3.2 msecs and so it will take 16 msecs to update the entire 5 column display. The refresh rate is therefor 1 / 0.016 seconds = 62.5 Hertz.

In your schematic it says 20% duty cycle. Does it means each LED driving on 20% duty cycle? 20% means almost 1/5 from the brightness, which is too dim.
Yes, each LED can be lighted 20% or 1/5th of the time. A 20% duty cycle is pretty good for a multiplexed LED display.

The duty cycle pretty much determines 'peak' current requirements to light an LED to full brightness. To get a brighter display you can increase the duty cycle and/or increase 'peak' current available to the display.

If I have a matrix of 5 columns & 8 rows is there any formula to calculate the best delay in between the columns? So I can display it nicely without flickering & with a decent brightness.
My understanding is that a refresh rate of less than about 60 Hz may cause an LED display to be perceived as flickering.

If you're updating your display one column at a time and you'd like a 60 Hz refresh rate, then;

1/"number of columns"/"refresh rate" = "update interval"
1/5/60 = 0.00333 seconds (3.33 msecs)

You can also use that formula to test different interval timing;

1/"number of columns"/"update interval" = "refresh rate"
1/5/0.002 = 100 Hertz (when using 2 msec update interval)

As I mentioned, to improve brightness you would increase duty cycle and/or increase 'peak' current available to the display.

Regards, Mike
 
Last edited:
Status
Not open for further replies.

Latest threads

Back
Top