Design stepper module for TXT Controller I2C

Vorstellung von 3D-Druck-Teilen, Fragen zu 3D-Druckern, usw.
Discussion of 3D printed parts, Questions and answers on 3D printers and printing, etc.

Moderator: Jan3D

Forumsregeln
Bitte beachte die Forumsregeln!
Antworten
fotoopa
Beiträge: 312
Registriert: 05 Okt 2017, 11:44
Wohnort: Belgie
Kontaktdaten:

Design stepper module for TXT Controller I2C

Beitrag von fotoopa » 08 Mai 2019, 17:43

Design for a stepper motor drive.
The stepper motor drive uses the TMC2100 modules from an old 3D printer (FlashForge Finder). I got this gift from a Fischertechnik forum member. The modules are controlled via a spi connection with my FPGA controller. The FPGA is connected to the Fischertechniek TXT Controller via an I2C line. The TMC2100 modules are in a fixed mode of the 3D printer, there is micro stepping used with 16 fine steps per step. Through the SPI connection I can send the ena, DIR, STEP, CFG0 and CFG4 pin. Because the modules are configured in 16 microsteps, the step pulses can be provided quite quickly. Therefore I controlled the SPI driver from a 4MHz clock so that only 13.5 usec is needed to scan all 24 inputs and outputs. This is much faster than the max step speed needed for the stepper.


The SPI goes to the FPGA chip. This is now programmed as a large I2C chip for the user. Besides this stepper driver there are also modules written for 16 motors, 72 inputs, 36 outputs, and 32 servo motors. All inputs can handle fairly fast pulses especially for quadrature encoders. The motors can run in 5 different modes and operate autonomously. The external I2C user only needs to send a few commands. Timing is no problem at all because the FPGA works much faster than the fastest micro controller. There are almost 1000 bytes of registers provided to support all functions. On the Fischertechnik side I have written a full lib to support all these functions. Through the Robopro software you can now write a program in a few minutes to the motors, servo steppers controls, reads inputs, status reads output line controls. I will give you more information about this later, but this data is so extensive that writing the manual takes a lot of time.

Pictures avaible at Flickr: https://www.flickr.com/photos/fotoopa_hs

A few details here:
Bild
link original: https://www.flickr.com/photos/fotoopa_hs/32860704417

Bild
link original: https://www.flickr.com/photos/fotoopa_hs/33927219378

Bild
link original: https://www.flickr.com/photos/fotoopa_hs/47014927034

Bild
link original: https://www.flickr.com/photos/fotoopa_hs/33927219258

youtube video: http://youtu.be/0HRdaIm48Q0

More information about my FPGA as a large I2C chip will follow later in a separate topic.
Everything has been tested, all libs for the Robopro TXT Controller are written. Only the complete doc needs to be made up. The principle is that you put a separate (micro)controller on your TXT via the I2C and that all functions are in the Microcontroller. No more software needs to be adapted for this. The microcontroller no longer needs to be reprogrammed. For users who do not use software C or other languages, you can do everything with the Robopro software. You only have to write your program on the TXT. This is very fast and also the execution is very fast because all motors, servo, steppers are controlled realtime completely autonomously outside the TXT.

Frans.

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

Re: Design stepper module for TXT Controller I2C

Beitrag von vleeuwen » 22 Mai 2019, 23:20

Nice done.
With the new SLI option in the TXT firmware (>4.4.3.0) your are even able to write extensions for RoboPro and upload them to the TXT.
These extension are able to write the I2C communication in C/C++ and hide these low-level stuff for the end RoboPro user.
I 'am busy with a similar project.

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

Re: Design stepper module for TXT Controller I2C

Beitrag von fotoopa » 24 Mai 2019, 10:04

Thanks!
I'm already running the latest version 4.4.4 here. I had to take out all the Robopro software (Windwos 7) and install the new version otherwise I had problems with the USB connection with the TXT Controller. Now everything is working correctly.
The C/C++ is not an advantage for me personally because I don't know it enough and I still write everything via the FPGA in verilog. But the principle is similar, almost all functions now run in the FPGA while the configuration and user interface run on the PC with the RoboPro program. Since I have written all the libraries for it, you can create multiple programs very quickly.

