Using lego devices with the TXT

Fussballroboter, Autofabrik...
Modellideas &- presentation - Soccerrobot, Carfactory...
Forumsregeln
Bitte beachte die Forumsregeln!
Antworten
fotoopa
Beiträge: 314
Registriert: 05 Okt 2017, 11:44
Wohnort: Belgie
Kontaktdaten:

Using lego devices with the TXT

Beitrag von fotoopa » 23 Apr 2024, 11:12

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.

BildFischertechnik + 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.

kräml
Beiträge: 275
Registriert: 14 Aug 2020, 06:47

Re: Using lego devices with the TXT

Beitrag von kräml » 23 Apr 2024, 11:27

Wow, great project. Just the way I like it. FPGA as a mediator between the worlds, here FT with Lego. Great! I'm currently working on the MAX1000. But I hadn't thought of this idea yet. Thanks for the information.

Kraeml

fotoopa
Beiträge: 314
Registriert: 05 Okt 2017, 11:44
Wohnort: Belgie
Kontaktdaten:

Re: Using lego devices with the TXT

Beitrag von fotoopa » 23 Apr 2024, 13:07

It doesn't matter so much which board you take. As soon as you have enough IO pins, a PLL and minimum 20K LE you will be fine. I use verilog code, you can use it like that from one board to another. Just redefine the IO in the list.

Here are the Quartus compiler output data:
Flow StatusSuccessful - Mon Apr 22 19:56:14 2024
Quartus Prime Version22.1std.2 Build 922 07/20/2023 SC Lite Edition
Revision Namecycl10_lcd
Top-level Entity Namecycl10_lcd
FamilyCyclone 10 LP
Device10CL025YU256I7G
Timing Models Final
Total logic elements 11,163 / 24,624 ( 45 % )
Total registers 6182
Total pins 134 / 151 ( 89 % )
Total virtual pins 0
Total memory bits 1,152 / 608,256 ( < 1 % )
Embedded Multiplier 9-bit elements0 / 132 ( 0 % )
Total PLLs 1 / 4 ( 25 % )

As you can see, there is still plenty of room to program additional functions. Now the chip is 45% full.

I have a whole range of FPGA boards. One slightly more expensive than the Cyclone10 LP is the older DE0-nano. That one has a huge number of IO pins. There is plenty of choice.
Frans.

vleeuwen
Beiträge: 1570
Registriert: 31 Okt 2010, 22:23
Wohnort: Enschede (NL)
Kontaktdaten:

Re: Using lego devices with the TXT

Beitrag von vleeuwen » 23 Apr 2024, 13:32

The lack of a rotary (quadrature) decoder functionality on the TXT4.0 (and the TXT and TX-C) is a loss.
The Incremental decoder sometimes causes problems in various applications if there is loopback.
However, if the mechanical transmission is blocking, for example with a worm transmission, an incremental encoder in combination with software direction processing is sufficient for 100%.
A good rotary encoder is quite expensive. The 200 p/r quadrature encoder from Sparkfun with a 4mm shaft can be used in combination with fischertechnik. This in combination with an I2C based decoder.

See also: https://www.sparkfun.com/products/10932
https://hades.mech.northwestern.edu/ind ... re_Counter
https://www.globalspec.com/industrial-d ... nter_chips
https://hades.mech.northwestern.edu/ind ... re_Counter

Microchip hardware decoder function on the dsPIC33F serie, PIC32 serie, dsPIC33/PIC24 serie (Quadrature Encoder Interface (QEI))
https://ww1.microchip.com/downloads/en/ ... 70208A.pdf
https://ww1.microchip.com/downloads/en/ ... 01346A.pdf
https://ww1.microchip.com/downloads/en/ ... 00601c.pdf
software enigineer/teacher/advisor
Google translate
http://tescaweb.nl/Carel/?p=713

Antworten