• Models
  • Contests
  • Slicer
  • Login
  • Start Here
    thingiverse-iconprintables-iconcults3d-iconmakerworld-iconmyminifactory-icon

    3D GO

    3D ModelsContestsCollectionsSaved ModelsOn a mobile device?

3D GO

Privacy Policy
Warm fire Led lamp - Neopixel Ring 24 with Arduino Uno. 3D Printer File Image 1
Warm fire Led lamp - Neopixel Ring 24 with Arduino Uno. 3D Printer File Image 2
Warm fire Led lamp - Neopixel Ring 24 with Arduino Uno. 3D Printer File Image 3
Warm fire Led lamp - Neopixel Ring 24 with Arduino Uno. 3D Printer File Image 4
Warm fire Led lamp - Neopixel Ring 24 with Arduino Uno. 3D Printer File Image 5
Warm fire Led lamp - Neopixel Ring 24 with Arduino Uno. 3D Printer File Image 6
Warm fire Led lamp - Neopixel Ring 24 with Arduino Uno. 3D Printer File Image 7
Warm fire Led lamp - Neopixel Ring 24 with Arduino Uno. 3D Printer File Thumbnail 1
Warm fire Led lamp - Neopixel Ring 24 with Arduino Uno. 3D Printer File Thumbnail 2
Warm fire Led lamp - Neopixel Ring 24 with Arduino Uno. 3D Printer File Thumbnail 3
Warm fire Led lamp - Neopixel Ring 24 with Arduino Uno. 3D Printer File Thumbnail 4
Warm fire Led lamp - Neopixel Ring 24 with Arduino Uno. 3D Printer File Thumbnail 5
Warm fire Led lamp - Neopixel Ring 24 with Arduino Uno. 3D Printer File Thumbnail 6
Warm fire Led lamp - Neopixel Ring 24 with Arduino Uno. 3D Printer File Thumbnail 7

Warm fire Led lamp - Neopixel Ring 24 with Arduino Uno.

Prestige Prototype avatarPrestige Prototype

November 17, 2023

makerworld-icon
DescriptionCommentsTags

Description

I've created a LED lamp controlled by an Arduino Uno, you can modify the code to change the light pattern. I've added a pattern that imitates a fire. You can search for tutorials online for using an arduinop with a neo pixel ring, it's pretty simple and you can find different light patterns.

Hope you enjoy!

 

 

 

 

ARDUINO CODE:

/**

  • Arduino Uno - NeoPixel Fire
  • v. 1.0
  • Copyright (C) 2015 Robert Ulbricht
  • This program is free software: you can redistribute it and/or modify
  • it under the terms of the GNU General Public License as published by
  • the Free Software Foundation, either version 3 of the License, or
  • (at your option) any later version.
  • This program is distributed in the hope that it will be useful,
  • but WITHOUT ANY WARRANTY; without even the implied warranty of
  • MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  • GNU General Public License for more details.
  • You should have received a copy of the GNU General Public License
  • along with this program. If not, see .
    */

include

// data pin

define PIN 2

// led count

define CNT 24

// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_RGB Pixels are wired for RGB bitstream
// NEO_GRB Pixels are wired for GRB bitstream
// NEO_KHZ400 400 KHz bitstream (e.g. FLORA pixels)
// NEO_KHZ800 800 KHz bitstream (e.g. High Density LED strip)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(CNT, PIN, NEO_GRB + NEO_KHZ800);

uint32_t fire_color = strip.Color ( 80, 35, 00);
uint32_t off_color = strip.Color ( 0, 0, 0);

///
/// Fire simulator
///
class NeoFire
{
Adafruit_NeoPixel &strip;
public:

NeoFire(Adafruit_NeoPixel&);
void Draw();
void Clear();
void AddColor(uint8_t position, uint32_t color);
void SubstractColor(uint8_t position, uint32_t color);
uint32_t Blend(uint32_t color1, uint32_t color2);
uint32_t Substract(uint32_t color1, uint32_t color2);
};

///
/// Constructor
///
NeoFire::NeoFire(Adafruit_NeoPixel& n_strip)
: strip (n_strip)
{
}

///
/// Set all colors
///
void NeoFire::Draw()
{
Clear();

for(int i=0;i {
AddColor(i, fire_color);
int r = random(80);
uint32_t diff_color = strip.Color ( r, r/2, r/2);
SubstractColor(i, diff_color);
}

strip.show();
}

///
/// Set color of LED
///
void NeoFire::AddColor(uint8_t position, uint32_t color)
{
uint32_t blended_color = Blend(strip.getPixelColor(position), color);
strip.setPixelColor(position, blended_color);
}

///
/// Set color of LED
///
void NeoFire::SubstractColor(uint8_t position, uint32_t color)
{
uint32_t blended_color = Substract(strip.getPixelColor(position), color);
strip.setPixelColor(position, blended_color);
}

///
/// Color blending
///
uint32_t NeoFire::Blend(uint32_t color1, uint32_t color2)
{
uint8_t r1,g1,b1;
uint8_t r2,g2,b2;
uint8_t r3,g3,b3;

r1 = (uint8_t)(color1 >> 16),
g1 = (uint8_t)(color1 >> 8),
b1 = (uint8_t)(color1 >> 0);

r2 = (uint8_t)(color2 >> 16),
g2 = (uint8_t)(color2 >> 8),
b2 = (uint8_t)(color2 >> 0);

return strip.Color(constrain(r1+r2, 0, 255), constrain(g1+g2, 0, 255), constrain(b1+b2, 0, 255));
}

///
/// Color blending
///
uint32_t NeoFire::Substract(uint32_t color1, uint32_t color2)
{
uint8_t r1,g1,b1;
uint8_t r2,g2,b2;
uint8_t r3,g3,b3;
int16_t r,g,b;

r1 = (uint8_t)(color1 >> 16),
g1 = (uint8_t)(color1 >> 8),
b1 = (uint8_t)(color1 >> 0);

r2 = (uint8_t)(color2 >> 16),
g2 = (uint8_t)(color2 >> 8),
b2 = (uint8_t)(color2 >> 0);

r=(int16_t)r1-(int16_t)r2;
g=(int16_t)g1-(int16_t)g2;
b=(int16_t)b1-(int16_t)b2;
if(r<0) r=0;
if(g<0) g=0;
if(b<0) b=0;

return strip.Color(r, g, b);
}

///
/// Every LED to black
///
void NeoFire::Clear()
{
for(uint16_t i=0; i strip.setPixelColor(i, off_color);
}

NeoFire fire(strip);

///
/// Setup
///
void setup()
{
strip.begin();
strip.show(); // Initialize all pixels to 'off'
}

///
/// Main loop
///
void loop()
{
fire.Draw();
delay(random(50,150));
}

License:

BY-NC-SA

Related Models

bathtub boat (visual benchy) preview image

bathtub boat (visual benchy)

vandragon_de profile image

vandragon_de

16,086

Lightsaber RP2040 preview image

Lightsaber RP2040

Adafruit profile image

Adafruit

2,420

Tracking Tag - Adafruit Feather M0 / Wing GPS preview image

Tracking Tag - Adafruit Feather M0 / Wing GPS

VSC profile image

VSC

1

Talking D20 preview image

Talking D20

adafruit profile image

adafruit

12,956

Severance Inspired Bluetooth Speaker preview image

Severance Inspired Bluetooth Speaker

Adafruit profile image

Adafruit

1,252

Adafruit M4 CAN Feather & Oled Featherwing Casing preview image

Adafruit M4 CAN Feather & Oled Featherwing Casing

printworksgarage profile image

printworksgarage

20

SMARS modular robot preview image

SMARS modular robot

tristomietitoredeituit profile image

tristomietitoredeituit

10,380

USB MIDI Keyset preview image

USB MIDI Keyset

Adafruit profile image

Adafruit

1,708