Expressive Pumpkin Bucket

by CroissantPoisson in Circuits > LEDs

316 Views, 6 Favorites, 0 Comments

Expressive Pumpkin Bucket

Reactive Pumpkin Basket
VideoCapture_20241111-142754 (3).jpg
VideoCapture_20241111-150923 (1).jpg
VideoCapture_20241111-150912 (2).jpg

Carving pumpkins to create expressive faces has been a beloved tradition for hundreds of years. This year, we celebrated this tradition by combining it with modern technology. In this Instructable, we’ll show you how to create a 3D-printed pumpkin that uses LEDs to display a variety of expressions. Unlike biological pumpkins, this one will not rot and can change expressions.

Our brains are incredibly skilled at recognizing patterns that resemble a face, even when there is no face, so we often see faces in unrelated objects like cars or electrical outlets. Therefore, simple geometric shapes can convey a wide range of emotions, from upsetting frowns to friendly smiles. Similarly, even the limited combinations of an 8x8 LED matrix can represent a large variety of eye expressions.

The virtually limitless expressions allow the pumpkin to have a diverse range of reactions to different stimuli. By incorporating distance and motion sensors, our pumpkin will react to people taking candy, making the simple act of taking something out of a basket much more interactive and engaging.

In designing our Expressive Pumpkin Basket, we aimed to keep it as simple as possible by incorporating basic geometric shapes and patterns in both the physical and electronic design. We hope you find this tutorial easy to follow and inspiring for creating your own pumpkin. Without further ado, let’s get started and build our Expressive Pumpkin Basket!

Supplies

20241111_162501.jpg

Materials

2x WS2812B LED Matrix Panel

Arduino Microcontroller Board

Breadboard

3x 1.5V AA Batteries + Battery Case

Ultrasonic Distance Sensor (HC-SR04)

PIR Sensor (motion sensor)

3D Printer + Filament

Jumper Wires (male to male and male to female)

Adhesive (tape or glue)

Software

Fusion 360

Cura (or any other slicer)

Arduino IDE (with FASTLED library)

Additional Part Specifications

WS2812B LED Matrix Panel

This type of LED matrix functions similarly to an LED strip, with a single data line traversing along the entire grid. There are three inputs: power, ground, and data in. Different types of LED matrices may require additional components and different codes to function. This specific type of matrix is required for this Instructable. 

Batteries

With two 8x8 LED matrices, there are a total of 128 LEDs. To meet the power requirements for the large amount of LEDs to shine brightly, a battery with a higher capacity rating is recommended. The battery case connects the three 1.5V batteries in series, totaling up to 4.5V. The operating voltage of the components is around 5V, but 4.5V is generally within an acceptable range. These components may not function properly if the voltage is too low, so make sure to use new batteries.

Pumpkin Model

20241111_163334.jpg

Pumpkins are a great example of patterns in nature. Their distinct shape stems from their growth patterns, with some parts growing faster than others. While the shape of a pumpkin may seem complicated at first glance, it can broken up into one repeating pattern. We will replicate their design by using the circular pattern tool on a torus in Fusion 360. The following example creates a 9.5in x 9.5in x 7.625in pumpkin. You can scale the given size values based on the desired print size. Dimensions are listed in Length x Width x Height. 

The instructions below require a basic knowledge of the modeling tools of Fusion 360. If you do not want to model the pumpkin, the model files can be found at the end of this step. There is a .stl file that you can directly slice to print and a .f3d file if you want to explore the model yourself in Fusion 360.


Start by inserting a Torus. Set the torus to the desired build size

Create a Circular Pattern using the previously made torus. Select the lowest quantity that can create a closed shape. Once the pattern is created, use the Combine tool to combine the pattern into one part. 

While the current part looks like a solid shape, it is hollow inside as there is a hole in the center of each torus. To fix this, insert a Sphere with a greater inner diameter than the torus at the center. By using the Join operation when creating the sphere, we will end up with one solid part. 

Pumpkins are flatter at the top and bottom. To replicate this, create an extruded cut of about 1in-1.5in off the top and bottom of the model.

Now, we will open up the pumpkin model with the Shell tool in an Outside direction. An outside thickness of 0.125in provides a good amount of strength without using too much material. With this step, we have finished the base model of a pumpkin. Next, we will add the functional parts of the design.

