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.

LEDs and taking video of them...

Status
Not open for further replies.
On a personal note, 7 bits is passsable 8bits is 'okay' for passing fading and glow effects, but as someone who has a keen eye for the appearance of stepping effects in PWM'd LED drivers I'm going to recommend adjusting your software/hardware so that you get at least 10bits of dimming control...

I've not considered this before. My original challenge was 8-bit PWM'ing 9 LEDs via software with a 4MHz PIC (sans crystal) and that was a real struggle. Once I moved up to the 32MHz PIC 16F1825 (throwing hardware at the problem) that just went away as an issue and 8-bit software PWM for 9 LEDs is now simple and looks really good... I never thought about then increasing the PWM resolution. I think it might be worth a bit of investigation.

Piece of junk??? :eek:
 
Oh did you put your own plastic over them then? Couldnt find the ones you talk about on brightlightz.

It's this stuff... **broken link removed** ...I just didn't pay that price for it as I didn't want the remote control. 12v RGB 5050 SMD Flexible LED Colour Changing Strip Light 5 Metre / 300 LEDs... 100% Waterproof (IP65).
 
Last edited:
The reason you spent so much money is because you bought off the shelf.. You could produce the same device 1/10th the cost yourself easily. If you want to sell it for profit the 1/10th the cost per unit should catch your eye.
 
Oh, this (these?) is not for sale.

Besides, everything costs something - Perspex sheets would cost something, and then I'd need a router to drill the shapes out of it; pieces of wood to make a frame would cost me something, then I'd need various carpentry tools (and skills) to build my frame and paint it and then I'd need a glass sheet - which would cost something, I certainly can't make my LED strips - impossible... and I can't do my own PCBs easily. Besides, that was half the fun - taking something I'd done on breadboard / veroboard lots of times, using Fritzing to create the schematic, then the PCB layout, sending it off, waiting impatiently, getting it back...

...it's a hobby, innit? Just an expensive one. :D

Profit really doesn't come into it.... I already have a job that I get paid for.

I reckon with a keen eye for a bargain and oodles of spare time it could be done for 40% to 50% of the cost... but not for 10% (if we're talking similar quantities)... and time is also worth something.

I'm happy with it - I was just commenting (musing aloud really) about how expensive this electronics lark is. You know, I bought a vice the other day? I don't know why to be frank. However, it was really very good for holding my PCB while I was soldering bits into it. The fact is - I've survived this long without a vice... :eek:

My RGB LED abstract artwork manufacturing line may be slow and prone to errors, but it is a strictly not-for-profit organisation.
 
Last edited:
Feel free to private message me if you'd like Hippogriff, everything you've done I could do on a 20 dollar budget.
There is nothing expensive about electronics, only your lack of understanding about electronics.

The perspex you bought... Heavy bond paper would have worked as well, and appeared much more natural.
 
Cool. I accept your challenge... $20 for you to replicate, or better, what I've produced.

Will I have to wait many years for you to grow a tree... so you don't have to buy a wooden picture frame, backing board or the paper "off the shelf"? ;)
 
Last edited:
Give me a time frame.
 
Ha-ha, already got some saplings in the pipeline, have you? Ready to pounce when the opportunity finally arose...

Seriously, there's nothing to prove. I know electronics can be cheap... what I should've said is "I've found electronics to be an expensive hobby"... but that's fine, because I'm more short on time than I am on cash that I can spend on my hobby and - at the end of the day - I have something here that I can be proud of and that I think looks the business, i.e. kinda semi-professional. Ordering my Perspex, to my simple design, ensured that I'd get something out of the process that I actually wanted, not some self-created crappity piece of failure that I had to stand by "just because I did it".

I wanted Perspex this time because it's rigid, opaque and shiny... it looks... very clinical, which is what I was aiming for, not rustic. Also, I'd tried this before with 800 micron black Mylar and I was only barely satisfied with the results... it was much more floppy and prone to a kind of semi-noticeable sag.

Likewise, I'm not a carpenter, so I went and purchased off-the-shelf frames for my A3-sized Perspex sheet... I really can't imagine doing anything else to be honest.

Seriously, thanks for the input on PWM resolution and non-linear fades, I'll definitely be considering both.
 
Nice result Hippogriff, you should be proud! :)

If you do want to go for the non-linear fading, watch out as it tends to be different for each colour LED.

One method I played with was to do a test run with a few buttons and different PWM on each button, then tweak the PWMs so the LEDs look 25% brightness, 50% brightness etc (to your eye). Then the in-between settings 12.5%, 37.5% etc. With about 8 settings between 0 and 100% perceived brightness you can easily make a lookup table based on that curve.

It helps if you have a development board (or breadboard) with a LCD and trimpot and lots of buttons, using the LCD to display the P_WM setting while you manually tune it.
 
Nice result Hippogriff, you should be proud! :)

Thanks. You know, I kinda am. I know I can do better though...

I'm not sure that I've fully got my head around how to go about the implementation of non-linear fades yet, although I get the concept... we'll have to see. I am starting to think I'll need quite a bit of 'setup' (kind of limit / boundary / step establishing code) at the beginning of my fade routine... if I'm fading from 255,0,0 to 0,255,255 then that's easy linearly, if I'm going from 255,20,147 to 0,250,154 then that's also easy linearly... I'm wondering how much harder it becomes if you want to become more sophisticated, i.e. make sure all fades complete at the same time, or do something with a lookup sine value table.

