SerialTalk: Universal Micropython Serial Remote Procedure Library for MINDSTORMS Robots

Anton

Serialtalk EV3 and robot inventor micropython communication

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:

  1. Weather Station: Use sensors to collect weather data and display it on your MINDSTORMS robot.
  2. Security Bot: Integrate a smart camera for facial recognition.
  3. 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!

Like this article? Help us make more!

Your support matters

We appreciate your support on Patreon and YouTube! Small things count.

Become a Patron

Don't miss a thing

Subscribe below to get an email when we publish a new article.

Share this with someone who needs to know

8 thoughts on “SerialTalk: Universal Micropython Serial Remote Procedure Library for MINDSTORMS Robots”

  1. 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.).

    Reply
  2. 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?

    Reply
  3. What are you using to physically interface the EV3 to the LMS-ESP32 in your image at the top? I purchased a triple pack of your LMS-ESP32s last year, but only recently am working with them again on my RIS Hub. But I recently picked up a couple of EV3 Hubs and they want to join in on the fun 🙂

    Reply
    • We’re using a special adapter that is not (yet) for sale in the shop. Do you want to buy one? I could put it up, but I was unsure about how many people would want one, and if I wouldn’t be doing al the effort for nothing. If you program the EV3 in regular python (not pybricks-micropython) you can also use the usb-A port on the side of the EV3 to connect to the LMS-ESP32. Linux will create a serial interface for you.

      Reply
      • I am not a hard core programmer, so am always on the lookout for hardware, tutorials and functioning examples that make my programming life funner and easier when interfacing with otherwise proprietary and often incompatible stuff (looking at you LEGO and your range of Mindstorms ;P )

        So far I prefer to use PyBricks for all my LEGO stuff, and just assumed that this adapter was needed for this Serial Talk to work on and EV3. My EV3 (running ev3dev) has not been used much as my focus has been on interfacing the ESP32 and other electronics with LEGO RIS Hub, so thought this Serial Talk might help to bring the EV3 into that fold.

        And while I can’t guarantee I would get one right away (but probably soon), I guess it depends on knowing more about what it contributes and costs (and of course I would have to import over the pond).

        But I can guarantee that no one will ever purchase one if it is never listed 😉

        Reply

Leave a Reply

Item added to cart.
0 items - 0.00