Advanced Effects
Automating effects
Once you’ve lit things up, the next step
you could take is to automate some effects.
There are a variety of solutions available
that don’t involve soldering, and therefore are much easier and safer for
children. The boards, which are essentially mini computers, all have sockets on
them so you can plug wires in.
The Arduino.
The Arduino range of controllers is my
favoured choice for controlling Lego lighting models, as it is a free open
source platform that you can buy cheaply from various places around the world.
You can pick up plug into breadboard controllers like the Arduino Mini and a
breadboard itself for around £5. These can easily be hidden inside models as we
will see later. I’ve used both the official boards and the copies and have had
equal success with both. The difference is purely in the price and how quickly
you can get hold of them.
[Imperial hotel]
Uno
As of writing, the Uno Revision 3 is one of
the cheapest ways to get started with lighting projects.
It supports add on “Shields” as they are
called, which allow you do add WiFi, GSM (Mobile Phone) and Breadboards directly
onto it, either now or at a later date in your exploration.
Yun
The Arduino Yun has some advantages over
the Uno in that it has built in Wifi and also runs a UNIX environment which
allows us to run a web server, and control your lighting creation using it. This
board runs a version of Linux from an SD Flash card, and so you can program
pretty much what you want with it. For example, it can fetch data from the
Internet and you an control its output pins based on that.
Nano
The Micro is much smaller than the other
Arduino boards, and plugs into a breadboard. This makes it extremely easy to
connect up a set of lights to it, although it won’t power as many as the other
larger boards.
Raspberry Pi
Whilst not having as many ouput pins out of
the box as most of the Arduino solutions, the Pi does have the advantage of
having a Linux environment and HDMI/Composite display advantages without any
extra cost.
A cheaply available USB WiFi adapter can be
added and you have all the power of the Yun with a different programming
environment which you may be familier with – such a JavaScript, Python, Perl
and others.
It’s also very easy to set up a web server
on it and access the files from your Mac or PC.
[Pin Breakout 1]
Wifi Shield
If you are looking to use Wifi, you are
probably wanting to use a web server to remove control you device and lighting
setup.
Yun
Apache/PHP/LAMP
Sim Card Shield
SIM900
Pay as you go SIMM cards are a great way of
getting value for money here. As you only need to receive text messages
For connecting the components on your
breadboard, and the breadboard to the Arduino, you need male to male cables.
CHIP
Chip is a great little computer for just $9. It cost me a
little over £10 to import one in 2015.
Edison
Candles and Fireplaces
You can buy various coloured LEDs from
sources such as ebay, so choose what you want to achieve.
The yellow or orange is best for standard
looking candles.
Lego have a wide variety of bricks that you
can use to bould fireplaces including actual flame pieces but these are harder
to light than other bricks.
Here are a few ideas.
There are many ways you can create a fire
with Lego, from the pieces to the lights you can create all sorts of effects.
There are various translucent bricks, and
also various flame pieces in various colours.
This is the basic Arduino code that
flickers two LEDs randomly, it will work on an Arduino board that has analogue
output pins, or PWM pins as they are often called meaning pulse width
modulation.
Arduino code for Fires or Candles
int Fire1 = 5;
int Fire2 = 6;
void setup() {
pinMode(Fire1, OUTPUT);
pinMode(Fire2, OUTPUT);
}
void loop() {
analogWrite(Fire1, random(0,255));
analogWrite(Fire2, random(0,255));
delay(random(0,255));
}
Fluorescent Lights
I managed to get one of the limited edition
Lego models that they sell when they open new stores, and thought it would be
good to light it up in an authentic fashion – which meant having the
fluorescent shop bulbs light up as they normally do.
In order to get the blinking on effect I
headed to YouTube and downloaded a slow motion video of a fluorescent tube
coming to life. I then placed this on the timeline in a video editing program
and noted the delay times between blinks.
https://www.youtube.com/watch?v=jJ69pS3z7JU
Thanks to the person who took this video
for helping me out.
[Timeline Pic]
Finally, I used the Blink code from the
Arduino software as a starting point and added delay commands between turning
the light on and off to mimic what was happening in the slow motion video.
I added some Define code at the beginning
so you can easily tweak it to have your effect. In essence, as you can see from
the pictures I put two lights in the back of the shop and a light behind the
sign.
By adding more similar code – just copy and
pasting then changing the numbers – you can easily add more lights to it if you
want to use this in bigger buildings.
Adding a random element to it is easy, and
makes it seem more realistic.
Arduino Code for Fluorescent Lights
#define OnDelay 100
#define Brightness 60
#define Light1 10
#define Light2 11
int TurningOn = 1;
int TurningOff = 0;
void setup() {
pinMode(Light1, OUTPUT);
digitalWrite(Light1, LOW);
pinMode(Light2, OUTPUT);
digitalWrite(Light2, LOW);
}
void loop() {
if (TurningOn == 1) {
analogWrite(Light1, Brightness);
analogWrite(Light2, Brightness);
delay (500);
for (int i=0; i <= 5; i++){
analogWrite(Light1, Brightness);
analogWrite(Light2, Brightness);
delay(OnDelay);
analogWrite(Light1, LOW);
analogWrite(Light2, LOW);
delay(OnDelay);
}
digitalWrite(Light1, HIGH);
digitalWrite(Light2, HIGH);
TurningOn = 0;
}
}
#define Brightness 60
#define Light1 10
#define Light2 11
int TurningOn = 1;
int TurningOff = 0;
void setup() {
pinMode(Light1, OUTPUT);
digitalWrite(Light1, LOW);
pinMode(Light2, OUTPUT);
digitalWrite(Light2, LOW);
}
void loop() {
if (TurningOn == 1) {
analogWrite(Light1, Brightness);
analogWrite(Light2, Brightness);
delay (500);
for (int i=0; i <= 5; i++){
analogWrite(Light1, Brightness);
analogWrite(Light2, Brightness);
delay(OnDelay);
analogWrite(Light1, LOW);
analogWrite(Light2, LOW);
delay(OnDelay);
}
digitalWrite(Light1, HIGH);
digitalWrite(Light2, HIGH);
TurningOn = 0;
}
}
Disco Lights
Much like the fluorescent lighting effect
you can create disco lights by obtaining different coloured LEDs and then
blinking them in a pattern that suits you.
[Disco Ball picture]
[DJ Desk picture]
[Modular pictures with dancers] [Video]
No comments:
Post a Comment