As I say, I'm really not sure I've got my head around it yet. :(
 
Hi again,

The reason i asked about the LED strings was because the pictures on that web page did not look like the LEDs had some sort of plastic over them, but looked like single LEDs or groups of LEDs with nothing covering them. Maybe that site has better pictures somewhere?
 
Yeah, I know - but I can assure you that anything that says "IP65" will have that waterproof plastic covering.
 
Hello again,

Ok thank you Hippo. That's what had me puzzled.
 
...
I'm not sure that I've fully got my head around how to go about the implementation of non-linear fades yet, although I get the concept... we'll have to see. I am starting to think I'll need quite a bit of 'setup' (kind of limit / boundary / step establishing code) at the beginning of my fade routine... if I'm fading from 255,0,0 to 0,255,255 then that's easy linearly, if I'm going from 255,20,147 to 0,250,154 then that's also easy linearly...
...

I would use a lookup table. So your "brightness" command might still be 0-255 as it is now.

Then that command selects one of 256 entries in a brightness lookup table. (These entries are all scaled to give the correct visual brightness.) Then that entry is loaded into the PWM.

Once you have got the curve right (from testing with your exact LEDs) and generated the table, it should be pretty seamless, you do something like this;
Code:
movf brightness,w  ; put brightness command 0-255 in w
call bright_table     ; will return with the actual PWM value in w
 
I've come up with something different, but I don't feel it's correct.

Take the simplest example of fading a single LED from fully off (0) to fully on (255) then I used to have something like this...

Code:
lIndex = 0
for 255 loop
  PWMOut (lIndex)
  lIndex = lIndex + 1
end loop

Now, I went and created a small lookup table (not 255 bytes in size) that looks like the following "const byte PWMLookup8Bit[16] = {1,2,3,4,6,8,12,16,23,32,45,64,90,128,180,255}" and I use a loop that goes something like this:

Code:
PWMIndex = 0
for 15 loop
  OutPWM (PWMLookup8Bit[PWMIndex])
  PWMIndex = PWMIndex + 1
end loop

And I certainly do get a different kind of fade... but nothing that is so easily noticeable that I think it's something worth doing. So I reckon I've got it wrong. Otherwise you guys would not be telling me that it's something worth doing.

What I think I see is the first linear fade appearing to be full brightness much earlier in the fade up loop - I'd say about a quarter of the way through the loop it looks to be 100% brightness. The second way is different - it seems to only get brightest towards the end of the - much shorter - fade loop (I've actually inserted another 10 loop around the PWMOut routine to be able to see this).

Mr RB - you said a lookup table 256 bytes in size. What would I be putting in there - lots of duplicate 1s, 2s and 3s at the bottom-end? One thing worries me about this - when I tried to define a 256 byte array and fill it, my JAL compiler told me off, saying I'd ran out of data space.
 
Last edited:
I've come up with something different, but I don't feel it's correct.

Take the simplest example of fading a single LED from fully off (0) to fully on (255) then I used to have something like this...

Code:
lIndex = 0
for 255 loop
  PWMOut (lIndex)
  lIndex = lIndex + 1
end loop

Now, I went and created a small lookup table (not 255 bytes in size) that looks like the following "const byte PWMLookup8Bit[16] = {1,2,3,4,6,8,12,16,23,32,45,64,90,128,180,255}" and I use a loop that goes something like this:

Code:
PWMIndex = 0
for 15 loop
  OutPWM (PWMLookup8Bit[PWMIndex])
  PWMIndex = PWMIndex + 1
end loop

And I certainly do get a different kind of fade... but nothing that is so easily noticeable that I think it's something worth doing. So I reckon I've got it wrong. Otherwise you guys would not be telling me that it's something worth doing.

As you've no doubt already guessed, it's all in the lookup table.

First of all, you need a larger table; 256 entries would be, well, 16 times better than 16.

Think of what you're doing: you're basically creating a brute-force wave shaper (or D-to-A converter if you prefer to think of it that way). The overall profile of your dimming curve is the profile of the values in the table. Now, I have no idea how to generate those values, although I can think of several possibilities. But once you work that out, you should be able to get a significantly different visible result.

You might have to write a little program to generate your table if you want to try different mathematical functions (sine/cosine, exponentials, etc.).
 
Last edited:
I've now got this...

Code:
const byte SIN[90] = {0,3,8,12,17,21,26,30,35,39,43,48,52,57,61,65,70,74,
                      78,82,87,91,95,99,103,107,111,115,119,123,127,131,
                      135,138,142,146,149,153,157,160,164,167,170,174,177,
                      180,183,186,189,192,195,198,201,203,206,209,211,214,
                      216,218,221,223,225,227,229,231,233,235,236,238,240,
                      241,242,244,245,246,247,248,249,250,251,252,253,253,
                      254,254,254,255,255,255
                     }

I've started a sine wave chaser programme effect - using all three banks of RGB LEDs - but just using the red component. I think I've got something interesting. I start the first bank off, then after 30 iterations of that bank going through the SIN lookup table, I start the second bank, then after another 30, I start the third bank... I have some kind of visible wave thing going on.

It's kinda odd, I'm watching it with a close eye, trying to figure out if it's doing what I'm expecting it to be doing and, most importantly, if it's somehow any better looking than a simple linear 0..255 fader.

P.S. - I've decided that effect looks odd, it's not doing what I wanted, which was some kind of cross-picture fade up and out. Back to thinking.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top