Model Boat Mayhem
Technical, Techniques, Hints, and Tips => The "Black Arts!" ( Electrics & Electronics ) => Topic started by: benidormbob on January 31, 2017, 10:25:03 pm
-
Hi all, Been looking at these rotating/spinning lights on fire engines,They are called roto ray lights Look really cool when spinning. I would like to put one scaled down light on my fire boat. I found one that was similar on the net but cannot now find it. Any know please where they can be sourced Thank you
-
Not sure about a spinner,...
That could just be a sequenced set of LED.
There is a model railroad brand N-gineering that sells micro lighting and effects.
http://www.ngineering.com/lighting_effects_products.htm (http://www.ngineering.com/lighting_effects_products.htm)
There is another company, I think something like, Modelec that has a demo board at
the local hobby shop for fire trucks, police cars, road barriers etc...
Can check pricing next time I am about, Shipping though, $9.50 usd overseas.
:-)
-
The three lights are indeed on a spinner. That complicates matters but could be done. However, I think until the model trucks catch up, you would be looking at a custom job or diy.
You might have more luck finding out if it has been done on one of the model truck forums.
Rota ray
https://www.youtube.com/watch?v=Q4PTTB4NJmA
-
Ask the Arduino guys, they should be able to help.
-
I posted this before
Is this the type of thing you want - mega, bright and very easily achieved
Is it this type of effect you are after ---- http://rchub.co.uk/led-rgb-emergency-lights/ (http://rchub.co.uk/led-rgb-emergency-lights/)
C-3PO
-
They look really good but I have been told that Arduino systems are very expensive ?
-
How does
£6 for the strip of 8x RGB Ws2812 5050 leds you see in the video and about £9 for Arduino to drive them plus P&P, cable and battery So £20 or less all in for 1 strip up and working - additional strips add £6 +P&P
The Arduino can drive several strips - I have had them driving at least 4 strips (NB it's not the battery power that's the issue it's getting a signal to each LED very quickly)
If you like this option I will work with you to make it reality :)
C-3PO
-
Thank you, Just had a look at the prices and they don't appear to be expensive at all really. Looks very technical though there seems to be loads of parts on there site and wouldn't know where to start lol
-
Here's a pic of 3 strips next to a AA battery so you can see they are small but you would be foolish to stare at them when illuminated - they are seriously bright
There are only 3 wires from Arduino to LED strip - power x 2 signal x 1
If you want help to make this happen then just ask.....
The second image shows everything required except battery that's needed to make it work (AA battery is just to give idea of size) - the 2 strips are using servo extension cables and are daisy chained - the signal passes along one strip into the next...
C-3PO
-
Thank you. Will be in touch when I'm ready to do the lights
-
This video shows the LED pixels working ( not the greatest but hints at what they are capable of) - as they are RGB you can have whatever colour you want at any time!
https://www.youtube.com/watch?v=lR-JEi2pWsw
benidormbob - I am very happy to pre-load an Arduino with code that will do what you want.
For anybody that's interested here's a taster of the code ( there is a block of code at the top of the program that's set things up and after that ..)
Example - To set the 12th pixel (#11, counting from 0) to magenta (red + blue), strip.setPixelColor(Pixel No, R,G,B);
strip.setPixelColor(11, 255, 0, 255);
You can set individual pixels or groups of pixels and then to make them change you simply issue the command strip.show();
C-3PO
-
I posted this before
Is this the type of thing you want - mega, bright and very easily achieved
Is it this type of effect you are after ---- http://rchub.co.uk/led-rgb-emergency-lights/ (http://rchub.co.uk/led-rgb-emergency-lights/)
C-3PO
Just ordered 2 of these! :-))
-
Hi Martin,
This is the Adafruit NeoPixel Überguide for the little beasties - https://learn.adafruit.com/adafruit-neopixel-uberguide/arduino-library
C-3PO
-
Hi C-3PO,
Any chance of the complete program to load into the Arduino please.
I've ordered the bits, and an example program would be most beneficial.
Thanks TOF
-
Yes no problem - I wil post one in the next day or so.
One thing to be aware of is that the LED's need a seperate power supply ( Strip shares a common ground with Arduino and battery)
I use a 4.8v RX battery pack.
When you cable things up -the battery connects to +/- on strip
Arduino GND to ground (-) on strip
Arduino Signal pin (determind by the program) to Sig pin on strip
The other thing to note is that the strip needs to be the right way round - there is a "Signal In" end - the other end would be "Signal out" to the next strip
They are a lot of fun - I think you will be impressed - especailly by the brightness of them....
C-3PO
-
Here is some basic test code for the NeoPixel's that will pulse Red, Green & Blue
When I can access my development server I will post some more interesting examples
Code from Adafruit website
#include <Adafruit_NeoPixel.h>
#define PIN 6 // Arduino digital pin 6 to DIN pin on NeoPixel strip
#define N_LEDS 8
Adafruit_NeoPixel strip = Adafruit_NeoPixel(N_LEDS, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
strip.begin();
}
void loop() {
chase(strip.Color(255, 0, 0)); // Red
chase(strip.Color(0, 255, 0)); // Green
chase(strip.Color(0, 0, 255)); // Blue
}
static void chase(uint32_t c) {
for(uint16_t i=0; i<strip.numPixels()+4; i++) {
strip.setPixelColor(i , c); // Draw new pixel
strip.setPixelColor(i-4, 0); // Erase pixel a few steps back
strip.show();
delay(25);
}
}
NeoPixels (ws2812) come in many different forms - from single leds to long strip - This is Adafruit's product range
https://www.adafruit.com/category/168 (https://www.adafruit.com/category/168)
-
Another example - this one from - https://github.com/1ChicagoDave (https://github.com/1ChicagoDave) - Ultimate_Mars_Bars_Police_Lights (https://github.com/1ChicagoDave/Random_NeoPixel_Effects/tree/master/Ultimate_Mars_Bars_Police_Lights/Ultimate_Mars_Bars_Police_Lights)
#include <Adafruit_NeoPixel.h>
#define PIN 0 // Pin that NeoPixel Strip is connected to. I use pin 0 on Adafruit Trinket
Adafruit_NeoPixel strip = Adafruit_NeoPixel(30, PIN, NEO_GRB + NEO_KHZ800); //first number controls the amount of pixels you have (add a few to help the "turnaround")
const int bright = 10; //select 1 thru 10 ( this is multiplied by 25 to get brightest pixel value (from 0-255)
const int wait = 10; //speed of leds - length of delay() in milliseconds
const int maxNumberOfSegments = 8; // Maximum allowable number of segments to be generated
// this also defines size of array below
int node[maxNumberOfSegments]; // array to hold segment nodes
int numSegments = 6;
const int tailSize = 7; // length of light "tail" including lead light
const int arraySize = tailSize + 1; // zero-indexed array, and extra "0" at end
// Array to hold 'r' (RED) color values - Add more values array to lengthen 'tail' of lights
// Last value should be "0" to ensure pixels are turned off appropriately
// Make sure the length of tail correlates to maxNumberOfSegments (*if segment length can be 5 pixels, don't want 7 pixel tail)
int r[arraySize] = {
25*bright, 20*bright, 10*bright, 4*bright, 2*bright, bright, bright, 0};
// Due to logarithmic nature of the human eye, each aditional brightness level should be slightly less than half the previous value for best effect.
// green color values
int g[arraySize] = {
25*bright, 20*bright, 10*bright, 4*bright, 2*bright, bright, bright, 0};
// blue color values
int b[arraySize] = {
25*bright, 20*bright, 10*bright, 4*bright, 2*bright, bright, bright, 0};
void setup()
{
strip.begin();
strip.show(); // Initialize all pixels to 'off'
// How many segements this time? -- random number
//numSegments = random(1, maxNumberOfSegments); //<--- Move this to loop() with millis() timer
// defining node (end pixels of segments) from number of segments defined
for (int i = 0; i <= numSegments; i++)
{
node = (i * (strip.numPixels() / numSegments));
} // end for - numSegments - node array
} // end setup()
void loop()
{
colorWipe(r[0], g[0], b[0], wait);
}
void colorWipe(int R, int G, int B, int wait)
{
// Run lights starting from pixel 0
for (int segment = numSegments-1; segment >= 0; segment--) // Example (2 segments -> segment=0, segment=1)
{
// to set pixel colors in each segment
for (int pixel = node[segment]; pixel < node[segment+1]; pixel++) // Example (2 segments -> pixel=0, pixel=15 && pixel=15, pixel=30)
{
boolean Blue;
// if odd, Blue
if((segment%2)!=0) Blue = true;
// if even, Red
else if ((segment%2)==0) Blue = false;
for (int tailPosition = 0; tailPosition <= tailSize; tailPosition++) // Pixels within each segment
{
if (!Blue)
{
strip.setPixelColor(pixel-tailPosition, (r[tailPosition]), (g[tailSize]), (b[tailSize])); // Red ONLY
} // end if Red...
if (Blue)
{
strip.setPixelColor(pixel-tailPosition, (r[tailSize]), (g[tailSize]), (b[tailPosition])); // Blue ONLY
} // end if Blue...
} // end for (int tailPosition...
strip.show();
delay(wait);
} // end for (int pixel...
} // end for (int segment...
// Now, shrink the tail....
for(int p = 1; p <= tailSize; p++)
{
for(int t = (strip.numPixels()-tailSize); t < (strip.numPixels()); t++)
{
int v = ((strip.numPixels()-t)+p);
if (v > tailSize) v = tailSize;
strip.setPixelColor(t, (r[v]), (g[v]), (b[v]));
}
strip.show();
// No delay() here. It causes too long of a pause at ends of strip.
}
// Run lights back towards 0
for (int segment = 0; segment < numSegments; segment++) // Example (2 segments -> segment=0, segment=1)
{
// to set pixel colors in each segment
for (int pixel = (node[segment+1]-1); pixel >= node[segment]; pixel--) // Example (2 segments -> pixel=0, pixel=15 && pixel=15, pixel=30)
{
boolean Blue;
// if odd, Blue
if((segment%2)!=0) Blue = true;
// if even, Red
else if ((segment%2)==0) Blue = false;
for (int tailPosition = tailSize; tailPosition >= 0; tailPosition--) // Pixels within each segment
{
if (!Blue)
{
strip.setPixelColor(pixel+tailPosition, (r[tailPosition]), (g[tailSize]), (b[tailSize])); // Red ONLY
} // end if Red...
if (Blue)
{
strip.setPixelColor(pixel+tailPosition, (r[tailSize]), (g[tailSize]), (b[tailPosition])); // Blue ONLY
} // end if Blue...
} // end for (int tailPosition...
strip.show();
delay(wait);
} // end for (int pixel...
} // end for (int segment...
// Now, shrink the tail....
for(int p = 1; p <= tailSize; p++)
{
for(int t = (tailSize); t < 0; t++)
{
int v = (t+p);
if (v > tailSize) v = tailSize;
strip.setPixelColor(t, (r[v]), (g[v]), (b[v]));
}
strip.show();
// No delay() here. It causes too long of a pause at ends of strip.
}
}
-
Many thanks for the code.
For those starting with an Arduino then here is the starter tutorial.
http://wiki.epalsite.com/index.php?title=Starter_Kit_for_Arduino
TOF
-
Here is some basic code for NeoPixels emergency lights. It uses a pet hate of mine "delay()" but in this example is just about acceptable.
As you can see we specify the colour of 8 pixels, show them, delay and then repeat the process.
Have a play changing the delay times and the colours -e.g. strip.setPixelColor(3, 0, 0, 255); where the last 3 values (0,0,255) are RGB colour values and can be set 0-255
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define PIN 8 // connect Arduino Pin 8 to Neopixel Data In Pin DIN/
Adafruit_NeoPixel strip = Adafruit_NeoPixel(8, PIN, NEO_GRB + NEO_KHZ800);
//Setup -------------------------------------------------------------------------------------
void setup()
{
strip.begin();
strip.show(); // Initialize all pixels to 'off'
}
//End of Setup ------------------------------------------------------------------------------
//Loop --------------------------------------------------------------------------------------
void loop()
{
NeoPixel_001();
}
//End of Loop -------------------------------------------------------------------------------
// ------------------------------ functions below this line -----------------------------------
void NeoPixel_001()
{
strip.begin();
strip.show(); // Initialize all pixels to 'off'
strip.setPixelColor(0, 0, 0, 255); // blue
strip.setPixelColor(2, 0, 0, 255);
strip.setPixelColor(5, 0, 0, 255);
strip.setPixelColor(7, 0, 0, 255);
strip.setPixelColor(1, 255, 0, 0); // red
strip.setPixelColor(3, 255, 0, 0);
strip.setPixelColor(4, 255, 0, 0);
strip.setPixelColor(6, 255, 0, 0);
strip.show();
delay(50);
strip.setPixelColor(8, 0, 0, 255);
strip.setPixelColor(9, 0, 0, 255);
strip.setPixelColor(10, 0, 0, 255);
strip.setPixelColor(11, 0, 0, 255);
strip.setPixelColor(12, 255, 0, 0);
strip.setPixelColor(13, 255, 0, 0);
strip.setPixelColor(14, 255, 0, 0);
strip.setPixelColor(15, 255, 0, 0);
strip.show();
delay(50);
strip.setPixelColor(2, 255, 255, 255); // white
strip.setPixelColor(3, 255, 255, 255);
strip.setPixelColor(4, 255, 255, 255);
strip.setPixelColor(5, 255, 255, 255);
strip.show();
delay(50);
strip.setPixelColor(2, 255, 255, 255);
strip.setPixelColor(3, 255, 255, 255);
strip.setPixelColor(4, 255, 255, 255);
strip.setPixelColor(5, 255, 255, 255);
strip.show();
delay(50);
strip.setPixelColor(2, 255, 255, 255);
strip.setPixelColor(3, 255, 255, 255);
strip.setPixelColor(4, 255, 255, 255);
strip.setPixelColor(5, 255, 255, 255);
strip.show();
delay(50);
strip.setPixelColor(2, 0, 0, 0);
strip.setPixelColor(3, 0, 0, 0);
strip.setPixelColor(4, 0, 0, 0);
strip.setPixelColor(5, 0, 0, 0);
strip.show();
delay(20);
strip.setPixelColor(2, 255, 255, 255);
strip.setPixelColor(3, 255, 255, 255);
strip.setPixelColor(4, 255, 255, 255);
strip.setPixelColor(5, 255, 255, 255);
strip.show();
delay(50);
strip.setPixelColor(2, 0, 0, 0);
strip.setPixelColor(3, 0, 0, 0);
strip.setPixelColor(4, 0, 0, 0);
strip.setPixelColor(5, 0, 0, 0);
strip.show();
delay(20);
strip.setPixelColor(2, 255, 255, 255);
strip.setPixelColor(3, 255, 255, 255);
strip.setPixelColor(4, 255, 255, 255);
strip.setPixelColor(5, 255, 255, 255);
strip.show();
delay(50);
strip.setPixelColor(2, 0, 0, 0);
strip.setPixelColor(3, 0, 0, 0);
strip.setPixelColor(4, 0, 0, 0);
strip.setPixelColor(5, 0, 0, 0);
strip.show();
delay(20);
strip.setPixelColor(2, 255, 255, 255);
strip.setPixelColor(3, 255, 255, 255);
strip.setPixelColor(4, 255, 255, 255);
strip.setPixelColor(5, 255, 255, 255);
strip.show();
delay(50);
strip.setPixelColor(2, 0, 0, 0);
strip.setPixelColor(3, 0, 0, 0);
strip.setPixelColor(4, 0, 0, 0);
strip.setPixelColor(5, 0, 0, 0);
strip.show();
delay(20);
strip.setPixelColor(2, 255, 255, 255);
strip.setPixelColor(3, 255, 255, 255);
strip.setPixelColor(4, 255, 255, 255);
strip.setPixelColor(5, 255, 255, 255);
strip.show();
delay(50);
strip.setPixelColor(2, 255, 255, 255);
strip.setPixelColor(3, 255, 255, 255);
strip.setPixelColor(4, 255, 255, 255);
strip.setPixelColor(5, 255, 255, 255);
strip.show();
delay(50);
strip.setPixelColor(2, 0, 0, 0);
strip.setPixelColor(3, 0, 0, 0);
strip.setPixelColor(4, 0, 0, 0);
strip.setPixelColor(5, 0, 0, 0);
strip.show();
delay(20);
strip.setPixelColor(2, 255, 255, 255);
strip.setPixelColor(3, 255, 255, 255);
strip.setPixelColor(4, 255, 255, 255);
strip.setPixelColor(5, 255, 255, 255);
strip.show();
delay(50);
strip.setPixelColor(0, 255, 0, 0);
strip.setPixelColor(1, 255, 0, 0);
strip.setPixelColor(4, 255, 0, 0);
strip.setPixelColor(5, 255, 0, 0);
strip.setPixelColor(2, 0, 0, 255);
strip.setPixelColor(3, 0, 0, 255);
strip.setPixelColor(6, 0, 0, 255);
strip.setPixelColor(7, 0, 0, 255);
strip.show();
delay(70);
strip.setPixelColor(0, 255, 0, 0);
strip.setPixelColor(1, 255, 0, 0);
strip.setPixelColor(4, 255, 0, 0);
strip.setPixelColor(5, 255, 0, 0);
strip.setPixelColor(2, 0, 0, 255);
strip.setPixelColor(3, 0, 0, 255);
strip.setPixelColor(6, 0, 0, 255);
strip.setPixelColor(7, 0, 0, 255);
strip.show();
delay(70);
strip.setPixelColor(0, 255, 0, 0);
strip.setPixelColor(1, 255, 0, 0);
strip.setPixelColor(4, 255, 0, 0);
strip.setPixelColor(5, 255, 0, 0);
strip.setPixelColor(2, 0, 0, 255);
strip.setPixelColor(3, 0, 0, 255);
strip.setPixelColor(6, 0, 0, 255);
strip.setPixelColor(7, 0, 0, 255);
strip.show();
delay(70);
}
-
Thanks again,
this code makes more sense to me.
TOF
-
Hi TOF,
I thought it might be useful.. as you can see what is going on.
The other more complex versions do the same thing but they use "functions" to step through the NeoPixel setting so less lines of code
Eg. For x= 1 to 8 / set my pixel green / next x - rather than 8 lines setting the 8 individually to green
Let us know how you get on.....
C-3PO
-
I have flashing, bright, lights.
not bad for a first attempt.
-
first program,
Leds at 8% brightness,
https://youtu.be/c_M89_1d2N4
-
Very Good -I've just got my strip - a clone which will need me to solder leads, so no progress for a couple of days until I can get into the workshop :((
Barrie
-
TOF,
Great looking truck in the video!
The sad thing I found myself doing once I had my NeoPixel's working and was interested in making an "emergency police type display" was I watched YouTube video's of the real thing and broke down the light sequence so I could then go and animate it. For example the white strobes often flash 25%, 50%, 75%, 100% brightness to add to the overall effect.
The odd time I see an emergency vehicle on a shout - guess what I am looking at :)
All part of the fun....
C-3PO
-
Do the Arduino do a sound module by any chance
-
You can control a DF Mini player with an arduino.
uses micro SD card.
-
Just ordered 2 of these! :-))
I've had two full size ones (300mm each) attached under the boot lid of my MG for the last 6 years. Very effective if stopped by the roadside, open boot lid and they activate automatically as they are wired into the boot light.