Home DIY or DIY Glowing snowballs, or decorating the New Year with “improvised materials

Glowing snowballs, or decorating the New Year with “improvised materials

by admin

Inspired by the article About LEDs in the snow , I wanted to try to do something similar in mine.In the comments to that article, I posted ideas and a small bunch of pictures. Even though snow is scarce in Moscow suburbs now, this did not diminish the enthusiasm, rather the opposite – to implement the idea as soon as possible, while there is still snow.
The first attempt was a bulb with a static glowing LED, but a little later a board with a small slice of dynamics was completed.
How it works, and how to make something similar, see under the cat.
P.S. The "handyness" of the materials probably extends to radio amateurs.

How it all began

To get started, we’ll need :

  • Transparent flask from under shoe covers (can be borrowed from the nearest clinic)
  • Holder for CR2032 type batteries (they are different, we need one with a clip on the side)
  • RGB LED (I used a 5050 LED, planar, scattering type)
  • Some resistors (also planar, 100 Ohm – we will use a 3v battery to power it)
  • Piece of fiberglass board with copper foil
  • Copper sulfate or ferric chloride (or whatever else you’re used to etching boards in)

Glowing snowballs, or decorating the New Year with "improvised materials
The board is easy to draw (I didn’t even fire up the printer, got a CD marker and scribbled it on, then immediately threw it in the etchant solution, didn’t have time to take a picture).
This is what the board drawing looks like :
Glowing snowballs, or decorating the New Year with "improvised materials
After etching, the board should be cut to the shape of the battery holder (easiest way to do this is to pre-drill the holes and insert the holder from behind, then trace around the holder with a marker. WARNING! The polarity does matter! Watch the lug position of the holder!) and solder the LED, resistors and the holder.
This is what comes out of it :
Glowing snowballs, or decorating the New Year with "improvised materials
I wanted to get a magenta glow by turning on the red and blue channels and turning off the green one.
This is how you get the simplest luminaire. We varnish the board (not really necessary, but this way the tracks are less likely to darken), put the battery in, pack it in a flask and go make snowballs!

And then Ostap got carried away

As a programmer who has a soft spot for all sorts of microcontroller tech, I decided to adapt a little chip that would bring a little more joy to the thing by making the LED shimmer beautifully in different colors.
For this I took a well-known in narrow circles Atmel ATtiny45 controller (I wanted an ATtiny13, but unexpectedly they were not in the box, the only difference was the memory size. I drew the board in Eagle and transferred it to the tinfoil by laser-outsight technology.
Glowing snowballs, or decorating the New Year with "improvised materials
Compared to the previous version there is a capacitor on the board for a more stable power supply and the microcontroller itself. In terms of components we have to make do here with little blood, because the space on the board is limited. Even the programming plug was not on the board, I wired it to the programming pins (especially for this, the LED channels were on the programming pins, and I brought RESET on a separate platform). The resistors and capacitors on this board are 0805 size.
While the boards were being etched, I got busy with the program. The ATtiny45 supports hardware PWM signal output on PB0, PB1 and a few more. PB2 was not on this list. But the board is already drawn and etched, so I decided to do software PWM by applying a second timer (Timer1).
In order to make the luminaire more flexible in tuning, I applied this mechanism. The chip has a ROM (EEPROM). In the first cell we will store a number that specifies the mode of operation. After each power on we will increase this value by 1 and store it in the EEPROM. Thus, by twitching the battery in the connector, you can switch the operating modes. In order not to miss the desired mode, I duplicated each mode (in fact, the next mode will turn on after two jerks of the battery).
All code in C (for AVR-GCC compiler)

#include <avr/io.h>#include <avr/eeprom.h>#include <util/delay.h>#include <avr/interrupt.h>#define r_pwm(pwm) OCR0A = pwm#define b_pwm(pwm) OCR0B = pwm#define g_pwm(pwm) OCR1A = pwm#define NUM_MODES 16int main(void){/* Init LED GPIO pins */DDRB = 7; /* pins 0, 1, 2 *//* Init PWM timers *//* Timer0 is for R and G channels */TCCR0A = (1<<COM0A1)|(1<<COM0B1)|(WGM01)|(WGM00);TCCR0B = (1<<CS00); /* divide by 1 *//* Timer 1 is for B channel; enable interrupts */TIMSK = (1<<OCIE1A)|(1<<TOIE1);TCCR1 = (1<<CS10); /* divide by 1 */sei();/* Get mode value from the EEPROM and update it */uint8_t mode = eeprom_read_byte((uint8_t *) 1);mode++;if (mode > = NUM_MODES)mode = 0;eeprom_write_byte((uint8_t *) 1, mode);uint8_t i;while(1) {switch(mode > > 1) {case 0:r_pwm(255);break;case 1:g_pwm(255);break;case 2:b_pwm(255);break;case 3:r_pwm(255);g_pwm(255);break;case 4:g_pwm(255);b_pwm(255);break;case 5:r_pwm(255);b_pwm(255);break;case 6:r_pwm(255);g_pwm(255);b_pwm(255);break;case 7:for (i=0; i < 255; i++) {r_pwm(255-i); g_pwm(i);_delay_ms(20);}for (i=0; i < 255; i++) {g_pwm(255-i); b_pwm(i);_delay_ms(20);}for (i=0; i < 255; i++) {b_pwm(255-i); r_pwm(i);_delay_ms(20);}}}return 0;}ISR(TIM1_OVF_vect){if (OCR1A != 0)PORTB |= (1<<2);}ISR(TIM1_COMPA_vect){PORTB = ~(1<<2);}

Wiring diagram and PCB layout (from Eagle CAD) Glowing snowballs, or decorating the New Year with "improvised materials
Glowing snowballs, or decorating the New Year with "improvised materials
Fuse bits can be counted here I calculated that 1MHz is enough for a comfortable PWM and for a low power consumption. Generally speaking, the fuse bits turned out to be standard for the tiny45, so you don’t need to change them.
I was already impatient to try this new thing out in practice, so, after a quick spray of spray can and 5 minutes under the lamp, I took it and ran out on the street with a camera (it was already pretty late evening, just the right conditions for testing).
And here is the result (the video is the same as the one inserted above for attention):
Snowballs didn’t want to be molded at all, but I warmed up a handful of snow in my hands and it all worked!

Not unimportant

Thank you very much for the idea, tov. Kidar
I have posted all the materials on this project at Dropbox When I have time, I will prepare a separate makefile, but now after unpacking: make antares make build, then conveniently you upload the file images/antares.hex to the chip.
Thank you for your attention!
UPD: I updated archives with source files; now there is PDF file with printed circuit board for self-printing and hex-file with ready firmware in the archive with the program.

You may also like