Happy New Year Trigger
1 545 Easy

Happy New Year! 2021 is here!  Due to pandemic and social distancing guidelines, our new year eve celebration was a little quiet. We opted to stay home to reduce the spread and protect each other. As an engineer, I thought of ways on what I can accomplish to make our new year celebration a little brighter and upbeat. Snow Globes always reminds me of fun times, playful happy moments.  As we head out for an extended pandemic year, I want to capture that feeling for the coming year,. May this year filled with fun happy moments.

The plan:

Let the countdown video turn on the snow globe effect.

Train the HuskyLens object tracking to learn this video frame from this countdown video

https://youtu.be/UTMdUzD8oLE

Do you want to build a snow globe?

1. Hot glue the picture frames together to build a box. 

2. Get a shoebox as a platform for snow globe

3. Cut 4 holes on shoe box and cover with Loofah mesh, this is where the air would flow into the snowglobe. 

4. Place the snowman toy inside the box and add styrofoam particles as snow.

5. Cut a cardboard and glue to top opening

6. Set the fan to look up and place the snowglobe on top of fan.

 

Training the HuskyLens

1. Teaching HuskyLens. Point Huskylens to the target frame, in this case it's the 1 second before the new year frame. Adjust the distance and until the object is within the yellow frame of the center of the screen. Long press "learning button" to learn the object, moving the HuskyLens capturing various angles and distances. "Learning: ID1" is displayed on the screen. When HuskyLens can track the object, release the "learning button" to complete the learning.

2. Don't forget to turn off the “Learn Enable”, this will stop the HuskyLens from continuous learning the frames 

Note: HuskyLens can track only one object at a time.

 

Connecting to micro:bit

The HuskyLens is connected to micro:bit via i2c. There's a setting on HuskyLense to change to I2C Mode.  

Refer to the HuskyLens micro:bit tutorial 

https://wiki.dfrobot.com/HUSKYLENS_V1.0_SKU_SEN0305_SEN0336#target_34

The micro:bit is connected to IoT Relay via Pin 11. Once the 1-second frame is detected, a signal is sent to the IoT Relay to turn on the fan, this would blow the little styrofoam snow particles.

The IoT Relay is connected to pin 11 and the other wire is connected to ground pin. I used a micro:bit breakout board to make it easy to connect

HARDWARE LIST
4 Picture Frames
1 Snowman toy
1 Cardboard box
1 Loofahs Sponge - Mesh Pouf Soft Scrubber
1 micro:bit
1 DFRobot HuskyLens
1 Iot Relay - Enclosed High-power Power Relay
1 Keyestudio Motor Driver Breakout Board TB6612FNG with Terminal Block BLE Serial for BBC Microbit Breakout
1 Fan
projectImage
projectImage
projectImage
projectImage
CODE
input.onButtonPressed(Button.A, function () {
    pins.digitalWritePin(DigitalPin.P11, 0)
    basic.showIcon(IconNames.No)
})
huskylens.initI2c()
huskylens.initMode(protocolAlgorithm.ALGORITHM_OBJECT_TRACKING)
basic.showIcon(IconNames.Heart)
pins.digitalWritePin(DigitalPin.P11, 0)
basic.forever(function () {
    huskylens.request()
    if (huskylens.isAppear(1, HUSKYLENSResultType_t.HUSKYLENSResultBlock)) {
        pins.digitalWritePin(DigitalPin.P11, 1)
        basic.showIcon(IconNames.Happy)
    } else {
        basic.showIcon(IconNames.Asleep)
    }
})
projectImage

HAPPY NEW YEAR!!! If this project helped you learn about Huskylens, or made your day a little brighter, click the heat button

License
All Rights
Reserved
licensBg
1