Page 1 of 1
Forum

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!




LED Effects - Star ...
 
Share:
Notifications
Clear all

[Solved] LED Effects - Star Trek Phaser Array

223 Posts
14 Users
33 Likes
81.7 K Views
 Hans
(@hans)
Famed Member Admin
Joined: 11 years ago
Posts: 2660
Topic starter  

Hi Snooker216!

I haven't build any Star Trek models, so maybe @Trace or @janesmouse is the person to chime in here.
Using LED strips is probably the easiest, programming and electronics wise. You may want to search for "micro LED strips" - they are more narrow than regular LED strips.

I found some example pictures:

 

Maybe this is helpful. 😊 


   
ReplyQuote
(@trace)
Estimable Member
Joined: 4 years ago
Posts: 168
 
Posted by: @snooker216

Hi everyone,

I am actually working on the build of a U.S.S. Voyager in scale 1/670 Revell set.

My plan to realize the phasers is a little bit different. Because the color of the Phasers is not really changing i will use 0402 SMD LEDs in orange controlled seperately. To have enought ports to control them I will use an

Arduino Mega. I plan to use 20 LEDs on each upper phaser bank. And I will select randomly if the right or left half will fire. To achieve this I will control the power for the LEDS via PWM over a Mosfet. So I have

the possibility to control the flickering at the end of the firing sequence.

The phasers of the voyager don't have this moving sequence from both sides to the final firing point. So the programming should not be that difficult. At least I hope so.

The navlights i will outsource to an ATTiny85-20. So I can avoid any delay programming.

Reading here i wondered for what scale you are developing. Realising this with a RGB LED strip in a 1/670 Voyager i find more than only challenging.

In the final stage I want to control this all with an LCARS touch panel. But at the moment I have no idea how to do this.

Hi snooker,

do you have a code for doing the phaser with normal LED´s? As far as I know, the Voyager had a phaser sequence only from one side. So the easiest way is to let a chasing led sequence running and the last led to flicker. But to be hones, I dont know how to code this. All what I do is to search for similar codes and change them to my needs.

The coding Hans and I developing is for adressable LED´s, which makes it easier to code effects and only needs one pin for a whole bunch of LED´s.

In your case, Iam thinking about Arduino in combination with a shift register. Just google it and you will find examples with LED´s. Maybe there is some kind of code you can use.

The scale of the models is different. 1/1400 for the Enterprise D and 1/72 for a Runabout. Maybe you can also fit a WS2812 strip in your Voyager. Then it would be easier to adapt the existing phaser array code.

To make a touch panel, I will use a backlit acrylic-plate, which will have a printed foil behind it and so called capacitive switches.

But at the moment, I really have no time for doing model stuff in freetime.

 


   
ReplyQuote
(@trace)
Estimable Member
Joined: 4 years ago
Posts: 168
 

@hans

Hi Hans, how are you doing?

Did you had some time to work on the combination of our effect codes?

I´m just asking carefully, cause I know that you are also busy all the time.


   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 11 years ago
Posts: 2660
Topic starter  
Posted by: @trace

Hi Hans, how are you doing?

Did you had some time to work on the combination of our effect codes?

I´m just asking carefully, cause I know that you are also busy all the time.

Hi Trace! How are you doing?
Doing "OK" here - can't complain I suppose ... still looking for work 😞 

I actually was planning on looking into this week.
Maybe we should start a separate topic to discus the details of what we want in the sketch - it's been a while 😉 


   
ReplyQuote
(@trace)
Estimable Member
Joined: 4 years ago
Posts: 168
 
Posted by: @hans
Posted by: @trace

Hi Hans, how are you doing?

Did you had some time to work on the combination of our effect codes?

I´m just asking carefully, cause I know that you are also busy all the time.

Hi Trace! How are you doing?
Doing "OK" here - can't complain I suppose ... still looking for work 😞 

I actually was planning on looking into this week.
Maybe we should start a separate topic to discus the details of what we want in the sketch - it's been a while 😉 

Hi Hans, thanks for asking. Im ok too. Due to unsure assignments cause of Corona, I have a lot of work to do to finish projects as fast as possible to get the money before they maybe cancel those projects.

Yes, would be a good idea to open a new topic, so we can gather the existing codes and talk about which effect we want to combine.