Cut Extrude two square-shaped holes for the eyes. These should be slightly smaller than your LED matrices. Since this example includes 3.15in x 3.15in matrices, the holes are 3in x 3in. 

To create an area for the electronics, Extrude an inner wall around 2 inches away from the face of the pumpkin on the top plane. Use an To Object extent type, so the inner wall will fit the shape of the pumpkin. 

There is still space between the sides of the inner wall and the edge of the pumpkin. To fill this in, Extrude the sides of the inner wall to the sides of the pumpkin. Use the To Object extent type to fit the shape of the pumpkin. Now, the pumpkin is separated into two compartments. 

Extrude a 1inx2in platform which will later hold the Ultrasonic Distance Sensor. 

Cut Extrude two holes for wires to go through. The sensors are in the basket part of the pumpkin, so they need pathways for their wires to connect to the power and Arduino board.

Create Fillets for the edges at the top of the pumpkin. This removes sharp edges, preventing scratches on the hands that will be reaching in for candy.

The pumpkin model is finished, so the next step is to slice it. This model can be printed as one piece using reasonable amounts of support material. The pumpkin will only be holding candy, so 15-20% infill provides enough strength. Once you have sliced the pumpkin model, send it to a 3D printer.

Circuitry

OmegaPumpkinPi.png

The diagram above displays all the connections for the electrical components of this design. In a nutshell, all we have to do is connect each component to the Arduino and bus lines. We will go over one section at a time.

Section 1: Power from the Battery and Breadboard

Components:

  1. 3x 1.5V AA Batteries + Battery Case
  2. Breadboard
  3. Arduino Microcontroller Board
  4. Jumper Wires (male to male and male to female)

Connections:

  1. Battery Pack:
  2. Connect the positive terminal of the battery pack to the power (red) rail of the breadboard.
  3. Connect the negative terminal of the battery pack to the ground (blue) rail of the breadboard.
  4. Arduino:
  5. Connect the 5V pin of the Arduino to the power rail of the breadboard.
  6. Connect the GND pin of the Arduino to the ground rail of the breadboard.

Note:

This circuit only uses the bus lines of the breadboard.

Section 2: Sensors

Components:

  1. Ultrasonic Distance Sensor (HC-SR04)
  2. PIR Sensor (motion sensor)
  3. Jumper Wires (male to male and male to female)

Ultrasonic Distance Sensor (HC-SR04) Connections:

  1. Power and Ground:
  2. Connect the VCC pin of the sensor to the power rail of the breadboard.
  3. Connect the GND pin of the sensor to the ground rail of the breadboard.
  4. Trigger and Echo Pins:
  5. Connect the Trigger pin to a digital pin on the Arduino (e.g., pin 7).
  6. Connect the Echo pin to a digital pin on the Arduino (e.g., pin 6).

PIR Motion Sensor Connections:

  1. Power and Ground:
  2. Connect the VCC pin of the sensor to the power rail of the breadboard.
  3. Connect the GND pin of the sensor to the ground rail of the breadboard.
  4. Output Pin:
  5. Connect the output pin of the PIR sensor to a digital pin on the Arduino (e.g., pin 8).

Section 3: LED Matrices

Components:

  1. 2x WS2812B LED Matrix Panel
  2. Jumper Wires (male to male and male to female)

Connections:

  1. Power and Ground:
  2. Connect the VCC pin of the first LED matrix panel to the power rail of the breadboard.
  3. Connect the GND pin of the first LED matrix panel to the ground rail of the breadboard.
  4. Connect the VCC and GND output pins of the first LED matrix to the VCC and GND inputs of the second LED matrix.
  5. Data Line:
  6. Connect the data input pin of the first LED matrix panel to a digital pin on the Arduino (e.g. pin -9).
  7. Connect the data output pin of the first LED matrix panel to the data pin of the second LED matrix panel.

Additional Considerations:

Refer to the data sheets of the WS2812B LED matrix, HC-SR04 ultrasonic sensor, and PIR sensor if you want more detailed information on the components.

Making the Eye Patterns

By lighting up select LEDs on the matrices, we can display shapes resembling eyes. Despite being limited to 64 pixels, these eyes can display a wide array of emotions. In this step, we will go over the process of easily creating custom expressions.

