Controling motor from msx

Page 2/2
1 |

By Toine

Supporter (4)

Toine's picture

18-09-2023, 12:46

Hallo Pauloall, it is a long time ago when you placed this question. I am very interested how your project has ended. I am making something like you did. Is it possible? Do you have tips?

By NYYRIKKI

Enlighted (6093)

NYYRIKKI's picture

18-09-2023, 19:25

It would be much more easy to answer these questions, if you would tell what kind of "control" you want to implement. All the solutions depend of things like motor size and level of control.

If you need just one small motor that you can power on or off then the BASIC command MOTOR ON/OFF can be a solution... -> Wire power to motor so that is spins. Cut one wire and connect the loose wires to cassette port pins 6 and 7 and you are done. This is however not meant to control a washing machine or so.

Next easy (from hardware perspective) is to control servo motors. These are special in a way that they don't spin, but turn to angle you want. Power the servo with battery or other PSU. Connect data wire to some printer port data pin and ground to MSX ground. Load a BASIC driver (I can provide) and you are done. This way you can control up to 8 servo motors. Downside on this is that printer connectors are harder to find and the BASIC library needs that you run you MSX monitor on 50Hz refresh rate.

Demo: https://www.youtube.com/watch?v=JjabFEr_Jz0

If you need to contol motor spin speed & direction then likely it is good idea to check RC car parts. AFAIK many speed controllers take same kind of input than servos, so same library is likely fine, but check the speed controller specs.

If you want ie. just more of these ON/OFF controls or for bigger motor then look for Arduino examples or ready build accessories. If you connect the circuit to MSX printer port instead of Arduino, you are likely fine. On MSX-BASIC you can have direct control of printerport 8 data pins by using OUT &H91,&Bxxxxxxxx command.

Joystick ports are hard to control even with assembly and practically out of reach for BASIC programmer. They have also only 3 output pins, so you likely need more electronic ICs (ie. shift registers) to get any useful results. Only really appealing thing is that the connectors are easy to find.

RS-232 may also sound nice, but in practice it is likely not what you want. Many devices around us from DSL-modems to video projectors can be controlled with RS-232. There exists also all kinds of servo and motor controllers that you can buy. If your MSX happens to be ie. SVI-738 then it might be viable option to control these. How ever most MSX machines don't have built in RS-232 port but you need external one. Even when you get the physical port attached, you likely soon find out that it does not support BASIC at all... Even if all of this is sorted out, you need to think about communication speed & other settings and learn the control language, maybe add checksums etc. It can easily get pretty complex & far from the orginal goal, if your original goal was not very complex in the first place.

Just to cover all options, naturally MSX cartridge port is the ultimate solution "with no limits", if your goal is to do some really serious stuff, but that approach requires quite a bit more components and dedication.

By Toine

Supporter (4)

Toine's picture

20-09-2023, 11:46

NYYRIKKI, i appreciate your answer very much! Thank You!
i am making a :"sun follower" on a low-tec level for controlling a small PV-panel. Principaly mine aim is that the position is all ways as good possible for receiving the maximum sunlight. I change it every hour, horizontal en vertically.
Ik know i can use a lot off electronica, but my aim is to use as much as possible simpel mechanic parts.
Therefore i need know one or two motors. I use one from a juice-maker.
It is one-way communication, no feed back at this time ( later may be i do).
At the time i am doing other things, but i will surely come back on this site in the coming weeks/months.
Excuse for my poor English.

By NYYRIKKI

Enlighted (6093)

NYYRIKKI's picture

20-09-2023, 16:45

Ok, I Googled and found this video:

https://www.youtube.com/watch?v=-f6FthqPwog

... seems that servo motors could work fine.

Here is kind of super simple example of what such solar tracker program could look like on MSX-BASIC: (Moves towards sun once in an hour and powers off servos for the night)

10 DEFINT A-Z
20 BLOAD"SERVO.BIN",R
30 GET TIME T$:H=VAL(T$)
40 IF H<8 or H>19 THEN X=0:Y=0 ELSE X=H*10:Y=SIN((H-8)/3.5)*50+50
50 A=USR0(0):A=USR1(X)
60 A=USR0(1):A=USR1(Y)
70 GOTO 30

Here is the control library:
https://msx.fi/temp/servo.zip

Documentation is on sources.

By Dubbylabby

Expert (66)

Dubbylabby's picture

22-09-2023, 17:47

Maybe I’m going to say dumb solution but…
Meanwhile new “grove compatible Nishi’s cartridge” arrive why don’t use rogo?

Afaik (and understand) it can handle motors to a certain degree (almost dc)
https://msx.org/es/forum/debates-en-espa%C3%B1ol/hardware/us...

Another solution will be implementing a custom solution with an arduino-like (or esp32) board over cartridge port too.

Example using esp32 for interfacing wifi/sdmapper but you can get the idea…

https://retrowiki.es/viewtopic.php?t=200039613

The pcb proto cartridge board is from msxmakers but jordi hasn’t listed/linked it anywhere (issue I will tell him to fix asap)

Cheers!

By Dubbylabby

Expert (66)

Dubbylabby's picture

22-09-2023, 17:55

Well I was answering the OP so I didn’t read the 2nd page Tongue

Well almost this post could be a reference for someone else looking into motor interfacing or maybe if you guys decide to go the cartridge route.
Rogo one is basic but still requires some knowledge to build the cartridges and so but almost in the first link I point to other post where source files can be reached.
Second one (based over proto cartridge) will require also knowledge but almost the proto cartridge itself was conceived as help for those requiring cartridg slot interfacing with tinkering goals Wink

Hope it helps somehow and forgive me for posting without reading the whole thread…

By NYYRIKKI

Enlighted (6093)

NYYRIKKI's picture

23-09-2023, 09:10

@Dubbylabby Sorry to say, but these are not good ideas.

SVI-2000 is a toy and Rogo is special "language" to teach kids some logic. Calling it even "programming language" is bit of a stretch as it is quite far of being Turing complete. More like super simple script language with tons of limitations. If I even want to control SVI-2000, I much rather do it in MSX-BASIC as it is 1000% better for the job. (BTW I did make a Pong-game on BASIC that you can play against this SVI RobotARM) Ok, looking the cartridge inner parts may give some ideas for how to implement super simple motor control, but it is not exactly something you would like to replicate. Much better idea is to use Google and read about the subject than try to reverse engineer the card. It is not that good design.

That ESP32 idea was even more weird, can you explain what you were thinking a bit more? If you want to implement motor control to ESP32 rather than MSX, that is fine. From HW point of view (that you did not cover) it is not any different than doing it for MSX. The thing that I didn't understand was why the heck you would attach it to MSX cartridge port!? It has WiFi and all... Connect it using WiFi to your home network and control it from MSX using ie. GR8NET card. The benefits should be very clear: GR8NET has ready made BASIC-commands for doing what you need to do. You don't need to build any PCB. You don't need to write any Z80 bus emulation software for ESP32, but you can stick to ready made libraries. You are left with much more I/O pins to connect further stuff and without physical connection it is overall more easy to implement even from motor control wiring point of view. Ok, ok, I can imagine that direct cartridge port connection could be written in a way, that it results to faster connection, but in motor control kind of task there is nothing where those milliseconds would really count.

By NYYRIKKI

Enlighted (6093)

NYYRIKKI's picture

23-09-2023, 10:04

Toine wrote:

Therefore i need know one or two motors. I use one from a juice-maker.

Ah, right... I missed this part... Well, in this case it is likely enough that you can drive two motors back and forth... You can for example plug this to your printer port: https://www.ebay.com/itm/355017150136

if you use pins D0-D3, this should get you going in BASIC:
Drive motor 1 forward: OUT &H91,1
Drive motor 1 backwards: OUT &H91,2
Drive motor 2 forward: OUT &H91,4
Drive motor 2 backwards: OUT &H91,8
Stop all: OUT &H91,0

You can also add these together, so ie. both forward = 1+4 = 5 -> OUT &H91,5

By Dubbylabby

Expert (66)

Dubbylabby's picture

24-09-2023, 11:26

Hi @nyyrikki!
As I said I was answering the OP question not the latest comments and I understood someone was asking for motor interfacing and msx so I thought in the Rogo for dc motors and tinkering and something more complex like add a mcu (arduino/esp32) for making something like promised msx-grove cartridge from Nishi

After posting and see the rest of the conversation I apologized and just let the info for someone making the same mistake but maybe interested on these technologies.

Maybe not the best approaches for this topic I know(?) but hopefully useful for someone reading the discussion in the future. From my mistake, your extended answer so winwin.

Cheers!

Page 2/2
1 |