If you’re a LEGO MINDSTORMS enthusiast, then the SerialTalk Micropython library is your ticket to taking your custom hardware projects to the next level. Developed to serve as a universal integration tool, SerialTalk offers unparalleled versatility and ease of use. Let’s dig in!
One Library to Rule Them All
SerialTalk was born out of the need for a single, cohesive way to bring all our custom hardware projects under one roof. Whether you’re working with UART, Sockets, Bluetooth Classic, BLE, or any other serial protocol, SerialTalk has you covered. When it comes to MINDSTORMS Robot Inventor, this library is the fastest and most versatile method for brick-to-brick communication over Bluetooth.
Making It Work
Here’s the best part: You can simply define functions and their return formats, then call them from another Python program. Sounds simple? It is!
Here’s a small code snippet to demonstrate SerialTalk with LMS-ESP32 and MINDSTORMS EV3:
# On the LMS-ESP32 side
from serialtalk.auto import SerialTalk
st = SerialTalk()
def get_temperature():
return 22.5 # Replace this with your sensor data
# Pass the function and the struct type of the result. Here it's f for floating point number.
st.add_command(get_temperature, 'f')
st.loop()
# On the MINDSTORMS EV3 side, using Pybricks on ev3dev.
from serialtalk.auto import SerialTalk
from pybricks.parameters import Port
st = SerialTalk(Port.S1)
ack, temp = st.call('get_temperature')
print(f"Temperature is {temp}")
Application of SerialTalk: Smart Camera ball grabber

With the Smart Camera Ball grabber, I’m using SerialTalk to pass the size of the ball and the location on the camera sensor to the MINDSTORMS EV3 brick. Communication is so fast that I can easily implement a feedback loop on the EV3 and steer towards the ball smoothly.
The OpenMV camera also has an I2C voice recognition sensor plugged in. SerialTalk also transfers the voice command it recognizes to the EV3 brick. Now the brick is like a pet! I can say: “Hey brick, go forward!” Or “Hey brick, fetch ball!”
You can see how fast the EV3 reacts to the camera and voice commands on Instagram.
SerialTalk: A Micropython Toolbox for Your Projects
SerialTalk is super handy for a wide array of applications. We use it mostly to talk to our LMS-ESP32 board or our OpenMV camera. See the full SerialTalk library on GitHub.
- Sensors
- Displays
- Smart Cameras
- Computer Vision
- Remote Control
- Custom Electronics
Some of our older projects use UartRemote for the same purpose. SerialTalk is 100% compatible with UartRemote. SerialTalk is just more versatile and better maintained.
Cool SerialTalk Micropyton Project Ideas
Let’s get those wheels turning! Here are some project ideas you could try with SerialTalk:
- Weather Station: Use sensors to collect weather data and display it on your MINDSTORMS robot.
- Security Bot: Integrate a smart camera for facial recognition.
- Remote-Controlled Car: Control your LEGO car from your computer or phone.
Got a cool project? Share your creations on social media and tag @antonsmindstorms. I’m eager to see and share your innovative designs!
Get Involved with Serial Talk
Interested in diving deeper? You can find all the documentation you need on docs.antonsmindstorms.com. Whether you’re a beginner or a seasoned pro, there’s something for everyone to learn and contribute.
So there you have it! SerialTalk Micropython library offers a streamlined, efficient, and highly versatile way to level up your MINDSTORMS projects. Go unleash your creativity!
Very excited to give SerialTalk a try. What if you want to communicate with both a LMS ESP32 and a OpenMV from your Mindstorms Hub? I’m guessing you need to use a separate port on the hub for each one. Can you use Serial Talk for both boards or do you need to use UartRemote for one board and Serial talk for the other. (In the past, I tried to use uartRemote for both boards and it didn’t work.).
I suggest this:
– Use a separate port for each one.
– Create a serial interface for each port using
from projects.mpy_robot_tools.serialtalk.mshub import MSHubSerial
– And then
st_port_f = SerialTalk(MSHubSerial('F'))
andst_port_e = SerialTalk(MSHubSerial('E'))
– See also: https://docs.antonsmindstorms.com/en/latest/Software/SerialTalk/docs/index.html
Do you have any plans to post step by step tutorials for SerialTalk projects like you did for UartRemote? The tutorials were a huge help and I probably couldn’t have started using UartRemote without them. Also, can I just use the version of Python that comes with LEGO Mindstorms Inventor instead of PyBricks?
Does this help? https://docs.antonsmindstorms.com/en/latest/Software/SerialTalk/docs/index.html
You can use LEGO python, but only SPIKE2 and MINDSTORMS. SPIKE3 is nerfed.