maehw Posted February 26, 2024 Posted February 26, 2024 (edited) Hi all, I never had an RCX when I was young back then when the first Mindstorms generation was release (1998), but these days I have got me some hardware to play with. I have this idea of reviving the yellow LEGO Mindstorms RCX brick. I've researched the web and found that most people will either set up a Windows Virtual Machine with an old version and run the original LEGO RIS RCX Code IDE or use a Windows Machine and use Bricx Command Center (BricxCC) and program in NQC. However, there seem to be issues with Windows 64-bit drivers for the LEGO USB IR tower. ("That beautiful communication hub for all RCX1.0, 1.5, 2.0, Scout, Spybotics, MicroScout, CodePilot bricks one is truly dead since 64 bit operating systems have taken over." - @Toastie, 2018) People have been using the LEGO serial IR tower instead or done something on their own (e.g. tinkering with hardware and Arduino code to get their own DIY IR tower working). Tired of setting up those Windows machines? Not all people have the knowledge to hack around with things... or try alternatives like running an NQC compiler from Linux or Mac OS. So.. I came up with the idea of... Programming the 1st generation LEGO Mindstorms RIS (yellow RCX brick) from the webbrowser What follows is a technical block diagram of the toolchain to accomplish this. The idea is to compile NQC code in your webbrowser and to download your compiled code to the RCX where it is executed - without any installation. We may even think out of the box and imagine block based programming with Blockly (you know Scratch? you're familiar with Blockly) and generating NQC code... Of course, there are some technical shenanigans required here, but I have proof that the basic concept is feasible: NQC compiler can be compiled as Web Assembly (WASM). See also: https://github.com/maehw/WebNQC(this should run in every modern browser) The actual relevant bytecode chunks from LEGO's proprietary .rcx file format can be extracted.(thanks to NQC's RCX library; also thanks to LEGO for documenting the opcodes) The bytecode chunks (tasks/subroutines, etc) can be downloaded to the RCX brick using a IR serial tower (infrared serial link). This can be accessed with JavaScript in webbrowsers like Chrome, Edge and Opera (unfortunately not Firefox) using the Web Serial API.(thanks for everybody working on that before, especially also BricxCC which allowed me to sniff on the communication; and also LEGO for documenting the protocol) The WebUSB API is a thing, so we may also get this wokring with the LEGO USB IR tower. I've also worked on a low-cost DIY IR serial tower that consists of a an IR LED, an IR receiver, an 8-bit microcontroller, some current-limiting resistors and two LEDs (power, activity), wires + a breadboard (of course, this could be a tiny PCB) + a USB/TTL UART converter (cable) for around 10 € (see thread on Mastodon, continued there): (No 9V battery required, it can be powered by 5V VCC (and probably alternatively also 3.3V) from the USB/serial converter. And only the default driver for the USB/serial converter. You can probably also use this "hardware frontend" part with your Arduino, Raspberry Pi or other embedded hardware... as it simply connects to a TTL serial/UART) I've so far been able to: Program the firmware (.lgo files in Motorola S-record file format (SREC)) using my DIY IR serial tower with the command line utility firmdl3 (disclaimer: all transfers only work reliably using 2400 baud) Program the firmware using my DIY IR serial tower from the webbrowser (Web Serial API) Remote control the RCX from the the webbrowser (using Web Serial API), like playing sounds, reading ROM/firmware versions, ... - everything is possible Run the NQC compiler in the webbrowser - to compile NQC code (.nqc) into RCX image binary files (.rcx) Download programs using my DIY IR serial tower from the webbrowser (again Web Serial API) This should work platform-dependently... on Windows, Linux, Mac OS.. probably also Android (haven't tried to plug the DIY IR tower via an USB OTG cable). If I see interest in any of this, I might keep working on it - and maybe set up a demo website so that you don't have to compile these things locally and run them on a local webserver (which I guess is the current barrier to entry). This looks very technical and ugly, but could get a nice UI. (Take another peak here, here and here.) Feel free to ask, if you'd like to get more insights. You have hacked around with the LEGO RCX in those last 25 years? I'd be keen to know! If you have any cool RCX projects (.rcx files or .nqc files lying around, model build instructions, sensor reverse engineering, ...) that I should try, let me know! (I also have ideas about "decompiling" old .rcx files into NQC code... and optionally Blockly in turn.) You have other ideas? Sure, share them with me! Edited April 22, 2024 by maehw Added the URL/project name to this post's title Quote
maehw Posted April 14, 2024 Author Posted April 14, 2024 (edited) Hi all, my last post may have been very technical - maybe too technical? I am happy to announce that I've just released version 0.1.0 of the web-based IDE which I called WebPBrick. I'd be happy to see people explore the IDE here: https://webpbrick.com/ide/ As the project is open source, you can also find the source code on GitHub: https://github.com/maehw/WebPBrick README? Try this one: https://github.com/maehw/WebPBrick/blob/main/CHANGELOG.md CHANGELOG? Try this one: https://github.com/maehw/WebPBrick/blob/main/README.md The LEGO Serial IR Tower should work out of the box - unfortunately, I am still having difficulties with the LEGO USB IR Tower. It would be cool if you could help me spread the news about WebPBrick! Cheers Edited April 14, 2024 by maehw Quote
mar11 Posted September 14, 2024 Posted September 14, 2024 (edited) First of all! Many many thanks for what you are doing, I was looking for such easy tool to RCX for a long time. So far I have an issue with connecting to my Serial IR tower(This one that come with 9V battery) I am using 9pin to usb cable adapter to connect it with my computer, but it doesn't work. Do you have any ideas? Will it be possible in near future to connect USB IR Tower as well? Edited September 18, 2024 by mar11 Quote
Toastie Posted September 15, 2024 Posted September 15, 2024 Damit! This thread - as per usual - just drowned in the "Technic" forum. This is simply - bad. Either one pays attention every hour to new entries on this forum - or such entries are simply swamped with TC's, super duper cars, trial trucks, whatever. Man. I need to catch up on this @maehw!!! Thank you very much for sharing! Best wishes, Thorsten Quote
mar11 Posted September 17, 2024 Posted September 17, 2024 (edited) I bought new Serial to USB adapter and now i can connect to WebPBrick. Unfortunately now I can't download firmware as it stops after a few seconds - it always stops at different block number: Connected to serial device (baudrate: 2400).🔗 Communication working, RCX is alive!ℹ️ ROM version: 3.1, Firmware version: 0.0❌️ Firmware version '0.0' indicates that currently no firmware is loaded into RAM. Firmware download request confirmed. 🧮 Firmware size in bytes: 24944 Firmware size exceeds 19 kBytes. Limited checksum calculation to first 19 kBytes. 🧮 Calculated firmware checksum: 0x2F8E 🥾 Entered boot mode.🐌 Began firmware download... 🧱 Calculated 1248 firmware blocks to download.⏳ Successfully downloaded firmware block 1/1248 (0.1 %)⏳ Successfully downloaded firmware block 2/1248 (0.2 %)⏳ Successfully downloaded firmware block 3/1248 (0.2 %)⏳ Successfully downloaded firmware block 4/1248 (0.3 %)⏳ Successfully downloaded firmware block 5/1248 (0.4 %)⏳ Successfully downloaded firmware block 6/1248 (0.5 %)⏳ Successfully downloaded firmware block 7/1248 (0.6 %)⏳ Successfully downloaded firmware block 8/1248 (0.6 %)⏳ Successfully downloaded firmware block 9/1248 (0.7 %)⏳ Successfully downloaded firmware block 10/1248 (0.8 %)⏳ Successfully downloaded firmware block 11/1248 (0.9 %)⏳ Successfully downloaded firmware block 12/1248 (1 %)⏳ Successfully downloaded firmware block 13/1248 (1 %)⏳ Successfully downloaded firmware block 14/1248 (1.1 %)⏳ Successfully downloaded firmware block 15/1248 (1.2 %)⏳ Successfully downloaded firmware block 16/1248 (1.3 %)⏳ Successfully downloaded firmware block 17/1248 (1.4 %)⏳ Successfully downloaded firmware block 18/1248 (1.4 %)⏳ Successfully downloaded firmware block 19/1248 (1.5 %)⏳ Successfully downloaded firmware block 20/1248 (1.6 %)⏳ Successfully downloaded firmware block 21/1248 (1.7 %)⏳ Successfully downloaded firmware block 22/1248 (1.8 %)⏳ Successfully downloaded firmware block 23/1248 (1.8 %)⏳ Successfully downloaded firmware block 24/1248 (1.9 %)⏳ Successfully downloaded firmware block 25/1248 (2 %)⏳ Successfully downloaded firmware block 26/1248 (2.1 %)⏳ Successfully downloaded firmware block 27/1248 (2.2 %)⏳ Successfully downloaded firmware block 28/1248 (2.2 %)⏳ Successfully downloaded firmware block 29/1248 (2.3 %)⏳ Successfully downloaded firmware block 30/1248 (2.4 %)⏳ Successfully downloaded firmware block 31/1248 (2.5 %)❌️ Download error during block #32, retrying... Edited September 18, 2024 by mar11 Quote
maehw Posted September 22, 2024 Author Posted September 22, 2024 (edited) Thanks @Toastie! It seems that I don't have forum post notifications active. Hey @mar11, thanks for trying! Great that you made an attempt and tried WebPBrick! Have you tried to cover the infrared connection (e.g. by a sheet of paper)? I guess that you are in a "noisy" environment regarding light emissions. You can also play around with distance and angles. The mechanism is not very robust at the moment - however there should be a retry mechanism implemented. But maybe that one is not robust enough and should allow for even more retries. Hope to hear from you again. Cheers! Edit: PS: I had little progress with the USB IR tower. IIRC, you can checkout the git repository and try https://github.com/maehw/WebPBrick/blob/main/src/communication/webusb.htm. It seems that I am losing some data here. I need someone to team up with me as it gets pretty tedious and frustrating working alone on it. Edited September 22, 2024 by maehw Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.