Lego train v2

I already have an update. That l298 motor controller was way overkill for this and did not really fit where I wanted it to go anyway. I decided that if I’m going to be standardizing on stuff for this project it has to be small, cheap, and plentiful. I really like the d1mini because it’s about as small as I can make a board that’s easily reprogrammable, but also that there are some shields for it. In this case a motor shield. It uses an stm32 and takes commands over i2c.

The strangeness starts here though, because when looking for libraries to talk to it I found that most people upgrade the firmware on them. Well, on the one I got at least. Because it’s cheap. And the old design. So I upgraded the firmware, no big deal. Then the software didn’t want to talk to it.

helpful FTDI header for upgrading firmware

After throwing debug statements into the software, I eventually dug into the source for the new firmware I flashed. What do you know, it doesn’t support stuff that library was trying to access. I briefly debated adding stuff to this open source firmware, but I found the older library that was meant to talk to the older version of this board and it all worked. Here’s how it goes:

  • The WEMOS version of this board is v1
  • that board had a bug in the firmware
  • the open source firmware replacement replicated the functionality of this firmware without the bug
  • this board has a library to talk to it
  • the LOLIN version is called v2
  • this board does not ship with a buggy firmware
  • it DOES however have additional features not supported by the old firmware
  • this board has a DIFFERENT library to talk to it

So, using the wemos board (clone, I’m sure), the open source firmware replacement, and the wemos library I was able to make this whole setup move. And some people, for some reason, expect things to ‘just work’. In my experience, that is a myth.

This setup is much more compact, but I did have to add the voltage regulator down to 5v external of the board, so this is really 3 modules.

One Response to “Lego train v2”

  1. Lego Train build (wifi controlled) | Evan's Techie-Blog Says:

    […] there is a follow-up that shrinks the motor controller […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: