Arduino Fire.

129

2

About: I love making things. I have for as long as I can remember liked to make stuff. Now days I have two kids (Thomas and Emma) and most of the things I do are safe for them! I love electronics and Microchips, I ...

This was my sons homework! he was asked to make something relating to cavemen. so he decided to make a cave and I suggested that I could add the fake fire to make the cave paintings look good.

So as you can see in the pictures i have used two strips of 8 WS2812 (Neopixels) and a cluster of 12 individual Neopixels to make the fire base. If you have never used the WS2812 LED's before then you really should give them a try as they are very easy to use and versatile. basically the little surface mounted tri colour LED has a chip built in (the black dot) this chip allow the red, green and blue LED's to be set to a value from 0 - 255 meaning you can create any colour. The neopixels can then be daisy chained together, just make sure that the first one has the data going in and the second one receives the data from the first one via the data out to it's data in. The picture of the 12 cluster shows this better than i can explain! The power supply for the chain comes from the 5volt supply on the Arduino Nano.

The cluster of 12 was soldered together (and then tested) then hot glue was used to create a fire effect and then burnt matches finish of the effect.

Supplies:

1* arduino Nano

2* strips of 8 WS2812 neopixels

12* induviduale WS2812 neopixels on small PCB's

leanths of wire to connect.

Step 1: The Program

This is a very simple program, having said that… I am not a very good programmer, so I am sure there will be a better way to do this! But I understand it and it works. So after we have included the adafruit library we then define the pin the data is to be sent out on and also define the number of LED’s in the string, which in this case is 28.
Next I played around with the values of the red, green and blue LED’s to give me a good range of fire colours, these combinations are listed in the pattern01 string. The first number is the red content, the second is the green and lastly the blue, so in the case of the first colour you can see it is 60 (red) 35 (green) and 2 (blue), you must include all the colours even if the value is zero. In the string there are 22 sets of values meaning a total of 66 numbers. To choose one of the colours I pick a random number up to 22, multiply the number by 3 and then subtract 2.
For example the random number may be 9 which needs to reflect the values of 130,20,0 which are in positions 24, 25 and 26 of the string. So 9 * 3 = 27 subtract 2 = 25. Then when we set the random pixel we use the following line
Strip.setPixelColor(randomPixel, (pattern01[randomColour – 1]),( pattern01[randomColour]), pattern01[randomColour+1]));
This might not be the best way to do this but it works. In the loop we choose a random pixel and a random colour and repeat that 8 times, then we choose a random pixel and set it to off and repeat that 5 times, then lastly we make the strip show the new colours using the strip.show() command.
This loop is run forever with just a little delay at the start to make a better fire effect. You can play with the different colours and the number of pixels which are tuned on and the number which are turned off in any one loop.
#include <Adafruit_NeoPixel.h>
#define PIN 2
Adafruit_NeoPixel strip = Adafruit_NeoPixel(28, PIN, NEO_GRB + NEO_KHZ800);
//
int pattern01[] = {60,35,2,40,5,0,30,3,0,250,170,7,60,30,0,80,50,5,120,20,0,140,40,0,130,20,0,50,40,0,100,0,0,20,0,0,60,5,0,100,10,0,80,50,5,60,36,0,250,170,7,15,2,0,5,1,0,10,5,0,12,2,0,10,0,0};
int randomColour = 0;
int randomPixel = 0;

void setup()
{
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}
void loop()
{
  randomSeed(analogRead(3));
  delay(80);
  for (int x = 0; x > 8; x++)
  {
    randomPixel = random(0,strip.numPixels());
    getArandomColour();
    strip.setPixelColor(randomPixel, (pattern01[randomColour -1]),(pattern01[randomColour]),(pattern01[randomColour +1]));
  }
  for (int x = 0; x >; 5; x++)
  {
    randomPixel = random(0,strip.numPixels());
    strip.setPixelColor(randomPixel,0,0,0);
  }
  strip.show();
}
void getArandomColour()
{
  randomColour = random(1,22);
  randomColour = randomColour * 3;
  randomColour = randomColour - 2;
}

Step 2: The Cave

This instructable is about the Arduino fire and not really the cave construction, But i will quickly run through the build. The cave is made using Mod Roc (Plaster bandage) To get the shape we used a cardboard box and draped plastic garden netting inside. The netting was held in place using clothing pegs whilst Mod Roc was used to line around the netting inside. After we had gone over the netting a couple of times we allowed it to dry overnight. The next day we were able to lift the Mod Roc out of the box and turn up the correct way and the plastic netting was pulled off. The cave was then covered with a couple of layers of white tissue paper to give a better finish. Finally Thomas painted the cave on the outside and added the cave paintings on the inside.

Arduino Contest 2019

Participated in the
Arduino Contest 2019

Share

    Recommendations

    • Colors of the Rainbow Contest

      Colors of the Rainbow Contest
    • Beauty Tips Contest

      Beauty Tips Contest
    • Growing Beyond Earth Maker Contest

      Growing Beyond Earth Maker Contest

    2 Discussions

    0
    None
    mr_fidjessyratfink

    Reply 7 days ago

    Thank you, I seem to enjoy doing my son's homework more than he does!