🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Control Lego Power Functions via IR remote and blockly

    Scheduled Pinned Locked Moved General
    6 Posts 3 Posters 12.9k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F Offline
      Freefaller
      last edited by

      Hey!

      I wanted to let my son experiment a bit with M5Stack and Lego. I've seen that there is a module to control Lego motors, but this seems to be rather for mindstorms motors (EV3 or NXT seem to be the notations). However, many cheaper Lego models come with Lego 'Power Functions' motors, which won't work with this module for all I can tell.

      I was thinking through different options, and finally felt like the easiest way is to just emulate the IR remote with M5Stack, which in theory would be pretty straightfoward to do. There are even some libraries to do so, but none seems to be compatible to UIFLow blockly, which my son would use:

      https://www.elecfreaks.com/store/blog/lego-power-functions-ir-sender-for-microbit.html
      https://github.com/jurriaan/Arduino-PowerFunctions

      Is there any good way to import these into UIFlow blockly to use for an 8 year old?
      Might it be an option to integrate this by default into UIFlow, as it is a cool option for many users.

      Regards,
      Freefaller

      1 Reply Last reply Reply Quote 0
      • lukasmaximusL Offline
        lukasmaximus
        last edited by

        Hi @Freefaller you can take a look at this thread for info about using older lego motors http://forum.m5stack.com/topic/1570/is-there-an-easy-way-to-connect-m5stack-or-m5stick-c-to-old-lego-mindstorms-motors-and-sensors-robotic-invention/15 also @ajb2k3 is quite knowledgeable on this subject and usually quite happy to respond to any questions

        1 Reply Last reply Reply Quote 0
        • F Offline
          Freefaller
          last edited by

          Oh wow, sorry for missing this existing thread. Not exactly what I was looking for (as I was hoping for the infrared connection) but still what I need to solve my problem. Will probably then get the base-x module and solder myself the cable connections (can't seem to be able to buy them anywhere anymore).
          Thanks!

          1 Reply Last reply Reply Quote 0
          • ajb2k3A Offline
            ajb2k3
            last edited by

            Sorry been absent for a while.
            Someone did control PF using the stick C's built in IRLED but can't remember how.
            There are instructions on how to build NXT>PF leads but I haven't had time to revisit.

            UIFlow, so easy an adult can learn it!
            If I don't know it, be patient!
            I've ether not learned it or am too drunk to remember it!
            Author of the WIP UIFlow Handbook!
            M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

            F 1 Reply Last reply Reply Quote 0
            • F Offline
              Freefaller @ajb2k3
              last edited by

              Someone did control PF using the stick C's built in IRLED but can't remember how.

              So there's existing integration for that into MakeCode (which is also blockly based I believe) and then also the regular Arduino lib. Also the whole IR protocol is documented officially by Lego. But the MakeCode integration seems JS based (not Python based), and I also don't see a good waqy to integrate the Arduino lib into the UiFlow custom component editor. So probably whoever did this before just wrote regular Arduino code for the M5Stick using the Arduino library.

              If I ever find a lot of time I might try to reverse engineer the existing code, and redo as a custom block in UIFlow, but not sure if this will ever happen ;-)

              There are instructions on how to build NXT>PF leads but I haven't had time to revisit.

              I'm also gonna look into that :-)

              ajb2k3A 1 Reply Last reply Reply Quote 0
              • ajb2k3A Offline
                ajb2k3 @Freefaller
                last edited by

                @freefaller the front end of UIFlow may be java but the back end code that gets sent to the M5Stack is Micropython

                UIFlow, so easy an adult can learn it!
                If I don't know it, be patient!
                I've ether not learned it or am too drunk to remember it!
                Author of the WIP UIFlow Handbook!
                M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

                1 Reply Last reply Reply Quote 0

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better 💗

                Register Login
                • First post
                  Last post