So.....how do I open a new topic? :D


   
ReplyQuote


 Hans
(@hans)
Famed Member Admin
Joined: 11 years ago
Posts: 2660
Topic starter  

I started a new topic: Star Trek Led Effects Project

I have yet to find the code to post there, but in the meanwhile it is getting late - something to start with tomorrow 😊 

(I can mark the new topic as private, but it is completely unclear to me how it works. I cannot even select who can or cannot see the topic - so I'll keep it a public topic)


   
ReplyQuote
(@snooker216)
New Member
Joined: 3 years ago
Posts: 4
 

Hi Trace,

at the moment i have no code for the effect. But exactly these chasing LEDs I want to realise. I am not the big programmer.

But there is no real need for heavy multiple effects at the same time. As I said the blinkin of the navlight

I will put into an ATTiny85-20 to avoid as much delay() as possible. So a simple routine with a for() loop should do the trick.

I will organize the LEDs in an array() and then simply will in the for() loop go through the array() to the firing LED lighting 2 or maybe 3 adjacent LEDs in every loop.

At last the flickering for the firing LED ist realized controlling the LED voltage with a PWM controlled logic level Mosfet. Maybe i try to slowly increase the brightness of the chasing LEDs this way too. Depends on how this looks.

This idea came into my mind just now. So joining here seems to be worth it! ;-)

The MEGA 2560 PRO Embed I'm using has 54 digital pins and 16 analog pins. And it has a nice little footprint of 38x55mm. So at the moment there is not need for shift registers.

I really know LED strips. I build my own Ambilight for my flatscreen. So I know what they can. This is not my problem. From this point of view they absolutely would be the better choice.

My decision came more from the model maker side. The strips are not really bendable in the needed direction to get the curve of the phaser bank. So I would have to cut them off and rewire them.

Second point is the size. I want to build the model as clean as possible. A 0402 LED has the size of a salt grain and is nearly invisible. With the strip LEDs I have the problem to get the light from

the inner side to the outside of the phaser bank. And I think a fibre will never be that bright the pure LED can be.

 

p.s. When I have some code I will post it here.

This post was modified 3 years ago by snooker216

   
ReplyQuote
(@trace)
Estimable Member
Joined: 4 years ago
Posts: 168
 
Posted by: @snooker216

Hi Trace,

at the moment i have no code for the effect. But exactly these chasing LEDs I want to realise. I am not the big programmer.

But there is no real need for heavy multiple effects at the same time. As I said the blinkin of the navlight

I will put into an ATTiny85-20 to avoid as much delay() as possible. So a simple routine with a for() loop should do the trick.

I will organize the LEDs in an array() and then simply will in the for() loop go through the array() to the firing LED lighting 2 or maybe 3 adjacent LEDs in every loop.

At last the flickering for the firing LED ist realized controlling the LED voltage with a PWM controlled logic level Mosfet. Maybe i try to slowly increase the brightness of the chasing LEDs this way too. Depends on how this looks.

This idea came into my mind just now. So joining here seems to be worth it! ;-)

The MEGA 2560 PRO Embed I'm using has 54 digital pins and 16 analog pins. And it has a nice little footprint of 38x55mm. So at the moment there is not need for shift registers.

I really know LED strips. I build my own Ambilight for my flatscreen. So I know what they can. This is not my problem. From this point of view they absolutely would be the better choice.

My decision came more from the model maker side. The strips are not really bendable in the needed direction to get the curve of the phaser bank. So I would have to cut them off and rewire them.

Second point is the size. I want to build the model as clean as possible. A 0402 LED has the size of a salt grain and is nearly invisible. With the strip LEDs I have the problem to get the light from

the inner side to the outside of the phaser bank. And I think a fibre will never be that bright the pure LED can be.

 

p.s. When I have some code I will post it here.

Hi snooker,

I just thought you want to put the flicker effect also into code. Im curious how the flicker effect with a PWM Mosfet works. You can search for "led chaser arduino" or "knight rider chaser arduino" and you will find some codes there. To have them chase from and into one direction should be an easy count-loop like:

for(i=1; i<=10; i++)
{
digitalWrite(i,HIGH);
delay(50);
digitalWrite(i,LOW);
delay(50);
}

