Arduino Mega Controller für/for fischertechnik

Alles rund um TX(T) und RoboPro, mit ft-Hard- und Software
Computing using original ft hard- and software
Forumsregeln
Bitte beachte die Forumsregeln!
Antworten
Benutzeravatar
rubem
Beiträge: 240
Registriert: 10 Feb 2014, 17:45
Wohnort: Porto Alegre, RS, Brasil

Arduino Mega Controller für/for fischertechnik

Beitrag von rubem » 03 Mai 2023, 22:38

(Deutsche Übersetzung im nächsten Post)

Hi everyone,

I'm building my own controller for a complex project and I thought it would be best to create a new thread.

mega-shield-ft.jpg
mega-shield-ft.jpg (1.22 MiB) 5250 mal betrachtet

It is an Arduino Mega clone with a prototype shield on top. The shield received a DFPlayer Mini MP3 module plus 3 dual DRV8833 motor drivers, so this controller has sound and can fully control up to 6 motors with PWM. There are also provision for several I²C devices, analog inputs, digital I/O pins for motor encoders, switches and more. The "mini-shield" on top of it has a 9V input and ft sockets to facilitate the connections to the motors.

Tests are going well, everything is working as expected. Some header pins are still missing, I'll take more photos later.

Here is the project layout:

Mega 2560 for ft@2x.png
Mega 2560 for ft@2x.png (465.37 KiB) 5250 mal betrachtet

For the project I didn't use Fritizing or similar, just a drawing program I'm quite familiar with (Affinity Designer). So unfortunately I don't have any schematics. This folder contains vector versions of the drawing.

I can provide more details about the boards, so feel free to ask, I'll be happy to help.

Regards,

Rubem

Benutzeravatar
rubem
Beiträge: 240
Registriert: 10 Feb 2014, 17:45
Wohnort: Porto Alegre, RS, Brasil

Re: Arduino Mega Controller für/for fischertechnik

Beitrag von rubem » 03 Mai 2023, 22:40

Hallo allerseits,

Ich baue meinen eigenen Controller für ein komplexes Projekt und dachte, es wäre am besten, einen neuen Thread zu erstellen .

mega-shield-ft.jpg

Es ist ein Arduino Mega-Klon mit einem Prototyp-Schild an der Spitze. Der Schild erhielt ein DFPlayer Mini MP3-Modul plus 3 duale DRV8833-Motortreiber, sodass dieser Controller Sound hat und bis zu 6 Motoren mit PWM vollständig steuern kann. Es gibt auch Vorkehrungen für mehrere I²C-Geräte, analoge Eingänge, digitale I/O-Pins für Motor-Encoder, Schalter und mehr. Das "Mini-Shield" darüber hat einen 9V-Eingang und ft-Buchsen, um die Verbindungen zu den Motoren zu erleichtern.

Die Tests laufen gut, alles funktioniert wie erwartet. Einige Header-Pins fehlen noch, ich mache später noch mehr Fotos.

Hier ist das Projektlayout:

Mega 2560 für ft@2x.png

Für das Projekt habe ich kein Fritizing oder ähnliches verwendet, sondern nur ein Zeichenprogramm, mit dem ich ziemlich vertraut bin (Affinity Designer). Also leider habe ich keinen Schaltplan. Dieser Ordner enthält Vektorversionen der Zeichnung.

Ich kann Ihnen mehr Details über die Boards geben, also zögern Sie nicht zu fragen, ich helfe Ihnen gerne weiter.

Grüße,

Rubem

Benutzeravatar
rubem
Beiträge: 240
Registriert: 10 Feb 2014, 17:45
Wohnort: Porto Alegre, RS, Brasil

Re: Arduino Mega Controller für/for fischertechnik

Beitrag von rubem » 03 Mai 2023, 22:41

I forgot, the proto shield underside looks like this for now:
------ Google translate
Ich habe vergessen, die Unterseite des Proto-Schildes sieht vorerst so aus:

shield underside.jpg
shield underside.jpg (985.81 KiB) 5247 mal betrachtet

Rubem

Arnoud-Whizzbizz
Beiträge: 145
Registriert: 20 Mär 2021, 17:06
Kontaktdaten:

Re: Arduino Mega Controller für/for fischertechnik

Beitrag von Arnoud-Whizzbizz » 04 Mai 2023, 17:55

Hi Rubem,

(Entschuldigung für das Englisch, ich denke, die meisten Leute hier können das ohne Übersetzung lesen?)

Such a nice project! I think I've gone more or less along the same way before I decided to go 'modular' with my 'Zauberling' modules (ATmega382 inside, 2 motor controls, four analog input, four digital outputs with drivers). Complex projects I mostly build out of concatenated modules nowadays, supervised via I2C if neccessary. But it sure is nice to have everything for one specific project (e.g. with MP3 player in your case) on one solution board! In my case the 16MHz of the Mega (or Uno, or most other Arduino's) 'for all' proofed to be a restriction. So I switched to an Arduino Due (54 MHz) for the more complex and multi-motor controls. For separate tasks (when you use a modular setup controlled over I2C) the 16 MHz per module/task would of course not be an obstacle too quickly. :roll:

Your board reminds me of some "TX-controller simulator" tinkering I did a few years ago because I liked to study the old ROBOpro code for a fischertechnik robotic-kit that came my way. Since I don't have a Windows computer, nor a TX(T)-controller I made this TX-simulator that can be used in 'live-mode' of ROBOpro (in my case emulated in VirtualBox on a Mac):

TX - 1.jpeg
TX - 1.jpeg (137.18 KiB) 5144 mal betrachtet

The yellow wire used to hook up to a separate display driven by an Arduino Nano. But the 16MHz loop of the Mega was too slow to control all outputs during reliable polling of the inputs, let alone counting pulses of an encodermotor on interupt (and that's only one counting-input used, haha). So later on I experimented with a seperate ESP32-board with a small color display. The displays monitor the configurable inputs and outputs.
TX - 1 (2).jpeg
TX - 1 (2).jpeg (129.64 KiB) 5144 mal betrachtet
TX - 1 (1).jpeg
TX - 1 (1).jpeg (123.95 KiB) 5144 mal betrachtet

The DRV8833 is a great choice, but unfortunately only for switched outputs, so the motors will not be able to have variable speed control [My fault, not right, read on]. You might consider the pin-compatible drop-in replacement TB6612FNG that enables you to not only control the rotation direction of your motors, but the speed as well via their additional PWM inputs. The modules don't even differ that much in price!
Zuletzt geändert von Arnoud-Whizzbizz am 05 Mai 2023, 00:00, insgesamt 1-mal geändert.

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

Re: Arduino Mega Controller für/for fischertechnik

Beitrag von juh » 04 Mai 2023, 22:55

Arnoud-Whizzbizz hat geschrieben:
04 Mai 2023, 17:55
The DRV8833 is a great choice, but unfortunately only for switched outputs, so the motors will not be able to have variable speed control. You might consider the pin-compatible drop-in replacement TB6612FNG that enables you to not only control the rotation direction of your motors, but the speed as well via their additional PWM inputs. The modules don't even differ that much in price!
Hi Arnoud,
maybe it's a misunderstanding, but of course you can PWM the DRV8833. It just uses a different control logic with only two input pins, which both need to be PWM inputs for full directional and speed control, while the TB6612 uses two non-PWM direction pins and one PWM for speed control.

Great stuff, btw, from both of you!

Jan

Benutzeravatar
rubem
Beiträge: 240
Registriert: 10 Feb 2014, 17:45
Wohnort: Porto Alegre, RS, Brasil

Re: Arduino Mega Controller für/for fischertechnik

Beitrag von rubem » 04 Mai 2023, 23:11

Hi Arnoud,

Thanks for your answer.

Yes, the Due is cool. There are also other boards with ESP8266 / ARM Cortex-M3, etc. But I don't think speed will be a problem soon. You guessed right, I use I2C a lot, my displays already have / will have their own dedicated Minis / Pro Micros so part of the heavy lifting is distributed. By the way, I used DRV 8833s with PWM several times now, so no problems here. In my shield, the 12 PWM outputs of the Mega are directly attached to the DRV8833 inputs, and the motors respond perfectly to variable speeds. (I see Juh has just commented about it.)

The TX simulator is great, by the way! The nixie tubes in the background are cool too :D

Anyway. I think that controlling complex models is one of those problems for which there will be never enough solutions... :D

Thanks again for your nice post.

Rubem

Benutzeravatar
rubem
Beiträge: 240
Registriert: 10 Feb 2014, 17:45
Wohnort: Porto Alegre, RS, Brasil

Re: Arduino Mega Controller für/for fischertechnik

Beitrag von rubem » 04 Mai 2023, 23:25

Hi again,

Now it occurred to me, maybe the TB6612FNG has dedicated PWM (not sure, never used it). This can be nice so the Mega PWM outputs may be used for other stuff like servo control. Anyway PWM is working quite well with the DRV8833s.

I still have lots of testing ahead, let's see if my controller is enough. Fingers crossed here ;)

Thanks,

Rubem
Zuletzt geändert von rubem am 06 Mai 2023, 01:25, insgesamt 1-mal geändert.

Arnoud-Whizzbizz
Beiträge: 145
Registriert: 20 Mär 2021, 17:06
Kontaktdaten:

Re: Arduino Mega Controller für/for fischertechnik

Beitrag von Arnoud-Whizzbizz » 04 Mai 2023, 23:58

rubem hat geschrieben:
04 Mai 2023, 23:25
Now it occurred to me, maybe the TB6612FNG has dedicated PWM (not sure, never used it). This can be nice so the Mega PWM outputs may be used for other stuff like servo control. Anyway PWM is working quite well with the DRV8833s.
Yep, both you and juh are completely right! :oops: My introduction to the DRV8833 was when I accidentally soldered it into a Zauberling, while I had planned a TB6612FNG in it where the A and B inputs are only used for direction of rotation (and 'brake' etc). This planted the idea that PWM is not possible, but since it is an H-bridge, you probably might as well control it with a duty cycle < 100% on these inputs. Which is in the datasheets indeed... :roll: Super!

But the main advantage of the TB6612FNG is of course that it only needs only one PWM-signal per motor. For my design that was an advantage at that time. The Mega has 15 PWM outputs, so no shortage there. The Pro Mini Board only has 6, of which 2 are part of the regular SPI bus that I wanted to keep free. And I also liked the idea of having the possibility to connect two servos as well (this design wish was dropped later, because I thought to use a I2C PCA9685 board for that)

So, thanks for the insights, love this forum! Happy Hacking!

Benutzeravatar
rubem
Beiträge: 240
Registriert: 10 Feb 2014, 17:45
Wohnort: Porto Alegre, RS, Brasil

Re: Arduino Mega Controller für/for fischertechnik

Beitrag von rubem » 06 Mai 2023, 01:35

Hi Arnoud and others,
Arnoud-Whizzbizz hat geschrieben:
04 Mai 2023, 23:58
The Mega has 15 PWM outputs
I didn't know that... until yesterday! (Mega newbie.) So you helped me solve two problems at once: 1) I was using port 13 as PWM, but this is the LED port and will always flash briefly during boot -- at least with the default bootloader. Easy, I'm using pin 46 instead of pin 13 now. and 2) I can connect two servos directly to the "ft-hat" using PWM ports 44-45, also tested successfully as shown below:

servos.jpg
servos.jpg (234.88 KiB) 4939 mal betrachtet

Thanks,

Rubem

Arnoud-Whizzbizz
Beiträge: 145
Registriert: 20 Mär 2021, 17:06
Kontaktdaten:

Re: Arduino Mega Controller für/for fischertechnik

Beitrag von Arnoud-Whizzbizz » 06 Mai 2023, 12:13

rubem hat geschrieben:
06 Mai 2023, 01:35
I was using port 13 as PWM, but this is the LED port and will always flash briefly during boot -- at least with the default bootloader.
A lot of I/O is indeed a good reason to choose a Mega. As juh is suggesting, I would also outsource the whole encoder stuff to a dedicated controller. Or consider an Aduino Due which, with its 84 MHz, is a lot faster than the 'normal' Arduino family. A 16MHz loop is too slow for polling too much inputs or reliable counting, even when its interrupt based.