Great advantage is the very high speed in the FPGA where most reaction times are only 1 us. Even time measurements can be made up to 50 nsec. I am now also working out the routines to make high speed fotografie water figures with falling drops of liquid. The start is obtained from an IR beam that is interrupted. Camera and lighting can thus be perfectly controlled. Parameters are still set on the PC with RoboPro user interface.

Another application is stacking photography. I just ordered a new lens to be placed on my NiKon SE microscope stand. The stepper motor can rotate the vertical displacement of the 2 um button. It will easily get 1 um resolution. Again, the stepper, camera and lighting are controlled via RoboPro software to the I2C chip of the FPGA. Today I ordered a series of parts to further upgrade the FPGA module. Especially high speed inputs and outputs up to 20 MHz, 12 bit analog inputs are now provided on the side panel of the FPGA module. Yes, there is still a lot of work to be done, also some PCB prints have to be made. And then I have to finish the documentation or you'll get confused about the many possibilities.

I'll post some results later.
Frans.

juh
Beiträge: 903
Registriert: 23 Jan 2012, 13:48

Re: Design stepper module for TXT Controller I2C

Beitrag von juh » 04 Jun 2019, 19:15

Hi Frans,

once again a pretty impressive project! And it's good to see the Printbuchse put to good use.

At first I thought that sending each microstep over an SPI line could result in a bottleneck, yet with an FPGA as sender it seems to be no problem at all. Once again, I decide to look into FPGAs in the future, the problem is that there are always so much more project ideas than time... :cry:

Cheers
Jan

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

Re: Design stepper module for TXT Controller I2C

Beitrag von fotoopa » 05 Jun 2019, 09:16

juh hat geschrieben:Hi Frans,
once again a pretty impressive project! And it's good to see the Printbuchse put to good use.
I have another "printbuhse" in design to connect the measuring pins of the LA at the same time. I'm going to add these to the new connections. This makes it easier to measure certain signals in real time. Once you've completely finished, you'll see them here too.
juh hat geschrieben: At first I thought that sending each microstep over an SPI line could result in a bottleneck, yet with an FPGA as sender it seems to be no problem at all. Once again, I decide to look into FPGAs in the future, the problem is that there are always so much more project ideas than time... :cry:
The SPI line can work much faster if needed, especially if the chips are close to the FPGA. In the current version the SPI wires are 2.5 m long. At this length it is better to limit the speed to 2 MHz SPI CLK. The Step and Dir signals have a minimum pulse width of 13.5 usec. Even with micro stepping you don't need these short times. Now I use 3 chips 74HCT595. If you only need Dir and Step you could drive 12 stepper motors at full speed. The load for the FPGA is the same for 1 or more motors at the same time. All other functions still run simultaneously, such as servos, dc motors, inputs, outputs, adc converters and the I2C with the TXT-Controller.

I just received my components for the extension of my hardware box. On the side I need a new panel with new functions. There will be 7 high-speed inputs and 8 high-speed outputs. These can be processed with a 20 or 50 MHz clock. The max delay is then 40 nsec between input and output processing. Some of these high-speed inputs I will use for measurements with IR laser beam. The time measurement between input and output is then in steps of 20 nsec. The length of the counters in an FPGA is not critical, any length is possible, and that can be very long. It's just a matter of determining the length of a register.

I received my microscope lens yesterday. Immediately tested and with success. It is worth converting my Nikon microscope with a stepper motor. The exposure I will make with 4 high-power LEDs Cree CMA2550 leds above and 1 LED at the bottom. All this is sent to the FPGA via the TXT-Controller and the I2C bus. This allows me to control all parameters for the stepper and exposure, but also for the control of the Nikon D7100 camera from the PC. The software also works with Control-My-Nikon for simultaneous live images on my 2nd PC screen. This way I can adjust the focus point for the D7100 Camera via the stepper motor. Also the exposure can be adjusted in this way. A lot of 3D print design is needed. I've already started with that. Some parts still need to be ordered (power-leds, Fets, 48V Dc power module etc). All this still takes a lot of design time. Many Microscope images are stacking into one perfect image. Normally the number of images for the Plan 4X lens is between 50 and 100. That's why the stepper is needed to make the recording cycle run automatically. Every 2.5 sec an image can be taken. The images are sent directly via USB to the PC.

The TXT-Controller has the main task to support the PC with the application via the I2C. Writing the application on it becomes relatively easy.

Frans.

Antworten