Using lego devices with the TXT.
Why would you do this? FT has nice motors and devices too, right?
Ah, yes but unfortunately FT does not have a 9V motor with built-in quadrature encoder. They do have an encoder motor with 1 pulse signal. Their PCB did foresee to put 2 hall decoder on it but apparently they wanted to save money. So we cannot make a real quadrature decoder anymore. With 1 signal line you are never 100% sure on correct pulse count and direction of the motor.
Lego does have a quadrature decoder built in and it is also absolute. But they also have another 32bit counter built in. So the absolute position and the relative 32bit counter are available at any time. The motor is not even more expensive either.
It is so far, all my Lego devices are now controlled by my Cyclone10 LP FPGA. All 8 Port inputs work with auto detection of the Lego device. All data can be read out and is available for the TXT controller. Through the TXT software I can now read out and control all the device.
This project is still in full development. Almost all available IO pins have been used. With the remote control of an old DVD player I still have 40 keys available. This is how I select the 4 pages of the LCD 4x20 char display.
Fischertechnik + Lego + FPGA by Frans, on Flickr
The Lego motors have a built-in absolute encoder and also a 32bit relative position counter built in. One revolution of the motor corresponds to 360 pulses. These motors in particular have many advantages over the Fischertechnik motors. FT has no built-in counter and the encoder is only 1 channel so true quadrature decoding with an FT motor is not possible. Lego is an excellent replacement for this.
The TXT may also control power pins 1 and 2. The position is available via I2C. With the PC you can control up to 4 motors with the TXT software.
However, if you want to control up to 8 motors with the FPGA then it is also possible. Then the TXT motor outputs are not connected but the power pins are controlled with the TB6612 modules. Thus, the TXT remains fully available for the normal FT modules. The nice thing is that all readout can now be done on the PC. At the same time, results can be displayed on the LCD screen. All decoded device IDs are on page1 of the LCD display and you can see which Lego device is active.
I am now going to make extension cables for the Lego devices. This can be done with twisted pair cable of 3x2x0.14 or 4x2x0.14 With twisted pair you can maintain better signal transmission for the 2 serial lines. If you use 4x2x0.14 then you have more diameter for the power pins of the motors. These cables are quite thin and flexible making them very movable.
To accomplish this, I had to study the Lego protocol. I also gained a lot of info through Pybricks. Thanks to Pybricks software (Python and blocks) I was able to make a lot of measurements. I use also a Picoscope 3206D MSO 200Mhz with 16 channels logic analyzer. Thanks to this scope, you can make very deep analyses. The project is not yet finished; there is still much room for optimization. This project allows me to reuse my old TXT controller.
Frans.
Why would you do this? FT has nice motors and devices too, right?
Ah, yes but unfortunately FT does not have a 9V motor with built-in quadrature encoder. They do have an encoder motor with 1 pulse signal. Their PCB did foresee to put 2 hall decoder on it but apparently they wanted to save money. So we cannot make a real quadrature decoder anymore. With 1 signal line you are never 100% sure on correct pulse count and direction of the motor.
Lego does have a quadrature decoder built in and it is also absolute. But they also have another 32bit counter built in. So the absolute position and the relative 32bit counter are available at any time. The motor is not even more expensive either.
It is so far, all my Lego devices are now controlled by my Cyclone10 LP FPGA. All 8 Port inputs work with auto detection of the Lego device. All data can be read out and is available for the TXT controller. Through the TXT software I can now read out and control all the device.
This project is still in full development. Almost all available IO pins have been used. With the remote control of an old DVD player I still have 40 keys available. This is how I select the 4 pages of the LCD 4x20 char display.

The Lego motors have a built-in absolute encoder and also a 32bit relative position counter built in. One revolution of the motor corresponds to 360 pulses. These motors in particular have many advantages over the Fischertechnik motors. FT has no built-in counter and the encoder is only 1 channel so true quadrature decoding with an FT motor is not possible. Lego is an excellent replacement for this.
The TXT may also control power pins 1 and 2. The position is available via I2C. With the PC you can control up to 4 motors with the TXT software.
However, if you want to control up to 8 motors with the FPGA then it is also possible. Then the TXT motor outputs are not connected but the power pins are controlled with the TB6612 modules. Thus, the TXT remains fully available for the normal FT modules. The nice thing is that all readout can now be done on the PC. At the same time, results can be displayed on the LCD screen. All decoded device IDs are on page1 of the LCD display and you can see which Lego device is active.
I am now going to make extension cables for the Lego devices. This can be done with twisted pair cable of 3x2x0.14 or 4x2x0.14 With twisted pair you can maintain better signal transmission for the 2 serial lines. If you use 4x2x0.14 then you have more diameter for the power pins of the motors. These cables are quite thin and flexible making them very movable.
To accomplish this, I had to study the Lego protocol. I also gained a lot of info through Pybricks. Thanks to Pybricks software (Python and blocks) I was able to make a lot of measurements. I use also a Picoscope 3206D MSO 200Mhz with 16 channels logic analyzer. Thanks to this scope, you can make very deep analyses. The project is not yet finished; there is still much room for optimization. This project allows me to reuse my old TXT controller.
Frans.
Statistik: Verfasst von fotoopa — 23 Apr 2024, 11:12