In this article, I will show you how to create a 3D Rotary Switch Animation using Arduino and Blender. This is another implementation of the BlendixSerial addon, which provides a quick and effective way to animate objects in real-time with Blender. By following this tutorial, you’ll gain a better understanding of how to visualize and enhance your projects using these powerful tools.
The 3D Rotary Switch Animation project is part of a series of articles focusing on BCD switches.
Easy Way To Read Rotary BCD Switch (16 Positions) With Or Without Arduino
In this project, we will create a 3D model of the switch and animate it in real-time using an actual BCD switch connected to an Arduino. We’ll read the BCD switch data with Arduino and transmit it to Blender using the BlendixSerial addon and library. Then, we’ll animate the 3D model using this addon.
3D Model of Rotary BCD Switch
I’ve made a 3D model of a switch in three separate parts. This is important for selecting parts for animation in the addon. If you don’t do this, you won’t get the desired animation. If you’re using a premade model, make sure to separate the dial or knob and pins from the body. You can check out the model I created to see how it works, then apply it to your own models. I’ve included the Blender file link in the post below.
How to Animate Switch 3D Model
In the addon, select the dial in the Object 1 tab. Set the property to “Rotation” and the axis to “Y”. Also, in the axis text selection area below, choose the text that shows the decimal selection of the dial and its angle. Make sure to check the X and Y options, as we send the values using these axes.
We have now animated the pins of this 3D model based on the actual switch pin states. If any pin is high, it will appear red; if low, it will be blue. To achieve this, we selected an empty object in the second object tab and set its property to location with axes XYZ. The interesting part is using Blender drivers to map pin states to colors. We used the empty object’s X, Y, and Z locations as drivers, pasting them into each pin’s material settings. For each pin’s material, we applied a mix color shader, selecting blue for A color and red for B. The driver mentioned earlier should be pasted into the factor value selection.
In the third tab, we need to choose another empty object. This object will handle the data for the fourth pin because the second tab only provides data for three pins through the X, Y, and Z axes, leaving one pin unassigned. To accommodate this, we’ll use another empty object in the third tab, setting its properties and axes to location and XYZ. Like the previous pins, we’ll assign the same type of material to this pin with the help of blender driver.
Next, you should select the text object in the text object tab to receive the binary values of the pins, which will also be displayed in the 3D viewport.
Here’s how the final setup looks.
Now, let’s proceed to write the Arduino code for our 3D Rotary Switch Animation Project.
Arduino code for 3D Rotary Switch Animation
Here is the 3D Rotary switch Animation in real Time using the Arduino and blender.
Blender Project File
You can download the 3D Rotary Switch Animation Blender file by clicking the download button.
Please wait 120 seconds: after that, your download will begin ⏳
ZIP Password : electronicstree.com