I mainly use the Mega when I need a separate hardware serial (for example with a special bit setting or too high a speed for SoftwareSerial) while I want to be able to do some debug logging to the normal serial monitor. Or when more memory is needed (e.g. with displays that traditionally eat a lot of memory)

If you want to reduce the footprint of your Arduino Mega project in the future, it might be useful to know that there is also a Pro mini MEGA2560 board that is considerably smaller than the normal board at only 54mm x 38mm. You can easily make an experiment shield for it from the common universal breadboard prototyping printed circuit boards.

Happy Hacking! ;)

Benutzeravatar
rubem
Beiträge: 240
Registriert: 10 Feb 2014, 17:45
Wohnort: Porto Alegre, RS, Brasil

Re: Arduino Mega Controller für/for fischertechnik

Beitrag von rubem » 06 Mai 2023, 16:08

Hi Arnoud,

It is possible that the Mega won't be enough as a general-purpose "super ft controller", but I believe it will be enough for my needs. It won't be measuring RPM from several encoders at the same time or control a 6-axis robot, for example -- at least for the time being. In the end what I need for my current project is a lot of I/O, so I abandoned the idea of using Nanos. Then of course I got carried away with the soldering iron...

I considered the Pro mini MEGA2560 too, it would actually be more suitable for a modular approach because of its size. Or something else. I have this idea of a community-developed "super ft controller" kit including a custom PCB with protected I/O pins, ft sockets and a 3D printed case. The rest would be made of low-cost components: An ARM microcontroller module, motor drivers, servo outputs... Someday I'll find the time to make a rough draft and post it here. Then I'll leave the circuit / testing / etc. for those of you who really know how to do it :lol:

Best,

Rubem

Arnoud-Whizzbizz
Beiträge: 145
Registriert: 20 Mär 2021, 17:06
Kontaktdaten:

Re: Arduino Mega Controller für/for fischertechnik

Beitrag von Arnoud-Whizzbizz » 06 Mai 2023, 17:47

rubem hat geschrieben:
06 Mai 2023, 16:08
I have this idea of a community-developed "super ft controller" kit including a custom PCB with protected I/O pins, ft sockets and a 3D printed case. The rest would be made of low-cost components: An ARM microcontroller module, motor drivers, servo outputs... Someday I'll find the time to make a rough draft and post it here. Then I'll leave the circuit / testing / etc. for those of you who really know how to do it :lol:
Take a look at https://www.whizzbizz.com/en/the.next.zauberling :lol:

zauber - 1.jpeg
zauber - 1.jpeg (108.22 KiB) 4845 mal betrachtet

The ftDuino was born out of the same wish and is a great candidate as well, of course. So are the various motor shields. A controller based on a Raspberry Pi might also have a lot of potential, but the development of the ftPi (https://github.com/eXpire163/ftPi) seems to be stale for some time now.

But, I completely agree with you that tinkering yourself is always the best. My latest 'Zauberling' is equiped with an ATmega328 board, next generation will have the motor driver and microcontroller boards 100% SMD because assembly is still quite labour intensive. Not yet a production process that can be made 'semi-commercial'... It takes me around 2 days to build one complete module :roll: (even though I sold ONE to someone who absolutely wanted to have one)

piggyback.jpg
piggyback.jpg (190.99 KiB) 4845 mal betrachtet
Because I wanted to bring together quite a lot on the relatively small front, and wanted the traditional 'Silberling' footprint and interchangeability, I (temporarily) abandoned the ft plugs in this design. Another thing is that I think €0.30 for a 'Bundhülse' is way too much money. So I have already experimented a lot with more useful and affordable alternatives for this. Recently I found a very good alternative, which is also much more pleasant to solder (and keeps the forces of plugging in and out much better from the pcb). I am now developing a module that might 'fill a gap' in the current ft program. So... until then also a little 'secret'. haha. Let me develop it a little bit more, and then I'll tell you more about it. But first I have to finish two other projects (including one where I promised the client another month of 'confidentiality'). :roll: To be continued...

Benutzeravatar
rubem
Beiträge: 240
Registriert: 10 Feb 2014, 17:45
Wohnort: Porto Alegre, RS, Brasil

Re: Arduino Mega Controller für/for fischertechnik

Beitrag von rubem » 09 Mai 2023, 16:01

Hi Arnoud,

Cool! I'm curious about the development of your next Zauberling.

Rubem

Benutzeravatar
MasterOfGizmo
Beiträge: 2720
Registriert: 30 Nov 2014, 07:44

Re: Arduino Mega Controller für/for fischertechnik

Beitrag von MasterOfGizmo » 09 Mai 2023, 17:57

Arnoud-Whizzbizz hat geschrieben:
06 Mai 2023, 17:47
A controller based on a Raspberry Pi might also have a lot of potential, but the development of the ftPi (https://github.com/eXpire163/ftPi) seems to be stale for some time now.
The TX-Pi-HAT is available since some time https://tx-pi.de/en/hat
Arduino für fischertechnik: ftDuino http://ftduino.de, ftDuino32 http://ftduino.de/32

Arnoud-Whizzbizz
Beiträge: 145
Registriert: 20 Mär 2021, 17:06
Kontaktdaten:

Re: Arduino Mega Controller für/for fischertechnik

Beitrag von Arnoud-Whizzbizz » 09 Mai 2023, 19:56

MasterOfGizmo hat geschrieben:
09 Mai 2023, 17:57
The TX-Pi-HAT is available since some time https://tx-pi.de/en/hat
Thanks! I'm sure I've seen this site some time ago, but couldn't find it again. Now I'll bookmark it, and I'm going to take a look again!

Danke! Ich bin mir sicher, dass ich diese Seite schon vor einiger Zeit gesehen habe, aber ich konnte sie nicht wieder finden. Jetzt werde ich es mit einem Lesezeichen versehen und werde es mir noch einmal ansehen!

Benutzeravatar
rubem
Beiträge: 240
Registriert: 10 Feb 2014, 17:45
Wohnort: Porto Alegre, RS, Brasil

Re: Arduino Mega Controller für/for fischertechnik

Beitrag von rubem » 31 Aug 2023, 23:36

Hi,

I've added a small step-down to the ft hat board adjusted to around 5.5 V to act as a supply for the servos, see below:

newhat.png
newhat.png (548.74 KiB) 3933 mal betrachtet

I was lucky I still had space between it and the main shield, because it was an afterthought. The diagram was updated accordingly. I made other modifications too.

newdiagram.png
newdiagram.png (427.4 KiB) 3933 mal betrachtet

Best,

Rubem

atzensepp
Beiträge: 660
Registriert: 10 Jul 2012, 21:40
Wohnort: Uttenreuth

Re: Arduino Mega Controller für/for fischertechnik

Beitrag von atzensepp » 01 Sep 2023, 09:27

rubem hat geschrieben:
31 Aug 2023, 23:36
Hi,

I've added a small step-down to the ft hat board adjusted to around 5.5 V to act as a supply for the servos, see below:


newhat.png


I was lucky I still had space between it and the main shield, because it was an afterthought. The diagram was updated accordingly. I made other modifications too.


newdiagram.png


Best,

Rubem
Hello Rubem,

that is very useful. Where is the Step-Down-Converter? Is it the small green Board below the proto board?

Florian

Benutzeravatar
rubem
Beiträge: 240
Registriert: 10 Feb 2014, 17:45
Wohnort: Porto Alegre, RS, Brasil

Re: Arduino Mega Controller für/for fischertechnik

Beitrag von rubem » 01 Sep 2023, 18:32

atzensepp hat geschrieben:
01 Sep 2023, 09:27
Where is the Step-Down-Converter? Is it the small green Board below the proto board?
Florian
Exactly. I'm out of town this weekend, I can post a couple of photos when I return.

Rubem

Benutzeravatar
rubem
Beiträge: 240
Registriert: 10 Feb 2014, 17:45
Wohnort: Porto Alegre, RS, Brasil

Re: Arduino Mega Controller für/for fischertechnik

Beitrag von rubem » 03 Sep 2023, 21:44

Here is the top board from the underside:
underside.jpg
underside.jpg (310.05 KiB) 3773 mal betrachtet
And the whole assembly:
assembled.jpg
assembled.jpg (696.17 KiB) 3773 mal betrachtet
Rubem

Antworten