TXT Controller and I2C speed

Alles rund um COMPUTING inkl. Microcontroller & Co.
Everything about COMPUTING incl. Microcontrollers
Forumsregeln
Bitte beachte die Forumsregeln!

TXT Controller and I2C speed

Beitragvon fotoopa » 09 Mai 2018, 16:04

I have done many tests again with the I2C bus to connect the TXT to my own hardware. What your hardware is doesn't matter, may be an existing microprocessor module or your own preference for hardware. The TXT is independent of this. My projects are always with a permanent power supply I don't use the TXT display because it is far too small. I'm 75 years old and my eyes can't see those small pixels anymore. That's why I always use a UDH screen. The connection of the PC and the TXT can be done with both USB and wlan at your choice. As hardware I use my FPGA controller which was designed for the ball track. Now I'm going to use it further for new projects.

Now the speed test of the TXT Controller via I2C readout.
All results are displayed on the PC monitor. Images are optimal for a UHD screen 3940x2160 pixels. 32 bytes of data are read out. If you leave the device open, all 32 bytes will be read without interruption. The total time for this is 770 usec. The test program has been written to investigate how fast new data can be read from the I2C bus. At the same time, all results are displayed on the screen. The TXT controller must convert all values to the display format and display them.

As a test I use:
16 FT Motors with speed setting, direction and enable visualization. 4 of these motors have an encoder counter whose value is displayed on the screen (is not a restriction and can be further expanded). The speed is adjustable between 0 and 100 for each motor. This speed is also shown on the display. There is provision for 16 servo motors (32 are available in the hardware) in which the position status is read out, left or right. This is also displayed on the screen. Finally, there are 16 inputs that are also displayed (they may be extended to any number).

Note that you can also switch between 8 and 16 bit data with an open device. If the slave is able to answer this number correctly, everything will be processed as a series without waiting loops. This greatly increases the transfer speed of the 32 bytes. The test indicates that there are 438 burst reads per second. The PC display shows the correct results during the tests.
A few pictures:
Bild
Flickr link: https://www.flickr.com/photos/fotoopa_hs/41950724482

The timing of an optimal burst read:
Bild
Flickr link: https://www.flickr.com/photos/fotoopa_hs/28123464158

Test program:
Bild
Flickr link: https://www.flickr.com/photos/fotoopa_hs/28123465048

Bild
Flickr : https://www.flickr.com/photos/fotoopa_hs/41994869511

If you want to work with a closed devive now, there will always be an interval between reading the separate data. This makes the reading speed considerably slower. We now obtain an average of 28 refresch cycles instead of 438 / sec. You see the hardware of the I2C device determines your result.
Here are the two results:
Bild
Flickr : https://www.flickr.com/photos/fotoopa_hs/41994869821

The I2C slave driver I wrote for my FPGA can process both single and multiple bytes without additional clock delays. It automatically detects if the TXT wants more data at once. It also supports 8 and 16 bits. That's why 32 bytes of read with a mixed data length of 8 and 16 bits takes only 770 usec ( (32 byte data + 2x address) * 9 bit = 765 usec @ 400 KHz) with an open I2C device except the last access.

The display is updated less quickly than reading the I2C. Nevertheless, this is going quite fast. I tested the 4 encoder counters which increases 15 counts/sec and this ensures a smooth reading on the PC. However, I do not yet know very well how to have proper control over this.

Frans.
fotoopa
 
Beiträge: 49
Registriert: 05 Okt 2017, 11:44
Wohnort: Belgie
Alter: 75

Re: TXT Controller and I2C speed

Beitragvon steffalk » 13 Mai 2018, 11:25

Hello fotoopa,

what a fine analysis you have done! Wouldn't you like to describe that in more detail in an ft:pedia issue?

Best Regards,
Stefan
Benutzeravatar
steffalk
ft:pedia-Herausgeber
 
Beiträge: 901
Registriert: 01 Nov 2010, 17:41
Wohnort: Karlsruhe

Re: TXT Controller and I2C speed

Beitragvon fotoopa » 13 Mai 2018, 19:03

steffalk hat geschrieben:what a fine analysis you have done! Wouldn't you like to describe that in more detail in an ft:pedia issue?

Dear Steffalk,
I am not such a good writer. I would, however, like to communicate new tests and programmes on a regular basis. I am currently working on an I2C version with the Robo TX. All basic basic functions are in the own hardware via I2C. These are functions such as moving the motor xx to pos xx. Or move the motor xx to the zero point. I added a rotary encoder to the robot on the X, Y and Z axes. The original encoder motors are dummy encoders, they do not even have a direction detection, only pulses. They then try to correct this by means of software. In the longer term, this is totally incorrect. A Rotary encoder should never miss a single impulse, even if you're working a full day without going again to the zero-point for calibration. The encoders I use are low-cost mechanical versions with 96 pulses per revolution and are simply mounted on the end of each axis.
See: http://www.electroshopdendermonde.be/in ... rot-potdi/

I can already send commands to my own hardware via the I2C of the TXT controller. Also reading the motor position works perfectly. I am now working on a small project in which an 8x8 matrix. There are 64 holes where a steel ball can be inserted by the robot. As input of the matrix you can enter a certain letter. The robot will then apply the dots, "Steel balls" itself. If you want to form a different letter, the robot will look at the difference in the necessary dots. Dots that are not used can then be taken to the new necessary dots or back to the stock box. I still have to find an optimal algorithm to make the shortest movements for the new letter.
I have also added a mini reflection sensor. At the powerup or a restart, the robot does not know where there are balls in the dots. He first makes a scan and when he finds a "Steel ball he takes it out first. In this way he can start from an empty maxtrix.
Instead of forming letters, I also provide an input for making a creative drawing myself. After a start command, the robot then has to copy the drawing using the steel balls. Such a program must work through a large PC screen. That's why I always use my 32 inch UHD monitor 3940x2160 pixels.

The matrix is drilled the next few days. Then I can start with the real tests. So more on this later.

Frans.
fotoopa
 
Beiträge: 49
Registriert: 05 Okt 2017, 11:44
Wohnort: Belgie
Alter: 75

Re: TXT Controller and I2C speed

Beitragvon fotoopa » 16 Mai 2018, 15:24

The mechanical update of the robo TX unit has been accomplished. This setup will be further used for different speed tests of the TXT Controller. The 3-axis counters are supported in the external hardware. On the TXT controller, only the I2C connection is used for the hardware. The software for the TXT Controller is now being rewritten. The whole thing must work online with the PC and the UHD screen. This way I have a good overview with very high resolution and I can use the mouse of the PC to control everything. Here are some pictures of the new setup of the robot:

Bild
Flickr link: https://www.flickr.com/photos/fotoopa_hs/40325159240
Bild

Bild
Flickr link: https://www.flickr.com/photos/fotoopa_hs/40325157980


Flickr link: https://www.flickr.com/photos/fotoopa_hs/42085895652

Bild
Flickr link: https://www.flickr.com/photos/fotoopa_hs/42085894392

Notice how I carried out the new wiring of the motors, switches and detector. I use flexible twisted wire from a thick cable of 16x2 wires for this purpose. So you can process all the wires in a flexible string. Note that I have replaced the original fork system with a magnetic holder. This way I can pick up the steel balls of 12.7mm and place them in a matrix with 8x8 holes. By inserting the steel balls into the matrix, you can create different figures. The sensor located next to the magnetic head is used to scan the matrix during powerup. After an emergency stop or powerup, you will otherwise no longer know where steel balls are already in the matrix. This still requires a lot of software for the TXT Controller. The external hardware only executes the basic commands for the motors and processes the encoders and switches signals. I am now going to write a small program to operate the motors from the PC. The motors can already be controlled manually from the external hardware. Via the TXT controller, the X, Y and Z positions of the motors are already displayed on the PC.

The encoders, end switches and detector are brought together in a small black box. This can be seen in the first picture. This input box with 24 inputs is connected to the external hardware via SPI (@500KHz). The reflection sensor is refreshed every 4 msec.

Small update:
The encoders have 96 pulses per revolution. The worm has a module of 1.5mm. 1 tour has 1.5x3.14mm = 4.71mm. 1 pulse on the decoder : 4.71/96 = 0.05mm. 1 FT raster = 15mm or 305.6 pulses --> 306 pulse on the encoder!. I am going to make a matrix with a grid of 16x16mm or 326 pulses per grid. This gives me an enormous good resolution even if the motor runs through some pulses. Errors are not cumulative. The encoders always maintain the correct position even when you rotate the shaft manually. The grid positions are 326 ... 652 ... 978 ... 1304 etc. Both horizontal and vertical. For the time being I see a maximum difference of 4 pulses when stopping the motor on the X axis. On the other axes this is only 1 pulse because the speed is slower. I do not therefore need to correct this error.


New speed data will follow later.
Frans.
fotoopa
 
Beiträge: 49
Registriert: 05 Okt 2017, 11:44
Wohnort: Belgie
Alter: 75

Re: TXT Controller and I2C speed

Beitragvon fotoopa » 18 Mai 2018, 20:16

Update of the original ROBO TX robot, now controlled by external hardware and software on the TXT Controller. The 3 motors, X, Y and Z axes already work manually. You can move the axes with mouse click on the PC screen. The external hardware is connected over an I2C bus. The basic functions are performed on the external hardware. The executive program is on the TXT Controller.

The robot must control a matrix wall with 64 holes. The pattern for filling is taken from a charactor rom. On the PC screen you can select the desired character. The character rom is located in the external hardware. Several types of rom can be mounted. Several drawings can be stored in this way. The external hardware transmits the pattern to the TXT controller via the I2C bus. This is 8 bytes, or 64 bits for a complete pattern. When all the steel balls have been placed in a wall by the robot, you get the same figure as on the screen. For the automatic placement, further software is currently being written on the TXT Controller. New Rotary encoders ensure a very accurate position of all axes. 1 pulse at the encoder corresponds to 0.05mm or 20 pulses/mm for the axis displacement. There are no cumulative errors because the encoders also contain the direction and always count correctly even if you manually rotate the axis.

The TXT Controller is very easy to program.
Screen dump van the running TXT software:

Bild

Link to the HD version: https://www.flickr.com/photos/fotoopa_hs/27323125217
More information about the program and a short video will follow later. First I have to drill the wall which has 64 holes.

Frans.
fotoopa
 
Beiträge: 49
Registriert: 05 Okt 2017, 11:44
Wohnort: Belgie
Alter: 75

Re: TXT Controller and I2C speed

Beitragvon fotoopa » 25 Mai 2018, 19:14

The software for the robot is ready for testing. Here you see a screen dump of the run mode.

Bild

Link to the HD picture: https://www.flickr.com/photos/fotoopa_hs/28473719448

According to the lightening dots, steel balls are placed in a wall matrix by the robot. Information during positioning can be followed on the screen. The encorders are read out in real time and placed on the screen. Motion directions are also displayed. A counter has been added to indicate how many refresch bursts occur per second of the I2C connection. This varies around 200. This indicates that the TXT Controller is very fast to readout in realtime the data information ( burst of 24 byte ) .

Here the program works in run mode. The steel balls are brought from the input to the wall according to a selected pattern. During run mode you can see which dot is processed, indicated by the blue horizontal and vertical points in the matrix. This will become even clearer later on on a video. The status of the end switches of the 3 axes is also visible in real time.

The pattern used here is the character 58 from the character rom. This value can also be followed on the PC screen. At the beginning of next week I can drill the holes for the wall. There will be 2 more sensors placed to see if there is a steel ball on the robot arm.

I'm very surprised how fast the TXT Controller can process the data. Of the original TXT controller I only use the I2C connection. The external hardware only has very basic commands to process. Orders such as position the axis, gives the status of the end schwith, and read out the encoder position. All other data is processed by the TXT Controller program. A lot of screen LEDs are used. The matrix itself already contains 64+16 LEDs. Extremely beautiful on a UHD screen! Also the operation with a simple mouse click is super comfortable. I will also make the entire program available, but you really have to support the necessary external functions to work online. Still, you can already investigate well how I wrote the program. The file size of the .rpp is now about 2 Mbyte.
So, within a short time more information will follow.

Frans.
fotoopa
 
Beiträge: 49
Registriert: 05 Okt 2017, 11:44
Wohnort: Belgie
Alter: 75


Zurück zu Robo Pro / Computing / Software

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast