3

I'm doing a project for my kiddos.

I'm trying to find the schematics of a lego train motor 88011, I want to control them using an ESP32 through a telegram bot.

I have the ESP32 and the telegram bot working to power up or power down a led (like in this page but with some modified parts for the telegram bot https://randomnerdtutorials.com/esp32-pwm-arduino-ide/)

I was trying to understand the wiring on the lego motor, but only found some videos on 4 wired connections, these have six.

I also have no idea of what voltage these motors are, attached my hardware.enter image description here

2

2 Answers 2

5

You will need extra hardware to drive the motor since is uses high current. You won't be able to directly connect it to your ESP32 and make it move.

The LEGO hubs use a LB1836 motor driver chip (see this answer for a photo and link to data sheet). So you will need to find a breakout board with a motor driver with similar specs (example) or make your own PCB and use the same chip as LEGO.

The PWM output of the ESP32 will connect to the motor driver chip. You will need two PWM outputs to make the motor go both forwards and backwards. The motor driver chip will need to be connected to a 6-9V battery (7.2V LiPO, 6 AA, etc.). And the output of the motor driver will need to be connected to pins 1 and 2 of the motor.

1
  • Thank you both for your answers, David and @jncraton, I was trying to build a H-bridge with 4 npn2222 transistors, but I couldn't get the motor to run, then I found a LM298N lying around and did the wiring exactly like this (used some other pins), and with the code in there, the motor is running. I am only using the first two cables (M1 and M2). I am using an old power source which is giving me almost 13 V, and feeding the 5V to the L298N.
    – Eduardo
    Apr 20 at 0:06
2

There is still a simple analog connection for these motors in the Powered Up system. The wiring is similar to the older PF system in that way, except that there are now 2 dedicated signaling lines. Here's the pinout from Philo:

Powered Up connector pinout

Pin Label Function
1 M1 Motor power lead 1 (PWM controlled)
2 M2 Motor power lead 2 (PWM controlled)
3 GND Ground (0V)
4 VCC Power for device electronics (3.3V)
5 ID1 Identification line 1 / Serial data (hub -> device)
6 ID2 Identification line 2 / Serial data (device -> hub)

You should be able to drive the motor by applying pure DC voltage to the M1 and M2 pins. You can control speed using any of the common approaches to controlling DC motor speed.

In terms of voltage, anything up to 9V should be safe.

4
  • Technically speaking, the GPIOs connected to pins 5 and 6 cannot be configured as analog inputs on the MCU. There are two gpios connected to each pin. The detection algorithm uses these in a serial of tests to detect one of 4 states for each pin. The detected states are A) directly connected to VCC, B) directly connected to GND, C) connected to GND through a resistor and D) not connected to anything. This is all done using digital inputs, not analog. Source code: github.com/pybricks/pybricks-micropython/blob/… Apr 17 at 15:38
  • @DavidLechner That makes sense. I appreciate you sharing the source code for that. I took the analog language there to mean that the device can identify itself using only passive analog components without the need for any sort of digital logic. This makes basic analog devices like the train motor more cost effective, as they don't need to include a microcontroller. You are right that these are digital pins on the device.
    – jncraton
    Apr 17 at 16:43
  • I think the analog language is a carryover from EV3 which did use analog inputs to identify connected devices. The first person to see that some of the Powered Up devices had a 2.2K resistor assumed (incorrectly) that since there was a resistor, that analog must still be involved and this info has been repeated ever since. But I suppose using the terminology somewhat inaccurately is more polite than calling I/O devices "smart" (meaning the device contains a microcontroller and uses UART) or "dumb" (meaning the device does not contain a microcontroller and pins 5/6 are for identification only). Apr 17 at 16:57
  • @DavidLechner That makes sense. I've removed the analog language to avoid any possible confusion about these actually being analog pins on the device.
    – jncraton
    Apr 17 at 18:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.