Adafruit Motor Shield 1438 on the TXT Controller

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

Adafruit Motor Shield 1438 on the TXT Controller

Beitragvon fotoopa » 12 Sep 2018, 11:40

Today I started with the setup to place the Adafruit motor shield 1438 on the TXT Controller. The motor shield is powered by 3.3V. The 3.3V of my I2C interface board I connected to the 5V on the ADA1438 module. So I didn't have to change the selection 3.3V-5V (pcb trace) on the motorshield. The 3.3v is required for the TXT Controller, 5V is not allowed without additional level shifters. Warning: Never place the motor shield simultaneously on the Arduino and the TXT given the 3.3V and 5V ! Otherwise you need to use 5V and levelshifters on the I2C on the TXT.
A picture of the test setup:

Bild
The HD version: https://www.flickr.com/photos/fotoopa_hs/42821177990

I connected the logic analyser to the 4 available pins for the servo pwm signals channel 0, 1, 14 and 15. Starting from an example of Dirk Fox I could quickly start after changing the I2C address. The results were perfect on the LA.
I now have to study the PCA9685.pdf datasheet to be able to drive the 4 motors. It doesn't look very difficult, so it must work. To control stepper motors I see more problems.
If you use an Arduino Uno R3 instead of the TXT Controller it works but the TXT Controller is much slower.

A picture of the Arduino setup:
Bild
HD version: https://www.flickr.com/photos/fotoopa_hs/29652218047

First I made the setup with the Arduino to get more familiar with the hardware and software. For me this is all new, so it may take a while before everything is ready for the TXT Controller. I'm going to try the step motor control last, now I'll first control the 4 motors or just 8 extra outputs as an extension to the TXT.
As soon as new parts are ready I post the results here.

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

Re: Adafruit Motor Shield 1438 on the TXT Controller

Beitragvon fotoopa » 14 Sep 2018, 19:54

Testing of the motor shield module ADA1438.
Everything now works from the TXT Controller for 4 motors and 4 servos. Speed and direction adjustable for all motors. The ADA1438 module contains a level converter for controlling the servos. Because the ADA1438 module works on 3V3 this level converter was needed. For this I use the level converter from ADAfruit ADA 757. I brought out the 4 servo pwm signals on the available connector. The level converter fits directly on this connector. On the board itself there was only room for 2 servos and you still had the level problems if the ADA1438 worked on 3V3.
An overview:

Bild
HD version: https://www.flickr.com/photos/fotoopa_hs/43960631944

Bild
HD version: https://www.flickr.com/photos/fotoopa_hs/44630096042

Bild
HD version: https://www.flickr.com/photos/fotoopa_hs/43769977025

I have set the PWM frequency to 50Hz. For the motors this is rather low but if you use servos they do not all work well at higher frequencies. I made 2 routines, one for the servos and one for the motors. All motors are sent in a burst. This makes the necessary time very short. If you only use motors you can drive up the frequntie. I think that they work smoother and are less audible. When you connect the motors to the 9V output of the TXT Controller I measured a lower voltage at the motor. Loaded with the motors there is only 8.30V coming out of the TXT. The motor drive module also has a voltage drop. This makes the final voltage on the motors below 8V at 100% control. It is in your best interest to control the motors directly from a good 9V power supply.
There are still some reservations about the way of working with the ADA1438 module. If you abort the program abrut in the TXT controller without a real stop command to the ADA1438 module it is possible that the motors that are running will not stop anymore. I recommend to provide a hardware emergency stop to turn off the 9V.
The I2C module should be used at least once within 5 sec, otherwise there is a bug in the TXT Controller that hangs your I2C connection. I will work with an update loop that refreshes all motors data at once every 20 msec. If you do everything in a burst that time is quite short, otherwise there may be 5 msec between each close I2C device. The burst lasts only a good 1 msec.
Soon I will upload the full program.

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

Re: Adafruit Motor Shield 1438 on the TXT Controller

Beitragvon vleeuwen » 14 Sep 2018, 20:23

It is a nice shield.

I am using the ADA-2348 its also working fine with a Raspberry Pi 3 and Windows IoT 10, very simple to program with MS-Visual Studio 2017 with his integrated development environment for Windows IoT.

The ADA-2348 I2C controlled and deal with 4 motors or 2 steppers.
Benutzeravatar
vleeuwen
 
Beiträge: 936
Registriert: 31 Okt 2010, 23:23

Re: Adafruit Motor Shield 1438 on the TXT Controller

Beitragvon fotoopa » 15 Sep 2018, 10:24

vleeuwen hat geschrieben:I am using the ADA-2348 its also working fine with a Raspberry Pi 3 and Windows IoT 10, very simple to program with MS-Visual Studio 2017 with his integrated development environment for Windows IoT.
The ADA-2348 I2C controlled and deal with 4 motors or 2 steppers.
Yes, that's the same application. On the Pi 3 you will be able to control it better because the TXT Controller is a very slow system. Especially the time between writing or reading to the I2C is slow with the TXT. There is always minimum 5 msec after each close device. If you need multiple commands, the total time is quickly quite high. You can optimize this by sending or reading as much data as possible in a burst. The update time to send all motors at once is 1.2 msec. If you send all data in one burst then you only need that 1.2 msec with a max delay of 5 msec reaction time. This slow operation mainly affects the reaction time to stop an motor as fast as possible. If you have to update the 4 motors separately, an extra delay of 5 msec will occur between each motor. I prefer to use an FPGA module. These are up to 10,000 times faster and everything runs parallel. Mutual tasks have no influence on the timing of the other tasks.

The TXT Controller has mainly advantages to the PC interface. You have a nice layout, large screen and very high resolution. That's why I rarely use the small screen of the Controller itself. Once you are 75 years old you need very strong glasses to read something on those small screens. For standalone applications, however, it is useful. Then they are still powered by battery and should not take up much space.

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

Re: Adafruit Motor Shield 1438 on the TXT Controller

Beitragvon fotoopa » 21 Sep 2018, 11:43

The ADA 1438 motorshield with servo and motor control works. I made a control interface for the TXT to finish the tests. First a drawing how the ADA1438 module is connected to the TXT:

Bild
HD version: https://www.flickr.com/photos/fotoopa_hs/30947233868

Because the TXT has a 3V3 level on the I2C module I made the entire ADA1438 board working on 3V3. The 3V3 has to be done by yourself since the TXT has no output power for this. I connect the 3V3 to the 5V pin of the ADA1438. So I should not change the preset 5V - 3V3 selector on the ADA1438. You may not connect the motorshield to an Arduino at the same time! For the servo connections I use the 4 pole expansion connector. Because those levels are now 3V3 of the I2C chip, a level shifter has to be used to get to the servos. The servos must have a separate power supply for the 5V and you must also connect it to the high-level side of the level shifter. The original connection for 2 servos on the ADA1438 is not used here. With the other expansion connector we have 4 servos!
Now an example of the program:

Bild
HD version: https://www.flickr.com/photos/fotoopa_hs/30947234038

Bild
HD version: https://www.flickr.com/photos/fotoopa_hs/30947233408

Bild
HD version: https://www.flickr.com/photos/fotoopa_hs/43007645460

The user interface on the PC:

Bild
HD version: https://www.flickr.com/photos/fotoopa_hs/43007645860

I also measured the optimal speed update to control the motors and servos. The TXT is not very fast and between every I2C close device is at least 1 to 5 msec. It is best to use all 4 motors in an I2C burst access. So there are no waiting times between them. For these 4 motors you have to count on a burst of 1.2 msec. If you control the 4 motors separately, there would be a waiting time of the TXT each time.
There is also a speed difference between On-line and Off-line mode on the TXT. On-line you get about 300 update/sec, Off-line this is double with 600 updates/sec.
I have a Logic Analyser recording of it:

Bild
HD version: https://www.flickr.com/photos/fotoopa_hs/43007645630

This speed limit is especially important if you would use step motors. On-line you could make max 300 steps/sec, Off-line that would be 600. If you use 200 steps motors this will be 90 rpm or 180 rpm. That would be a relatively low speed so micro stepping would be of little use because you would work even slower proportionally. Also the PWM frequency can be a problem if you want to use servo and step motors at the same time. For stepping motors I don't see here a real good application unless you would use really low speed. I will upload the TXT program in a while. Within a few days it would be available on the site.

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

Re: Adafruit Motor Shield 1438 on the TXT Controller

Beitragvon Bjoern » 21 Sep 2018, 12:56

Great work and documentation as always Frans

Regarding the problem with the different voltage levels we created the community project ft-Extender. Here you easily connect other I2C clients to a TXT or TX and the ft-Extender provides the voltage for the sensor (max 800mA) and includes a level shifter for the I2C. So no problem if you have a 3,3V or 5V sensor connected.

Björn
Bjoern
 
Beiträge: 84
Registriert: 04 Jan 2018, 13:34

Re: Adafruit Motor Shield 1438 on the TXT Controller

Beitragvon fotoopa » 21 Sep 2018, 13:17

Bjoern hat geschrieben:Regarding the problem with the different voltage levels we created the community project ft-Extender. Here you easily connect other I2C clients to a TXT or TX and the ft-Extender provides the voltage for the sensor (max 800mA) and includes a level shifter for the I2C. So no problem if you have a 3,3V or 5V sensor connected.

Yes correct. In that case you have the choice to leave the ADA1438 on 5V without any problems. The level shifter on the ft-Extender is then directly your I2C buffer. I would recommend interrupting the 5V to the servo connector, which is indicated on the ADA1438. Then you are limited to 2 servos. If you want them all 4 then you need to connect to the 4 extra pins of the ADA1438 (pwm0,pwm1,pwm14 and pwm14) and provide your own 5V for the servos. Still I would separate the servo 5V and the shield 5V. Servos can draw quite high starting currents.
So yes the ft-Extender is also a great tool!

Frans.
fotoopa
 
Beiträge: 114
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 3 Gäste