This is a quick and easy guide to LED control in Blender with Arduino in real time. It will show you how to use the blendixserial add-on and library to send data in Blender, as well as how to animate objects in Blender using this data.
Prerequisites
Before starting, make sure you have:
- Blender (4.2 or above)
- blendixserial add-on for Blender
- Arduino board (e.g., Arduino Uno)
- Potentiometer 10K
- Arduino IDE installed on your PC
- blendixserial Library for Arduino
How to use blendixserial Library
First, we need to include the blendixserial
library, which will allow our Arduino to communicate with Blender. At the very top of the sketch, add this line:
#include "blendixserial.h"
Now, we will create an instance of blendixserial
, which will handle the data transmission:
blendixserial blendix;
Next, we need to define the necessary variables.
potPin
stores the analog pin where the potentiometer is connected.mappedValue
will store the scaled potentiometer value.previousValue
helps us detect changes in the potentiometer reading.
Add this below the previous code:
int potPin = A0;
float mappedValue = 0.0;
float previousValue = -1.0;
Now that we have our variables ready, we will move on to setting up serial communication.
Now, we will configure the serial communication between Arduino and Blender inside the setup()
function.
Inside setup()
, we need to:
- Start the serial communication at 9600 baud.
- Set the coordinate type to floating-point values.
- Specify that we will be sending one set of coordinates (X, Y, Z).
Now, add the following setup()
function:
Serial.begin(9600);
blendix.setCoordinateType(COORD_TYPE_FLOAT);
blendix.setTxSets(1);
Now, we are ready to read the potentiometer data inside the loop()
function.
In the loop()
function, the first thing we need to do is read the analog value from the potentiometer. This value ranges from 0 to 1023. However, we need to map it to a usable range before sending it to Blender for LED control
Now, add the following inside loop()
:
int potValue = analogRead(potPin);
mappedValue = round(((potValue / 1023.0) * 2.7) * 10 / 3) * 0.3;
How the Mapping Works
analogRead(potPin)
reads values between 0 and 1023.(potValue / 1023.0) * 2.7
scales the value between 0 and 2.7.round(... * 10 / 3) * 0.3
smooths the LED control animation by rounding the value.
Now that we have the mapped value, we need to check if it has changed before sending it.
Now, we will send the mapped value to Blender only if it has changed. This prevents unnecessary data transmission.
Steps We Need to Do:
- Check if the value has changed from the previous one.
- Update the previous value before sending.
- Send the new value as the X coordinate (keeping Y and Z as
0.0
). - Format the output and send it to Blender.
Now, add this inside loop()
:
if (mappedValue != previousValue) {
previousValue = mappedValue;
blendix.setCoordinates(1, mappedValue, 0.0, 0.0);
uint8_t outputBuffer[50];
blendix.getFormattedOutput(outputBuffer, sizeof(outputBuffer));
Serial.println((char*)outputBuffer);
}
This ensures that Blender only receives new values, making the LED control animation smoother.
Importing and Preparing the 3D Model
We need a 3D model of an LED. If you’re not confident in your modeling skills, like I am, you can download a model from the web. Otherwise, you can create your own. I downloaded a model, so now let’s import it into Blender.
When you import the 3D model of the LED, it might appear large in Blender due to Blender’s default unit system, which uses arbitrary “Blender Units” (BU) that are not directly tied to real-world units like millimeters or meters. So, adjust the scale to bring the model to a reasonable size within Blender.
This model already has the material applied. So, I will select the outer body of the LED, which is red, and then in the Material tab, apply the emission color to red.
Setting Up the LED Control Animation
Next, add the empty arrow, and in the Object Properties panel, right-click on the location of the x-axis. Then select the option “Copy as New Driver.” Now, select the LED model and, on the emission option “Strength,” right-click and select “Paste Driver.”

Now, we will add a glowing effect to make it look even better. Go to the compositing window, then in the menu, select “Use Nodes.” You will see two nodes: the Render Layers and Composite nodes. Now click on “Add” in the menu, go to the Filter option, and choose “Glare.” This will add the Glare node, and in the options, select “Bloom” and set the glare strength value to 1.

At this point, the LED control animation is done. As we move this empty arrow on the X-axis, the emission strength values change, and the LED shows the brightness-changing animation.
Finalizing the LED Control Setup and Arduino Integration
Now, in the viewport shading options, set the compositor option to “Always.” By setting it to “Always,” it will enable the glow effect. Now, the LED control animation looks great! I know it doesn’t look completely realistic because I selected the emission for the whole outer body, but still, it looks great to me! 😂
Next, in the Add-on, set the mode to “Receive,” and in the object options, select the empty arrow. Set the property location and choose the X-axis. We are now ready to receive data.
Upload the code to the Arduino, and then in the Add-on, click the “Connect” button for the serial connection. (During this step, make sure the serial monitor is not open.) As we rotate the potentiometer, our LED brightness will be controlled. That’s cool!