Best hardware approach for complex project? / Bester Hardware-Ansatz für komplexe Projekte?

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

Best hardware approach for complex project? / Bester Hardware-Ansatz für komplexe Projekte?

Beitrag von rubem » 04 Mär 2023, 01:20

(Deutsche Übersetzung im nächsten Post)

Hi everyone,

I'm working on a new ft project (pssst... it's a secret ;) ) where I need a lot of I/O ports and some relatively complex interactions between a finite state machine and 3-4 encoder motors which need to stop at precise points.

The hardware will consists of something around the following:

• 6-9 switches
• 3-4 ft analog color sensors
• 3-4 ft motor encoder inputs
• 3-4 PWM ft encoder motor outputs
• 4-6 LED outputs
• One or two I²C displays

Yes, it's a lot, I know... The following approaches are possible based on the controllers I have:

1) Two Arduinos connected via I²C plus H-bridges to drive the motors
This is similar to what I used in the pinball machine, but I didn't need encoder motors or precise positioning there. I suspect this apporach will be not ideal because I'll have to deal with interrupts, counters, etc. and maybe some level converters, but who knows.

2) Use a TX connected to an Arduino via I²C
The TX is already optimized for encoder motors, it's fast to boot and does not need an I²C level converter. And I'm already testing it with an Arduino and it works both ways. I use via I²C to send input signals to the Arduino use it to control the encoder motors. But doing complex logic with Robo Pro and its flowcharts is quite cumbersome and impenetrable for me.

3) Use a TXT (not 4.0) connected to an Arduino via I²C
Same as 2, but with the obvious TXT hardware advantages, WLAN, etc. Seems to need a level converter for the I²C, though. (At least that's what I can infer from this forum, please correct me if I'm wrong here.) An interesting possibility would be to use a C/C++ compiler. I see C# is also possible using Nanoframework. I have lots of backgound with these 3 languages and their environments, but no experience with the specific ft setup, and I reckon it's not the easiest thing to do. However this may be the best approach for me. Or is it?

So my question goes to the several experienced ft technicians among you: Given the options above, what would be the best approach in your opinion? Feel free to ask me anything (except what the project is, hahaha :lol: ).

Sorry for the long post... Thanks a lot in advance,

Rubem

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

Re: Best hardware approach for complex project? / Bester Hardware-Ansatz für komplexe Projekte?

Beitrag von rubem » 04 Mär 2023, 01:22

Hallo allerseits,

Ich arbeite an einem neuen ft-Projekt (pssst ... es ist ein Geheimnis ;) ), wo ich viele I/O-Ports und einige relativ komplexe Interaktionen zwischen einer endlichen Zustandsmaschine und 3-4 Encoder-Motoren benötige, die anhalten müssen an genauen Punkten.

Die Hardware besteht ungefähr aus Folgendem:

• 6-9 Schalter
• 3-4 Fuß analoge Farbsensoren
• 3-4 Fuß Motor-Encoder-Eingänge
• 3-4 PWM-Fuß-Encoder-Motorausgänge
• 4-6 LED-Ausgänge
• Ein oder zwei I²C-Displays

Ja, es ist viel, ich weiß ... Folgende Ansätze sind basierend auf den Controllern, die ich habe, möglich:

1) Zwei Arduinos, die über I²C plus H-Brücken verbunden sind, um die Motoren anzutreiben
Dies ähnelt dem, was ich im Flipper verwendet habe, aber ich brauchte keine Encoder-Motoren oder eine präzise Positionierung Dort. Ich vermute, dass dieser Ansatz nicht ideal sein wird, weil ich mich mit Interrupts, Zählern usw. und vielleicht einigen Pegelwandlern befassen muss, aber wer weiß.

2) Verwenden Sie einen TX, der über I²C mit einem Arduino verbunden ist
Der TX ist bereits für Encoder-Motoren optimiert, bootet schnell und benötigt keinen I²C-Pegelwandler. Und ich teste es bereits mit einem Arduino und es funktioniert in beide Richtungen. Ich verwende I²C, um Eingangssignale an den Arduino zu senden, um damit die Encoder-Motoren zu steuern. Aber komplexe Logik mit Robo Pro und seinen Flussdiagrammen zu machen, ist ziemlich umständlich und undurchdringlich für mich.

3) Verwenden Sie ein TXT (nicht 4.0), das über I²C mit einem Arduino verbunden ist
Wie 2, aber mit den offensichtlichen Vorteilen der TXT-Hardware, WLAN usw. Scheint jedoch einen Pegelwandler für den I²C zu benötigen. (Zumindest kann ich das diesem Forum entnehmen, bitte korrigieren Sie mich, wenn ich hier falsch liege.) Eine interessante Möglichkeit wäre die Verwendung eines C/C++-Compilers. Ich sehe, dass C# auch mit Nanoframework möglich ist. Ich habe viel Erfahrung mit diesen 3 Sprachen und ihren Umgebungen, aber keine Erfahrung mit dem spezifischen ft-Setup, und ich denke, es ist nicht die einfachste Sache. Dies ist jedoch möglicherweise der beste Ansatz für mich. Oder ist es?

Meine Frage geht also an die erfahrenen ft-Techniker unter Ihnen: Was wäre Ihrer Meinung nach angesichts der oben genannten Optionen die beste Vorgehensweise? Fühlen Sie sich frei, mich alles zu fragen (außer was das Projekt ist, hahaha :lol: ).

Entschuldigung für den langen Beitrag ... Vielen Dank im Voraus,

Rubem

Benutzeravatar
steffalk
ft:pedia-Herausgeber
Beiträge: 1792
Registriert: 01 Nov 2010, 16:41
Wohnort: Karlsruhe
Kontaktdaten:

Re: Best hardware approach for complex project? / Bester Hardware-Ansatz für komplexe Projekte?

Beitrag von steffalk » 04 Mär 2023, 11:53

Hello Rubem,

As you are talking about a really complex project, perhaps there is another relatively cheap, but mighty option: https://nanoframework.net. You use Visual Studio (including normal VS and VS Code) to program in C# with most of its features (exceptions are generics and thus LINQ currently), have the full VS debugging experience, unit tests, you name it. Some complex system might be easier programmed in C# than in low-level C. And if some low-level highest-speed code is needed, you can integrate C code into the solution. nanoFramework runs on a lot of 32 bit µC boards. Just a suggestion.

Best regards and good luck with you work,
Stefan

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

Re: Best hardware approach for complex project? / Bester Hardware-Ansatz für komplexe Projekte?

Beitrag von juh » 04 Mär 2023, 12:49

Hi Rubem,

I think there's a lot of "it depends" and matters of personal taste in your questions, and I can't answer to options 2 and 3 as I don't use TX(T)s.

However, if you're going for option 1 I'd consider isolating/outsorcing the encoder stuff to either a dedicated device which does nothing but counting, like I did with the ATtiny85 in the quadrature encoder thread, or use a µC with dedicated encoder/counting hardware. And if you're using I2C anyway for the displays, I'd use one of the many I2C port expander modules (like MCP23017 etc.) for more I/O-pins, instead of another Arduino.

*If* you're going for another Arduino connected with I2C, you could have a look at I2Cwrapper, which already comes with a lot of the functionality, e.g. the PinI2C module and where it's easy to add new features. For the encoder stuff, I'll release the RotaryEncoderI2C module soon, so you could integrate that as well with I2Cwrapper. See the videos in the encoder thread for a demo of what I2Cwrapper can do.

In any case, looking forward to your results
Jan

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

Re: Best hardware approach for complex project? / Bester Hardware-Ansatz für komplexe Projekte?

Beitrag von atzensepp » 04 Mär 2023, 13:02

Hello Rubem,

we are curious about your project. If you want to stick with the hardware you have at hand I'd suggest to consider the propsosal from @juh.
Personally I would try to do it with only one single controller to avoid the communication between controllers. My approach would be to use an Arduino Mega with two stacked Motor Shields (*) and a very simple I2C-Multiplexer which I used to control (positional control with PID) an "agile eye" (3D-robot) with 3 motors and 3 magnetic I2C-encoders (Actually for me a Arduino UNO was sufficient). Arduino Mega has enough control pins for your demand. 4 Motors would also be possible. (If you would like the code to have a look at it please let me know)

Florian

PS: A simple I2C-Multiplexer I have used is in the thread here:viewtopic.php?f=15&t=6986&hilit=i2c+multiplexer
Or more conveniently you also can use an I2C-multiplexer with an TCA9548A.

* Actually you cannot simply stack the motor shields physically. You must re-wire a few pins.

EDIT: It should be mentioned that @fotoopa has done some very slick work with FPGAs. However his approach requires advanced skills.
EDIT 2: I guess an Arduino UNO might work for you if you'd use an ADC with I2C (e.g. ADS1115)

Benutzeravatar
uffi
Beiträge: 404
Registriert: 24 Jan 2014, 16:21
Wohnort: München

Re: Best hardware approach for complex project? / Bester Hardware-Ansatz für komplexe Projekte?

Beitrag von uffi » 04 Mär 2023, 18:46

Hi Rubem,

I fully support the proposal from atzensepp to use an Arduino Mega board (clone from China via Aliexpress) with an RGB colour display 320x480 on top of it (controlled via ILI9486 or later). Instead of encoder motors I would use stepper motors (cheap models available from Pollin for less than 3 US$) and stepper driver DRV8825 (cheap stuff from China via Aliexpress). They have much better precision than encoder motors.

I prefer to not use the arduino code development environment. Instead I use Microchip Studio (former Atmel Studio) with the gnu gcc c-compiler writing plain c-code.

Kind regards, Dirk

https://www.pollin.de/p/schrittmotor-mi ... -80-310690

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

Re: Best hardware approach for complex project? / Bester Hardware-Ansatz für komplexe Projekte?

Beitrag von rubem » 04 Mär 2023, 20:14

Hi Stefan, Jan, Florian and Dirk,

Thank you all for your great answers. Maybe I overstressed the "complex" part a little bit. I don't need super-ultra-high precise positioning, so maybe the ft encoder motors will do. Of course they are much easier to assemble in the model. But I'll keep the idea of using steppers if the encoder motors prove to be too imprecise.

The controller will have to perform several calculations, take care of 3-4 encoder motors, and more. From what I've seen so far, trying to it it with ROBO Pro will be exhausting. Look at the blocks below -- that's just one of the subprograms, and I'm just in the beginning. Really?

ROBOPro_04-15-23_15-59-03.png
ROBOPro_04-15-23_15-59-03.png (47.22 KiB) 7144 mal betrachtet

So back to your responses. The I²C multiplexer and/or MCP23017 are simple great ideas I never thought about. I'll probably buy a couple of TCA9548As to play with because they are so cheap. The Mega is great, sure, but I already have half a dozen Nanos. An 8 to 1 I²C multiplexer will already provide the extra ports I need. And Jan, I already knew you work with encoders and the like, but I admit I wasn't aware of I2Cwrapper, I'm embarassed :oops: Bookmarked! There's a lot to learn there.

As of now, you can see that fischertechnik is losing the match to Arduino by 3 x 1 ;) : But two POCs, one for each possibility, are certainly within my capabilities. Stefan, C# would be super cool, it's a great language, I worked with it for years and loved it. I'm also at home with VS Code. There's very little about Nanoframework in the forum, though. Are there any tutorials or step-by-step instructions for setting up the necessary environment to work with the TXT?

Thanks again to you all and enjoy your weekend,

Rubem

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

Re: Best hardware approach for complex project? / Bester Hardware-Ansatz für komplexe Projekte?

Beitrag von juh » 04 Mär 2023, 20:56

rubem hat geschrieben:
04 Mär 2023, 20:14
I'll probably buy a couple of TCA9548As to play with because they are so cheap. The Mega is great, sure, but I already have half a dozen Nanos. An 8 to 1 I²C multiplexer will already provide the extra ports I need.
Hi Rubem,

I'm sure you'll find the perfect solution from all these suggestions. But just in case, let me mention that I2C multiplexers and I2C expanders do very different things, and given your comments I'm not entirely sure you're aware of that. Multiplexers like the TCA9548A help bring multiple devices with the same I2C address to one bus, so you'll only need them for the rare case that you need several I2C devices of the same type which only support one single address. So I think that I2C expanders is what you will want here, and where there is a wide array of options with MCP23017, PCF8574, PCF8591, ADS1115 and probably a couple more, each with their pros and cons.

Jan

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

Re: Best hardware approach for complex project? / Bester Hardware-Ansatz für komplexe Projekte?

Beitrag von rubem » 04 Mär 2023, 21:19

Hi Jan,
juh hat geschrieben:
04 Mär 2023, 20:56
given your comments I'm not entirely sure you're aware of that
I you are absolutely right :lol: In my "digital electronics from the 80s" mind, I imagined that an I²C multiplexer would provide the extra I/O I need. But I think I get it now: an I²C multiplexer provides extra I²C ports, which is a completely different thing. I'll look for I²C expanders now...

Thanks for the clarification,

Rubem

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

Re: Best hardware approach for complex project? / Bester Hardware-Ansatz für komplexe Projekte?

Beitrag von rubem » 19 Mär 2023, 19:02

Hi again,

My two POCs are shown below. The mechanics of both models are identical: An encoder motor with a Z10 pinion that drives a Z40 (32 teeth at 90°) which rotates a turntable with 6 spokes. One of them has a yellow plate acting as a marker for a luminosity sensor.

poc.jpg
poc.jpg (1.32 MiB) 6904 mal betrachtet

1) The right POC uses a TXT and ROBO Pro. Here is the rpp file. The motor starts at full speed (512), keeps it for a while, then decreases its speed to 150. Then it waits until the luminosity goes below a certain threshold, meaning the yellow plate is below the sensor. Finally it counts some encoder steps, then stops. The pushbutton is used to restart the test. The goal is to stop at precisely the same point each time. My observations:
  • The stop point is very consistent provided the motor and the slow speed value is kept the same.
  • However, the stop point will vary quite a bit when the slow speed is changed to, say, 200. Increasing the final speed moves the stop point ahead and vice-versa. I thought the encoder would be very precise... But the flaw may be in my program, I have very little experience with ROBO Pro.
  • Different 135484 motors have noticeable different slow speeds and stop points.

2) The left POC is Arduino-based with a DRV8833 motor driver. The code is quite straightforward, using a finite state machine arranged to perform the functions similar to the ROBO Pro program. An external interrupt counts the pulses sent by the encoder. But the result are different:
  • The precision is lower. The stop point is less consistent and may vary quite a bit. Maybe there is something wrong with my code when reading the encoder pulses? I expected at least similar results to those with the TXT.
  • The stop point variation according to the final (slow) speed is even more pronounced than with the TXT.
  • One difference in this circuit: Both the encoder and luminosity sensor are powered by 5V, not 9V since I don't want to overload the Arduino inputs. (With no oscilloscope I can't measure the actual output levels, so I'd better play safe. Maybe I'll use a resistor divider in the future.)
  • The max speed (255) is noticeable faster than with the TXT.

Any tips?

Warmest regards,

Rubem

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

Re: Best hardware approach for complex project? / Bester Hardware-Ansatz für komplexe Projekte?

Beitrag von juh » 19 Mär 2023, 21:13

If anything, you are succeeding in raising couriosity for your upcoming project. ;-)
rubem hat geschrieben:
19 Mär 2023, 19:02
However, the stop point will vary quite a bit when the slow speed is changed to, say, 200. Increasing the final speed moves the stop point ahead and vice-versa. I thought the encoder would be very precise... [/list]
Is it really the encoder's problem, here, or just the behavior to be expected? Isn't it normal that the motor will not come to an immediate halt after having reached your given number of encoder steps, even if you put the driver in brake mode? And if it's faster it will take longer to brake. I think this is exactly the problem with speed ramps that we talked about in an earlier conversation. I had exactly the same problem in my latest quad encoder video where the precision you can see is kind of fake, as I adapted speed to distance so that the motor would come to a stop where it should. Independence from such variables is exactly what PID is about, isn't it?

I can't speak to the TXT stuff and running ft hardware at 5V.

Otherwise, I had a look at the Arduino side and couldn't see any obvious reasons, only that you did not declare the variables which are changed in the interrupt as volatile. I think in theory that could lead to counting problems. Apart from this, my approach would be to simplify for testing. The state machine seems to be mostly linear, so personally I'd try to do without it for testing. Also, interrupts are fine, but they add an extra level of complexity. For counting encoders, it is ok to poll them, as long as you are sure the polling takes place at least every n/2 seconds, with n being the minimum delay between two signal changes. So at least for debugging, I'd try to do without them at first, and handle the two states in the main loop.

Just my 2 cents. ;-)

vg
Jan

Benutzeravatar
uffi
Beiträge: 404
Registriert: 24 Jan 2014, 16:21
Wohnort: München

Re: Best hardware approach for complex project? / Bester Hardware-Ansatz für komplexe Projekte?

Beitrag von uffi » 19 Mär 2023, 22:53

Hi rubem,
rubem hat geschrieben:
19 Mär 2023, 19:02
One difference in this circuit: Both the encoder and luminosity sensor are powered by 5V, not 9V since I don't want to overload the Arduino inputs. (With no oscilloscope I can't measure the actual output levels, so I'd better play safe. Maybe I'll use a resistor divider in the future.)
I tested the encoders of the fischertechnik encoder motors and checked with an oscilloscope: they work perfectly with 5V supply voltage and have an open collector output. Therefore - if not done already - activate the pullups in your arduino controller for these inputs.

Kind regards, uffi

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

Re: Best hardware approach for complex project? / Bester Hardware-Ansatz für komplexe Projekte?

Beitrag von rubem » 20 Mär 2023, 22:27

Hi Jan / Uffi,

Many thanks for your help, I've made a few changes as per your suggestions. I've removed the initial states of the state machine so now it just waits, senses the yellow plate, counts some steps, then stops. Removing interrupts and using delays in the main loop does ideed seem to increase precision, but I still want to try an Arduino encoder library. Most are for quadrature encoders, I'm not sure if they will work with the 9V ft motors. I found only one without quadrature, I'll try using it. PID seems to be ideal for getting more precision, but I don't have a clue on how to use it together with encoders. (Will PID work without quadrature encoders? I don't know.) Will keep searching.

Meanwhile it's good to know that the encoders are open collector, so AFAIK this means they won't overload the Arduino inputs. The luminosity ("color") sensors, on the other hand, seem to output a voltage out of a 10V scale, so I'd keep powering them with 5V for now...

Thanks again,

Rubem

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

Re: Best hardware approach for complex project? / Bester Hardware-Ansatz für komplexe Projekte?

Beitrag von rubem » 23 Mär 2023, 23:20

Hi everyone,

I've made an important change in my setup so that a magnet and reed switch have replaced the color sensor as you can see below. I also made several ajustments to the Arduino program (special thanks to Juh :D who kindly sent me his ideas and code) and the combined result is that precision is much higher now. The updated code is here for those who are interested.

magnet & reed.jpg
magnet & reed.jpg (1.1 MiB) 6667 mal betrachtet

As for the details, I pressed a 10 mm ring magnet on a S-strut adapter 31848. This assembly is a lot smaller and easier to attach than the magnetic ball holder 119850 which works equally well. The sensor is a small, cheap plastic reed switch inserted into a ft slot. Curiously, for some reason the internal pull-up in the Arduino pin was not enough so I had to complement it with a pull-up 1kΩ resistor. Odd!

This was (I hope) the most difficult part, I think I can move on with my project now. Being unable to use a TXT / TX (again) is a bit of a disappointment... :(

Best regards and thanks to all,

Rubem

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

Re: Best hardware approach for complex project? / Bester Hardware-Ansatz für komplexe Projekte?

Beitrag von rubem » 02 Mai 2023, 23:10

Hi again,

Inspired by Karl's thread I purchased some HC-020K encoders (see my post here) and they were the best option, so precision is finally good.

Regarding the controller... Florian (atzensepp) hinted me to go for an Arduino Mega instead of expanders. I finally decided to give the idea a try, so I bought one plus a transparent case and prototype shield, and the result is this:

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

The prototype shield received a Mini MP3 player plus 3 dual motor drivers, so this controller has sound and can fully control up to 6 motors with PWM. The "mini-shield" on top of it has a 9V input and ft sockets to facilitate the connections to the motors.

Some header pins are still missing, but it's almost finished. I'll soon be able to return to my project.

Rubem

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

Re: Best hardware approach for complex project? / Bester Hardware-Ansatz für komplexe Projekte?

Beitrag von Arnoud-Whizzbizz » 04 Mai 2023, 19:13

Hi Rubem and others,

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

This seems to be the main thread (did an answer to the sub-thread at viewtopic.php?f=8&t=8018 ) I would not post too much stuff twice, but perhaps some additional feedback (or just my 2cts, for what it's worth).

I understand that you plan to make a PWM-driven motor controller with DRV8833 modules? For as far as I have learned (the hard way, and it took a long time to figure this out because the visual differences between my DRV8833 and TB6612FNG boards where actually almost NONE) this is not possible with the DRV8833. Please consult the datasheet, you might consider a TB6612FNG instead.

[EDIT: not exactly true, the DRV8833 can be used with PWM. Difference is it needs 2 inputs per motor, where the TB6612FNG uses only one]

Furthermore, 16 MHz is not that much to meet your I/O specs. I have experimented with both PCF8575 and MCP23017 over I2C and with counters on interrupts and a display active you might easy miss input polls in your main loop. Consider taking a modulair approach with various state machines driven over I2C and e.g. an ESP32 or Raspberry for your main controller.

TX - 1.jpeg
TX - 1.jpeg (137.18 KiB) 6239 mal betrachtet
Zuletzt geändert von Arnoud-Whizzbizz am 05 Mai 2023, 00:02, insgesamt 1-mal geändert.

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

Re: Best hardware approach for complex project? / Bester Hardware-Ansatz für komplexe Projekte?

Beitrag von rubem » 04 Mai 2023, 23:18

Hi Arnoud / everyone,

Answers to Arnoud's post are in the Mega controller thread, please go there.

Thanks,

Rubem

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

Re: Best hardware approach for complex project? / Bester Hardware-Ansatz für komplexe Projekte?

Beitrag von Arnoud-Whizzbizz » 06 Mai 2023, 11:50

rubem hat geschrieben:
19 Mär 2023, 19:02
My two POCs are shown below. The mechanics of both models are identical: An encoder motor with a Z10 pinion that drives a Z40 (32 teeth at 90°) which rotates a turntable with 6 spokes. One of them has a yellow plate acting as a marker for a luminosity sensor.
It's not quite clear to me what you're trying to do (hey, it's a secret project ;) ), but apparently you want to measure rpm with the ft luminosity sensor?

You might find my recent experiments on https://www.whizzbizz.com/en/rpm.meter useful, in which I measure reflections with dirt cheap IR obstacle sensors. Proof of concept done with an Uno with LCD shield and an additional Schmitt trigger.

rpm - 1.jpeg
rpm - 1.jpeg (99.75 KiB) 6144 mal betrachtet

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

Re: Best hardware approach for complex project? / Bester Hardware-Ansatz für komplexe Projekte?

Beitrag von rubem » 06 Mai 2023, 15:36

Hi Arnoud,
Arnoud-Whizzbizz hat geschrieben:
06 Mai 2023, 11:50
It's not quite clear to me what you're trying to do (hey, it's a secret project ;) ), but apparently you want to measure rpm with the ft luminosity sensor?
Well, no, not really, I don't need to measure RPM. The luminosity sensors were merely used to find a "home" position on the wheels. But I needed better precision than the sensors and a 15 x 15 yellow plate offered. I tried a reed sensor and ring magnet which, along with code improvements (no interrupts needed, thanks to juh) worked together and increased the precision (see photo above). A further improvement was possible using fork sensors HC-020K after reading Karl's post. There are several mounting options for it.

Here is the current setup. The home position is found when the S-Rivet 4 crosses the fork sensor:

Fork sensor with S-rivet.jpg
Fork sensor with S-rivet.jpg (348.45 KiB) 6115 mal betrachtet

Thanks for your ideas and for pointing me to the Whizzbizz site, lots of cool stuff there. It will be a long thank you list :D

Best regards,

Rubem

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

Re: Best hardware approach for complex project? / Bester Hardware-Ansatz für komplexe Projekte?

Beitrag von rubem » 28 Jul 2023, 17:15

Hi again,

So here it is... A slot machine. 🎰 After a while I realized that keeping the project as a secret is a bit silly. :? The hardware problems are all basically solved now, and I ended up using a fair share of the Mega's I/O ports. Here's a picture showing the symbol reels and displays:

1000017196.jpg
1000017196.jpg (601.88 KiB) 5279 mal betrachtet

I had no problems whatsoever with timing and processor speed, I'm pretty satisfied with the Mega so far. But the software is actually more complicated than I thought. Presently I'm refactoring the code so it becomes more manageable (this means classes). I'll post some links to the code and other project documents later in this thread.

After this machine is finished (no idea when) I'll work on a simple project like a basic RC car. ;) My brain will need some rest then.

(To the moderators: please feel free to split this post and move it elsewhere if needed.)

Greetings

Rubem

Antworten