To start, create a spreadsheet to develop a template for your eye patterns. For the 8x8 LED Matrix that we are using, the data line is shown below. Each number represents the index of the corresponding LED in that location. By mapping out the expressions, we can easily create the array of LEDs to light up for each expression.

Numbers 0 - 63 represent the left eye, and 64 - 127 represent the right eye. 

Start by laying out a rough base design of how you want your eyes to look by filling in the cells. Below are examples of the led matrix eye expressions.

Neutral: 

Happy:

Sad: 

Angry: 

Pensive: 

Dead: 

Once your desired facial expressions have been completed, you can start to add animation frames to make the expressions more lively. These animations can be blinking, moving pupils, or any other type of movement. The following examples are blinking animations.

Neutral: 

Joyful : 

Sad : 

Angry : 


Pensive : 


Dead : 

For each completed frame, create a list of the highlighted numbers. These numbers index the corresponding LEDs that need to be lit up on the LED matrix to display the selected frame. Some LED patterns may be the same across different frames. Noticing this repetition can save time as you will have fewer lists to create. Below are the lists of numbers for the example frames.

Neutral: 

  1. {3, 4, 10, 13, 17, 22, 25, 30, 33, 38, 41, 46, 50, 53, 59, 60, 67, 68, 74, 77, 81, 86, 89, 94, 97, 102, 105, 110, 114, 117, 123, 124}
  2. {10, 11, 12, 13, 17, 22, 25, 30, 33, 38, 41, 46, 50, 51, 52, 53, 74, 75, 76, 77, 81, 86, 89, 94, 97, 102, 105, 110, 114, 115, 116, 117}
  3. {17, 18, 19, 20, 21, 22, 25, 30, 33, 38, 41, 42, 43, 44, 45, 46, 81, 82, 83, 84, 85, 86, 89, 94, 97, 102, 105, 106, 107, 108, 109, 110}
  4. {25, 26, 27, 28, 29, 30, 33, 34, 35, 36, 37, 38, 89, 90, 91, 92, 93, 94, 97, 98, 99, 100, 101, 102}

Joyful: 

  1. {25, 26, 27, 28, 29, 30, 33, 34, 35, 36, 37, 38, 89, 90, 91, 92, 93, 94, 97, 98, 99, 100, 101, 102}
  2. {17, 18, 19, 20, 21, 22, 25, 30, 33, 38, 41, 42, 43, 44, 45, 46, 81, 82, 83, 84, 85, 86, 89, 94, 97, 102, 105, 106, 107, 108, 109, 110}
  3. {11, 12, 18, 21, 25, 30, 33, 38, 41, 46, 50, 51, 52, 53, 74, 75, 76, 77, 81, 86, 89, 94, 97, 102, 106, 109, 115, 116}

Sad: 

  1. {25, 26, 27, 28, 29, 30, 33, 34, 35, 36, 37, 38, 89, 90, 91, 92, 93, 94, 97, 98, 99, 100, 101, 102}
  2. {17, 18, 19, 20, 21, 22, 25, 30, 33, 38, 41, 42, 43, 44, 45, 46, 81, 82, 83, 84, 85, 86, 89, 94, 97, 102, 105, 106, 107, 108, 109, 110}
  3. {10, 11, 12, 13, 17, 22, 25, 30, 33, 38, 42, 45, 51, 52, 75, 76, 82, 85, 89, 94, 97, 102, 105, 110, 114, 115, 116, 117}

Angry: 

  1. {3, 4, 10, 13, 17, 22, 25, 30, 33, 38, 41, 46, 50, 53, 59, 60, 67, 68, 74, 77, 81, 86, 89, 94, 97, 102, 105, 110, 114, 117, 123, 124}
  2. {11, 12, 18, 21, 25, 30, 33, 38, 42, 45, 51, 52, 75, 76, 82, 85, 89, 94, 97, 102, 106, 109, 115, 116}
  3. {17, 18, 19, 20, 21, 22, 25, 30, 33, 38, 41, 42, 43, 44, 45, 46, 81, 82, 83, 84, 85, 86, 89, 94, 97, 102, 105, 106, 107, 108, 109, 110}

Pensive : 

  1. {14, 17, 18, 19, 20, 27, 28, 30, 33, 37, 41, 42, 43, 44, 45, 46, 53, 54, 73, 74, 81, 82, 83, 84, 85, 86, 90, 94, 97, 99, 100, 107, 108, 109, 110, 113}
  2. {14, 18, 19, 27, 28, 29, 35, 36, 37, 41, 42, 43, 53, 54, 73, 74, 84, 85, 86, 90, 91, 92, 98, 99, 100, 108, 109, 113}
  3. {14, 17, 29, 35, 41, 42, 43, 84, 85, 86, 92, 98, 110, 113}

Dead : 

  1. {27, 28, 35, 36, 91, 92, 99, 100}
  2. {18, 21, 27, 28, 35, 36, 42, 45, 82, 95, 91, 92, 99, 100, 106, 109}
  3. {9, 14, 18, 21, 27, 28, 35, 36, 42, 45, 49, 54, 73, 78, 82, 85, 91, 92, 99, 100, 106, 109, 113, 118}
  4. {0, 7, 9, 14, 18, 21, 27, 28, 35, 36, 42, 45, 49, 54, 56, 63, 64, 71, 73, 78, 82, 85, 91, 92, 99, 100, 106, 109, 113, 118, 120, 127}

With all of the LEDs indexed for each frame of each expression, creating the code to display the expressions will be much easier.

Code

This code, which will be run in Arduino IDE, will display the expressions we just created. The file for the code is attached at the end of this step if you do not want to make your own. If you created your custom expressions in the previous step, you can easily display them with minor altercations to the example code.

We will use a library called FastLED to control the LED matrices. Make sure to install it and declare it at the beginning of your code with #include

Define your physical hardware components corresponding to the pins you connected them to on the Arduino board. The duration and long variables will be used to calculate distance from the Ultrasonic Distance Sensor.

In your setup function, declare the LED matrix and sensors. 

Next, insert the arrays created from the previous step to define the frames of each expression.

Create a function for each of the expressions. Start by clearing the previous frame and then turn on each LED indexed for the frame. Use RGB color codes to select the color of the expression. Include a short delay between each blinking frame and a longer delay after the main expression to create a smooth animation.

Finally, create conditionals in the loop function for the LED matrices to display different expressions based on the sensor data. When the PIR sensor detects motion, the pumpkin will turn angry. When there is no motion, the pumpkin will have an expression based on the level of candy left in the bucket. The level of candy is detected with the Ultrasonic Distance Sensor. Based on how big your pumpkin is, you may need to adjust the distance values. The code below has the distance in centimeters.

Downloads

Final Assembly

With all parts of the pumpkin created, the last step is to put them all together. There are only a few steps for the assembly. You are very close to having your own expressive pumpkin basket.

Place the PIR Sensor near the top of the pumpkin facing slightly downwards to the other side. This position allows it to sense movement from anywhere in the basket. Then, place the Ultrasonic Distance Sensor on its designated platform. It is facing down and slightly back so that it can sense the overall candy level. Attach the sensors with an adhesive.

Then, place the rest of the electronic components in the front compartment and make sure that they are wired up as seen in Step 2. Put wires through the holes of the inner wall to connect the sensors to the Arduino board. Place the LED matrices in the eye holes of the pumpkin with the wires facing inwards. Secure them with an adhesive.

Congratulations! You have finished making your own expressive pumpkin basket.

Conclusion

Pumpkin Expressions Timelapse

Above is a timelapse of the pumpkin going through all the expressions as candy is taken out. This specific video was taken in a low-light environment to highlight the expressive eye patterns. With your newly created pumpkin, you can experiment with all the possible patterns of the 8x8 LED matrix to create a wide range of expressions. Alongside the color-changing capabilities of the LED matrix, you can capture almost any type of feeling.

The purpose of this basket is to make taking out an item more fun. It also serves as an indicator of how full the basket is. A possible use case would be to place it on a porch on Halloween night as a fun surprise for trick-or-treaters. Despite the Halloween theme, this pumpkin is not limited to a candy container. It will work with any item that fits inside.

With the concepts learned from this instructable, you may start to see how many patterns are present in your everyday life. From fruits to facial expressions to modern architecture, you may start to recognize the recurring patterns present all around you.