Annoying Alarm Clock (Particle Argon)

by dcjustus in Circuits > Microcontrollers

141 Views, 0 Favorites, 0 Comments

Annoying Alarm Clock (Particle Argon)

image_2023-01-30_200219458.png

https://youtu.be/L6W1d3pYbIw DEMONSTRATION!!! :) (file size too large for here, oops)

Hello! This page is to document an alarm clock that shines bright lights in your face and drops marbles on the floor.

Sounds annoying right? This device is for people who struggle to get up in the morning because it punishes not getting up early enough by making you clean, everyone hates cleaning. Unless you like cleaning, sorry.

This project isn't that hard to make, but it's functional and entertaining to watch.

Supplies

This project requires the following:

1 Particle Argon

1 Breadboard

1 NeoPixel LED Strip WS2812B (Can have any amount of LED's)

1 Stepper Motor

1 Button

1 Barrel Jack and External Power Supply Wall Wart


1 Soldering Iron

Setting Up the Argon: Programming.

image_2023-01-30_200207224.png

Before you turn your argon on, you must have some code to execute so that everything works correctly. Luckily for you, I have code.


Before that, we need to add the libraries that we are going to use.


I used NeoPixel and Stepper. Simply go to build.particle.io and go "Libraries" (The icon looks like a little banner) and type NeoPixel and Stepper (seperately) in the search bar.


Now that we have the libraries set up, here's the code:


// Setting variables and defining points on the Argon.
const int stepsPerRevolution = 2048;
int stopper = 0;
#define PIXEL_PIN D7
#define PIXEL_COUNT 4
#define PIXEL_TYPE WS2812B
#define IN1 2
#define IN2 3
#define IN3 4
#define IN4 5
int button = 6;
//Creating steppers and neopixel strips.
Stepper myStepper(stepsPerRevolution, IN1, IN3 , IN2, IN4);


Adafruit_NeoPixel strip(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);


void rainbow(uint8_t wait);
uint32_t Wheel(byte WheelPos);


void setup() {
    //Sets the speed of the stepper motor.
  myStepper.setSpeed(17);
  Time.zone(x);
  Serial.begin(9600);
  // This turns on the strip and turns off all pixels.
  strip.begin();
  strip.show();
  
  pinMode(button, INPUT_PULLUP);
}


void loop() {
    //This if is to supposed to find out if the time is 5:00 in the morning.
    int btnState = digitalRead(button);
    if(Time.hourFormat12() == x && Time.isAM() && stopper == 0)
    {
        //To find out if the alarm clock is still on or not
        if(btnState == HIGH)
        {
            rainbowLED();
        }
        else
        {
            stopper = 1;
            strip.clear();
            strip.show();
        }
    }
    if(Time.hour() == 6)
    {
        stopper = 0;
    }
}
void rainbowLED()
{
    //Checks if the alarm clock has been running for 5 minutes. This works because the alarm starts at 5.
            if(Time.minute() >= 05)
            {
                //Spins the motor to slam the hammer
                myStepper.step(stepsPerRevolution);
            }
            //Starts a rainbow effect
                rainbow(20);
}
void rainbow(uint8_t wait) {
  uint16_t i, j;


  for(j=0; j<256; j++) {
    for(i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel((i+j) & 255));
    }
    strip.show();
    delay(wait);
  }
}


uint32_t Wheel(byte WheelPos) {
  if(WheelPos < 85) {
  return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  } else if(WheelPos < 170) {
  WheelPos -= 85;
  return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else {
  WheelPos -= 170;
  return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
}

Copy and paste this code into your particle web IDE, found at build.particle.io

Alternatively, I put the code in a txt file just in case it's too large for instructables.

Soldering the LED Strip

image_123927839 (1).JPG

In order to use the NeoPixel LED Strip, you need to solder wires onto them. You need to solder 3 wires onto the LED's copper pad's in the direction that the current will be going to. To check this, look at where the arrows are pointing on your LED and go BACKWARDS, at the end where the arrows arent pointing towards, those are the pads you want to use.

Solder the 3 wires, preferably with different colored wires, and you're done with this step.

Setting Up the Argon: Connecting the Wires.

IMG_4431.jpeg
IMG_4436.jpeg
IMG_4437.jpeg
IMG_4438.jpeg
IMG_4441.jpeg
IMG_4443.jpeg

Now that we have the programming done, we will set up the argon and its component.

All Positives Inputs

  • Using a wire, connect IN1-4 wires on the Stepper Motor to Argons D2-D5 pins.
  • Using a wire, connect DIN on the LED Strip to Argons D6 pin.
  • Using a wire, connect Button positive wire to Argons D7 pin.
  • Using a wire, connect the TIP of the Barrel Jack (the one farthest away from the port to plug in your connector) to the positive rail, and let the positive rail go to the Argons VUSB Pin (is red, has a plus sign). WARNING! Make sure that you connect them to the right pin and DO NOT connect your argon to a usb power source AND wall power.

All Positive Power

  • Using a wire, connect the Power of the Stepper Motor to positive rail which goes to the VUSB Pin.
  • Using a wire, connect the 5V of the LED to the 3V3 pin on the Argon.
  • I found it best here because if its connected to the VUSB Pin and is only going off by itself the LED strip will freak out, probably because there's too much current going to it. If you have more LED's you might need to connect it to VUSB as well.

All Grounds

  • Using a wire, connect the LED's Ground Wire to the Ground rail (is blue, has a negative sign).
  • Using a wire, connect the Buttons Ground Wire to the Ground rail.
  • Using a wire, connect the Stepper Motors Ground Wire to the Ground rail.
  • Using a wire, connect the SLEEVE of the Barrel Jack (the one closest to the port to plug in your connector) to the negative rail. Same warning as the Tip, don't plug in usb and wall power at the same time.
  • Using a wire, connect a wire from the Argons GRD Pin to the Ground rail.

Creating the Bucket: the Only Physical Thing

IMG_4452.jpeg
IMG_4455.jpg
IMG_4454.jpg
IMG_4453.jpeg

This project doesn't have a lot of physical things you need to create by hand, BUT the only thing you need is a small cardboard bucket.

In order to do this, just grab a cardboard box, hot glue and a knife, whether that be an exacto knife or just some folding knife.

Cut 3 rectangles into cardboard, should be about 3" x 1" and a small square that covers the bottom of it. Hot glue all of them together and make a small hole that is enough to fit the stepper motors rotating bit in the center of the back piece of cardboard to put the bucket and the stepper motor together.

Put marbles into the bucket as the bucket is connected to the stepper motor and make sure they don't fall out.

  • To do this I made a ramp to hold it up so that it's always at an angle to drop the marbles. It's basically just a slanted piece of cardboard that has a small cubby to hold the stepper motor, and just required some bending of cardboard and hot gluing a small piece of cardboard onto the bent cardboard piece.

Other than that there are no more other cardboard pieces you have to create thankfully :)

Accessing the Alarm Clock: How to Use the Clock.

IMG_4342.jpeg

In order to use the alarm clock, you're going to want change the time the clock goes off depending on when you want to wake up. In order to do this, in the code change these lines. To change the time zone, convert your time zone to UTC time.

  • Replace x on Time.zone() to whatever time UTC converts to for you, to do this you need to search up "UTC time converter" and find the difference between your time and the UTC time (i.e. 6pm CST and 12pm UTC, different is +6). Replace x in Time.zone() with that number.
  • Replace x in (Time.hourFormat12()) to the time you want to wake up.


Time.zone(x); (!! CHANGE ME !!)
if(Time.hourFormat12() == x (!!CHANGE ME!!) && Time.isAM() && stopper == 0)


Point the LED's lights toward your bed (preferably somewhere where you can see them) and have the marbles be positioned to where they will drop on the floor. Why? Because it will create a mess and that is on purpose, so you can get up from bed and remember to get up earlier. That's basically all you need.


And that's all that this project requires. If you finished it, congrats! Enjoy the annoying alarm clock :)