You can have several of them in one code with different pincounts and triggered randomely by pushbutton. How to do the random thing....I don´t know. Well I can tell you how it works, but I can´t code it.

Notice that you have to put in some extra code for the last led to stay on for a moment.


   
ReplyQuote
(@snooker216)
New Member
Joined: 3 years ago
Posts: 4
 

To control a strip with a PWM controlled MOSFET is not really different from controlling a single LED directly via PWM.

The MOSFET is used as a switch to turn the voltage for the LEDs on and off. Nothing else does any PWM pin of an Arduino.

The only difference is the load. With the MOSFET it is irrelevant if there are 1 or 20 or 200 LEDs lighting. The Arduino pin only sees

the load of the MOSFET which is only a few µA.

 

btw It is not necessary to fully qoute someone in a direct reply. In many forums this is even prohibited. Just My two cents.

This post was modified 3 years ago by snooker216

   
ReplyQuote
(@snooker216)
New Member
Joined: 3 years ago
Posts: 4
 

Is there a way to upload pictures for a "normal user". I would like to show you the hardware side of my solution!
Actually I plan to build 4 phaser banks with 20 LEDs each. With my solution I can control every of these 80 LEDs with PWM, what in my opinion will be much smoother than a simple On/Off.
I use 20 normal digital outputs and 4 PWM capable ones. So only can shoot one phaserbank at a given time. But it will be selected randomly to avoid a "programmed" look.


   
ReplyQuote


 Hans
(@hans)
Famed Member Admin
Joined: 11 years ago
Posts: 2660
Topic starter  

Yes there is, but you'll have to post (if I'm not mistaken) 5 posts that get approved before you can attach pictures.
Looks like you have one more post to go 😁 

(this intended to prevent spam-farms from spamming the forum)


   
ReplyQuote
(@Anonymous)
Joined: 1 second ago
Posts: 0
 

Hi All 

I'm so glad I found this thread for the phaser array! 

I do have one question about Hans' code... there is this snippet here at the very end.. 

// Set all LEDs to a given color and apply it (visible)
void setAll(byte red, byte green, byte blue) {
  for(int i = 0; i < NUM_LEDS; i++ ) {
    leds = CRGB(red, green, blue);

 

When I paste the code as a sketch and load up the necessary libraries and try to verify the code in the Arduino app, I get this error:

exit status 1
incompatible types in assignment of 'CRGB' to 'CRGB [60]'

 

If I remove that last line of code, it verifies. At first I assumed maybe this was to be user definable, so I tried plugging different values in and kept getting the same problem. So I'm curious as to what I might be missing in getting this to work? 

Appreciate any help you might have! New to the game, so still learning! 

 

Cheers,

 

AD

 

 


   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 11 years ago
Posts: 2660
Topic starter  

Hi AD,

welcome to the forum 😊 

Looks like a typo in the code. There should be an index next to leds. Corrected:

// Set all LEDs to a given color and apply it (visible)
void setAll(byte red, byte green, byte blue) {
  for(int i = 0; i < NUM_LEDS; i++ ) {
    leds[i] = CRGB(red, green, blue);   // <--- added [i]

 

Having said that; FastLED has a (probably faster) function that can replace this setAll() function (this function was more of a leftover from another project where I tried writing code for FastLED and NeoPixel).

fill_solid( leds, NUM_LEDS, CRGB(0,0,0) ); // color can be changed of course

 

Or as a drop-in replacement:

fill_solid( leds, NUM_LEDS, CRGB(red,green,blue) ); 

// does the same as

setAll(red,green,blue);

 


   
ReplyQuote
(@Anonymous)
Joined: 1 second ago
Posts: 0
 

@hans

Thank you so much for the quick reply! Really appreciate you taking the time! 


   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 11 years ago
Posts: 2660
Topic starter  

You're most welcome 👍 😉 


   
ReplyQuote


Page 13 / 15

Like what you see and you'd like to help out? 

The best way to help is of course by assisting others with their questions here in the forum, but you can also help us out in other ways:

- Do your shopping at Amazon, it will not cost you anything extra but may generate a small commission for us,
- send a cup of coffee through PayPal ($5, $10, $20, or custom amount),
- become a Patreon,
- donate BitCoin (BTC), or BitCoinCash (BCH).

Share: