Gearbest August Sale

How DIY a brass wish ball

ByAdan Flannigan 2019-07-30 357

Are you worried about preparing a gift? Nowadays, many boys will choose DIY birthday gifts. While expressing their own feelings, they can also let the other feel your love. Is it particularly romantic? Let’s make a wish ball by yourself.

Wish ball

Made of brass rods, 18 LEDs are connected in a free-ball shape.

Hardware material

1 x brass rod

18 x LED

1 x ATmega8L chip

1 x CR2032 button battery

1 x switch

Make the ball bady

The main challenge is to bend into a round shape with a brass rod that looks like a celestial body. I built a ball with six copper rods arranged vertically (longitude) and three copper rods horizontally (latitude). This has a total of 18 intersections for soldering LEDs. There is an annular opening at the bottom of the sphere, in order to finally better put components such as chips and batteries.

Step 1: make the brass rod circle

First, bend the copper rod into a circle. I first found a 50mm diameter tin can that can be used to secure the copper rod with a bottom cover when bent. After bending the copper rod, cut it and weld the ends together to form a beautiful ring.

Draw the same shape on a piece of paper to help you match the perfect circle. In order to make a smaller ring, I used bottles of other diameters. Use something that matches your diameter, and there are round things around you!

Step 2: solder the LED to 50mm rings

Next, I soldered the LED to three 50mm rings. I drew a template on a piece of paper. I use yellow and red LEDs. Yellow and red because it is more energy efficient than blue or white.

Step 3: solder the led to the base ring

Then, I soldered the ring with the LED to the base ring. I fixed the base ring to the table with a piece of tape, trimmed the bottom of the vertical ring and welded them to the ring to form a crown. The first ring is welded into one, and the second and third rings are cut in half to form a flat top of the sphere.

Step 4: connect rings together

The last step is the most frustrating and time consuming. The LEDs are connected to the curved rods to form a horizontal ring. I cut the remaining rings one by one to fit the space between the vertical rings and weld them together.

I thought of an easy way to place LEDs. The two LEDs face each other on an adjacent vertical ring (ground) that is connected to a curved rod that is part of a horizontal ring (power line). The result is 18 LEDs, divided into 9 sections.

Noter: Test the LED is still good or not, otherwise you need to redo this at the end, this is a terrible and exciting test.

If you just want it to shine and don't care about any animation. You can stop reading immediately and put the CR2032 button battery and switch inside. Connect the LED to the battery with a 68Ω current-limiting resistor to illuminate it! When soldering the battery to the brass wire, be sure not to overheat, as this may cause the battery to overheat.

If you want to make it smart and a little fun, let's put the microcontroller in it! I am using an ATmega8L chip - the same package as the Arduino NANO, but with less memory and lower power consumption. L means it has a wide operating voltage range of 2.7 – 5V, which is great when using a 3V coin cell battery. On the other hand, since it is a TQF32 package, soldering to a copper rod is a challenge, but the appearance and effect are very good.

Schematic

Source code

#define LEDS 9
 
byte leds[] = {
  5, 19, 17, // bottom
  6, 1, 15, // middle
  8, 21, 13 // top
};
 
#define ON true
#define OFF false
  
// variables for pattern timing
unsigned long currentMillis = millis();
unsigned long previousMillis = 0;
unsigned long millisInterval = 3
00;
  
// variables for software PWM
unsigned long currentMicros = micros();
unsigned long previousMicros = 0;
// this is the frequency of the sw PWM
// frequency = 1/(2 * microInterval)
unsigned long microInterval = 250;
  
const byte pwmMax = 100;
  
// fading (for the timing)
int fadeIncrement = 1;
  
// typedef for properties of each sw pwm pin
typedef struct pwmPins {
  int pin;
  int pwmValue;
  bool pinState;
  int pwmTickCount;
} pwmPin;
  
// create the sw pwm pins
// these can be any I/O pin
// that can be set to output!
const int pinCount = 9;
const byte pins[pinCount] = {
  5, 19, 17, // bottom
  6, 1, 15, // middle
  8, 21, 13 // top
};
  
pwmPin myPWMpins[pinCount];
  
// function to "setup" the sw pwm pin states
// modify to suit your needs
// this creates an alternating fade pattern
void setupPWMpins() {
  for (int index=0; index < pinCount; index++) {
    myPWMpins[index].pin = pins[index];
  
    // mix it up a little bit
    // changes the starting pwmValue for odd and even
    if (index % 2)
      myPWMpins[index].pwmValue = 25;
    else
      myPWMpins[index].pwmValue = 75;
  
    myPWMpins[index].pinState = ON;
    myPWMpins[index].pwmTickCount = 0;
  
    // unlike analogWrite(), this is necessary
    pinMode(pins[index], OUTPUT);
  }
}
  
void pwmFadePattern() {
  // go through each sw pwm pin, and increase
  // the pwm value. this would be like
  // calling analogWrite() on each hw pwm pin
  for (int index=0; index < pinCount; index++) {
    myPWMpins[index].pwmValue += fadeIncrement;
    if (myPWMpins[index].pwmValue > 100)
      myPWMpins[index].pwmValue = 0;
  }
}
  
void handlePWM() {
  currentMicros = micros();
  // check to see if we need to increment our PWM counters yet
    if (currentMicros - previousMicros >= microInterval) {
    // Increment each pin's counter
    for (int index=0; index < pinCount; index++) {
    // each pin has its own tickCounter
      myPWMpins[index].pwmTickCount++;
  
    // determine if we're counting on or off time
      if (myPWMpins[index].pinState == ON) {
        // see if we hit the desired on percentage
        // not as precise as 255 or 1024, but easier to do math
        if (myPWMpins[index].pwmTickCount >= myPWMpins[index].pwmValue) {
          myPWMpins[index].pinState = OFF;
        }
      } else {
        // if it isn't on, it is off
        if (myPWMpins[index].pwmTickCount >= pwmMax) {
          myPWMpins[index].pinState = ON;
          myPWMpins[index].pwmTickCount = 0;
        }
      }
      // could probably use some bitwise optimization here, digitalWrite()
      // really slows things down after 10 pins.
      digitalWrite(myPWMpins[index].pin, myPWMpins[index].pinState);
    }
    // reset the micros() tick counter.
    digitalWrite(13, !digitalRead(13));
    previousMicros = currentMicros;
  }
}
  
void setup() {
  setupPWMpins();
  //pinMode(13, OUTPUT);
}
  
void loop() {
  // this is the magic for sw pwm
  // need to call this anytime you
  // have a long operation
  handlePWM();
  
  // check timer for fading pattern
  // this would be the same
  // if we used analogWrite()
  currentMillis = millis();
  if (currentMillis - previousMillis >= millisInterval) {
    // moved to own funciton for clarity
    pwmFadePattern();
  
    // setup clock for next tick
    previousMillis = currentMillis;
  }
}


 You may also want to read:
 AMD Radeon RX 5500 bypasses AMD Radeon RX 570 in the first test
 Nubia Z20 camera, specs, and release date
 Samsung Galaxy Tab S6 lit up with a keyboard and stylus

Gearbest secure payment methods

Extensive Product Selection

● Over 300,000 products

● 20 different categories

● 15 local warehosues

● Multiple top brands

Convenient Payment

● Global payment options: Visa, MasterCard, American Express

● PayPal, Western Union and bank transfer are accepted

● Boleto Bancario via Ebanx (for Brazil)

Prompt Shipping

● Unregistered air mail

● Registered air mail

● Priority line

● Expedited shipping

Dedicated After-sales Service

● 45 day money back guarantee

● 365 day free repair warranty

● 7 day Dead on Arrival guarantee (DOA)

You might also like

HOT TOPICS

Related Products