Bliss
Eurobricks Citizen-
Posts
173 -
Joined
-
Last visited
Content Type
Profiles
Forums
Gallery
Everything posted by Bliss
-
@Toastie, That makes me very happy to know that my Blockly project can help some people realize some dreams :-) I think you did a very good program. It's intuitive and visually tells what it does. You're right about forever loops, a small wait is required to leave the UI some time to manage things I guess... I'll look after that if it could be implicit... But for now, it's the way to do. And actually, your program gave me the idea to add a new comparison block: A block that outputs True if Input number between min and max number which would replace the bunch of <= and >= and the "AND" blocks you merged to achieve this result. You talk about the Control Center CC and got me curious about this... I don't know what it does... So I'm going to read about this equipment. So, do I understand you tested quite a few things with the Lego Blockly? : - You used the installable feature to install the standalone version to work offline? - You used a BT to Serial Converter? Thanks for the good words.
-
Ok, here is a little something new: The Lego Interface B Online Blockly is now Installable on your PC (Windows, Linux, OSX etc). It should run offline, without internet (have not tested it without internet yet). It runs as a standalone app without address bar etc. But to install, you must at least connect to internet once to go to the my blockly page and click on this little icon in the address bar:
-
I think I added in my online Blockly for Lego Interface B all the RCX blocks I had previously implemented in my Python RCX module equivalent. The Input Value block returns a number, not a boolean. I have not done a special "boolean" block for the touch sensor inputs. An input configured as a touch sensor will have the inp value block returning 0 or 1. Then in blocks that needs a true false boolean condition, you can always use a "comparison" block. See the following example: first block configures input 2 as touch sensor.
-
About my problem with the Serial connection, the port with the CH340 adapter was already opened with my other web serial project... So the CH340 adapter is working just great and I manage to use web pbrick IDE to download the program to the RCX successfully. The prolific adapter for some reason gives me problems but anyway, I use it now for the Interface B. It would be neat to have a wait until block but the repeat until empty loop is working very well. That's too bad not much people use RCX anymore cause web Blockly RCX makes programming the yellow brick so much easier and intuitive and time saving! I think Interface B is even less popular now and I feel a bit lonely sometime :-) while developping drivers and IDE for it. Some website are "installable" when you see at the right of the address bar this icon: . This is not the case with @maehw websites and neither with my blockly project. I'll look after what it takes to make a website "installable"... Thanks @maehw for this great peace of work! I will look at your code as I want to have a bottom bar like yours :-)
-
@maehw, I just discovered your work here. That is great! I tried both Blockly NQC and WebPBrick IDE. Is it me or there is no "UNTIL" in the blockly? in NQC, I had the following line: until(Message() == 11 ); . And I do not find a matching block for until. I had to use repeat until which is not the same...
-
While adding RCX communication to the Online Blockly project, I have broken something yesterday for the connection of Lego B but it should be fixed now. So as I said, I am trying to add RCX comm (IR Tower) to the project. It is not to upload programs into the RCX. For this, you still need to use Not Quite C (BricxCC?) or other means. It is only to send basic commands to RCX. This allow interacting betweens multiple Lego B's and RCX's somehow using my Lego Blockly Online UI... For now I did only the Motor commands and Sound and Check if Alive Blocks. I will add more blocks in the next days... The web serial API is more sensitive/picky compared to the pyserial module for python. Python ignores parity errors etc but not the web serial so I had to adjust some timing and even then, I still get parity errors but I ignore them and allow 3 retries (resend the command if no replies detected after parity error.). Communication with the IR hub is only 2400 bauds and is half duplex. It is not the most reliable... But it is working. Example:
-
MQTT is a very popular protocol in IoT world especially smart homes... I find it very relevant even for Lego controllers to allow them to communicate with external world... So while developping "Drivers" for old lego stuff, if it is possible, why not integrate MQTT client as well. I find myself this "add-on" to be great. I have a small PC that runs Home Assistant with MQTT and Node-Red Addons... I could use an IKEA Zigbee button to interact with my lego interface B and RCX through MQTT. So yes, it is relevant for some of us but not mandatory to operate the Lego Bricks. Just an amazing addon that is worth to talk about, at least a little ;-) . And since I'm doing some Javascript for the Online Blockly project, I'm thinking maybe eventually to bring the Lego Interface B JS driver into Node-Red ... But this is another project...
-
Ok, good news. After many trials and gemini/copilot incomplete replies to my request, I managed to have a code to connect to android through an HC-05 BT/serial adapter (As my picture few post behinds). It should still work on the other plateforms like windows, osx, linux as usual with a serial adapter or HC-05 but I had to use some filters in the JS code to allow connections on android with a BT device. So for Android, for the moment, YOU MUST use a HC-05 or alike board. HC-05 uses standard Bluetooth. HM-10 board is a BLE board and should be compatible with Chrome but I think I would need to use another API in my code like WebBluetooth or something like that which I'm not ready for now... IMPORTANT: You must update your Chrome on Android with the latest version. 1- Make sure your Chrome is updated above version 137... 2- Pair your HC-05 Board using the key pass 1234. 3- You must use a TTL to RS232 as shown in my setup few posts before. Connect RX from HC-05 to RX on the TTL/RS232 adapter, and TX to TX... 4- Connect your RS-232 to TTL DB9 to the Interface B. You may need a sex changer. 5- Go in chrome on you android device / tablet and open my blockly page: https://blissca.github.io/lego-blockly/index.html 6- Click connect. It may ask you for permission which you should allow. Then it will show you the HC-05 that you select and connect. I tested on an Android phone, it's working but it would be way better on a tablet.
-
Yes, So, while a WAIT time block would pause the execution of a program and resume after the time as elapsed, the "After time do" block will let the program continue after it starts. (It starts after the program "read" the block indeed) This allow to do sort of multi tasking as shown in my last example.
-
I added new unblocking timers in the Control Category. Unblocking means that it will not block your "Flow" as will do a WAIT Time block. It's very powerful and versatile but you must be carefull, especially when using it in repeat forever loop. Every time you call "After time DO", it creates a new timer instance... The "Named Timer after time do" version allow to name a timer and you can cancel the timer before it reaches its time preset with the Named Timer Cancel Block. Every time you call a same Named Timer block, it restarts at 0 even if not completed a previous call. Examples: This is not in a loop, so it executes the flow from top to bottom and finishes in a fraction of second. This will start a timer 5 sec, and activate output B while out A stays off and finish the program immediately (prints Finished in the status window) After 5sec the program is finished, the Output A will be activated and Output B will turn OFF! In the examples above, you have 2 versions of the program uses a repeat forever loop with a scan time of 0.05 sec. Left program uses the "after time do "block" and the other one uses the Named version. The left one, if you keep pressing touch sensor on Input 1, it will create like 20 different "after time do" instances... The right one, if you keep pressing input 1, it will keep restarting the timer T1, thus, it will start to count the time when you release the touch sensor... So in the DO part of this timer, someone could even think to put another repeat loop and start a separate process... But be carefull... It could generate write faults to the serial as it could try to send commands at the same time... I will implement a command queue for the serial write... will be done in the next update... In the above example, the Output A is flashing on/off (0.5s on, 05s off) while you can use the touch sensor on input 1 to control independantly the output B with a very good responsivness. EDIT: I added even more timer function to help with the Named Timer block (Timer is Done?, Timer is Running? etc) So I updated also the example above). I noticed that if you go on another tab in the same chrome window, the blockly program is not responsive so you must stat in the Lego Blockly tab while executing a program. So it's better to run a program in its own chrome window... (Keep the window maximized as it aslo slow down the program when minimized)
-
@Gunners TekZone, I'm planning to add MQTT Client support to the my Lego interface B Blockly Online version eventually, if it is doable... With MQTT Client, you should be able to exchange data between Interface B Running Blockly in Chrome and Interface B running with ESP32 and Micropython... and any other MQTT enable devices in your smarthome...
-
Rotation sensor for me is quite accurate but has its limits. If you turn too fast, it will loose precision. There are only two bits for the amount of change since last frame... These 2 bits represent the "speed" amount and is used to increment the counter. Increment can be 0, 1, 2, 3. 3 is the max speed. Also, you may have a faulty sensor...
-
@Toastie, thank you. I hope you'll have time to test this and I'm looking forward to read your comments and suggestions too... Why did I start this other Interface B project? @AJB2K3 is working on a standalone version Blockly programming for Lego Interface B and RCX but still need quite some intallation... Did not try his new exe installation package... But I liked the idea and interface. @maehw is designing a web UI to TEST the Interface B that is also a great project since it does only need a Chrome browser. So all this gave me the idea to try to create an ONLINE web programming interface for MULTIPLE Lego Interface B's. The ultimate goals being: No install besides having chrome or edge on your PC, Linux, OSX, Android computer/tablet. And of course having the hardware required. Simple and intuitive programming language for end user. Blockly is hard to beat and I've read that it is even used in Smart Home software like OpenHAB.. And I must admit that I have lots fun dseigning this with the help of AI. I wasn't sure with blockly realy, having played a bit with UIFlow by M5Stack for programming ESP32's, which is blockly based and for serious big project, it might be ugly I think... But the simplicity is unbeatable. Then, after I had the first draft ready, I had great fun trying things in blockly to control my interface B. And the more I add blocks and features, the more I like the Blockly IDE now lol... I have a bunch of ideas to improve and add fonctionalities. Stay tune for more...
-
Well, my mind have seen first a flower but it would have been grey, maybe it would have seen a gear ;-) I made a BIG change for the output port letters haha. (Not that big after some digging). Thanks @Gunners TekZone for "insisting" haha. I also think it is better that way and also, it does not affect at all the possibility to use variables and numbers.
-
That's about it. An Android phone or tablet using wifi to access my Lego Blockly Web Page with chrome and use the BT to RS232 adapter that makes com port available to the phone. The BT to RS232 is plugged to the Interface B. On the web page, then press connect and select the com port from the BT adapter and it will connect to the Interface B. This has to be proven to work on Android. IT IS WORKING ON MY LAPTOP (Win11) that has BT... I will have an android phone to test this Sunday. Can it do Multiples Interface? I guess so if you have multiple BT to RS232 adapter :-)... Here is my DIY BT to RS232 adapter that works with my PCs... You probably have all components except the BT to TTL maybe (HC-05 or alike, this one is a JDY-31-SPP) The RS232 port of the TTL-RS232 adapter goes to the interface B. That eliminates the USB/RS232 adapter plugged to a PC. It make the Interface wireless somehow but the program is still running on a PC, not an ESP32 like the last year project... But I di not test it for very long with my PC and I don't know if this wireless method is reliable...
-
I was being asked on github by @Wapata if this would work on an android phone or tablet... iPhone do not allow webserial :-( So, for Android, I read that it could work with a USB OTG Adapter (On The Go) + Serial USB/RS232 adapter but they also say there are limitations... But google also say that could work better with a Bluetooth to RS232 passthru adapter... I do not have a complete BT / Serial adapter But I found out I ordered in 2023 some BT FTDI board like HC-05, JDY-21 etc... And for the ESP32 project to hook to Interface B, I had to get some TTL to RS-232 adapter... I got some spare too... So I connected the BT / Serial TTL to the TTL - RS232 adapter to make a BT / RS232 adapter and plugged the RS232 port to the Interface B. I opened the Add BT Device on my computer and saw the JDY-21 device and paired it (passkey is 1234 with these little boards). This automatically added Com ports... So in my Blockly page, I click connect, and select the COM Port generated by the BT / Serial board and to my surprised it worked! So I was able to control the Interface B Wireless through BlueTooth! I'm gooing to borrow some old Android phone from my nefew Sunday and let you know if it can work from an android device with chrome and BT...
-
Hello @Gunners TekZone, and thanks for testing. Blockly is very EASY but still need some training :-) I'm using the official Blockly source V12 from google which has been transfered to RaspberryPiFoundation... I do not want to use labeling A, B, C, for outputs because with numbers, it allows to easlily use a variable in a loop. For example: To check of input is off, you can use a NOT in the Logic category. And by the way, on the IF block, there is a small Blue flower like icon on the top left corner., you can click on it and from the window that appear, you can add ELSE and ELSIF to your IF Block. You will also find One Shut Raising and Falling blocks in the Category Control that can make better programming... For example: This program will continuously print input is off while Input 1 is not pressed. It will continuously print input 1 is ON while pressing the touch sensor. This program will print the touch sensor status only once on every change. By the way, You can check the status of the Red Stop button on the interface B using Input 0:
-
Hello, I added some communication error proofing, better Device name re-allocation etc... that should take care of some behaviors observed by @Gunners TekZone. I cannot test multiple Interface B but if a program is running and one device disconnects by itself, it should stop the program, clear the device and let the other good device connected. It should allow you to reconnect a device using the Name that was previously freed up... Let me know. P.S. I also added some multi port output command blocks... https://blissca.github.io/lego-blockly/index.html
-
ESP32 boards have often different FTDI chips that requires different drivers. Sometime I even had to revert to older driver version... So web serial with ESP8266 and ESP32 boards can be painfull sometime. With my interface B, I do not have any serial disconnection from web serial using a very good USB/Serial adapter. (I have another one adapter I bought from local electronic store last year and I did not yet succeeded to maintain a reliable connection with it no matter if it's from the web or not). At the moment, I'm using Win11 on a I7 14e gen small form factor Lenovo Thinkcenter. I have 2 chrome instance with multiple pages opened on each. Everything runs smoothly. But the Idea here is to have an environment easy to use with NO big installation needs and get you up and running with your old interface B project in no time. For me it looks pretty solid but I know I have good hardware (I7 14e gen, Interface B, USB Adapter). So it's reliable for me to have great fun for sure. I do not expect it to be a plateform to make projects that must run 24h/day 365D/year... But if it fails more dans 2 times per hour, it is not acceptable for me either. Now, for multiple interface, the reliability has to be confirmed. Also I wonder if the CPU capability may be a factor... @Gunners TekZone , can you describe the hardware you use (PC CPU, OS version, )? And can you test with 2 interfaces only and see if keeps running for a while without fails?
-
@Gunners TekZone, Thank you for your help testing multiple Interface. We now need to determine if the lost of interface(s) is due to unstable hardware of if it is caused by the limitation of running in a browser window. With only one interface here, I let it run for few hours without problems. I had as I said to disable power saving on the computer of course... the Stop button stops the running program, it does not disconnect. But when you press stop, it tells you in the status window that it does stop the comm. with the Devices... If the comm fails by itself somehow, you have no choice other than press the disconnect all to clean everything and use the connect again. (Disconnect resets the numbering of device name to 1 like LegoB1) The connection must pass though the web serial connect popup window. I will still look if there could be some improvement on this side. But the best is to use healthy interface(s). ALSO Very important, if you use Repeat Until TRUE loop, YOU MUST use a Wait Time inside the loop (generally at the end) like Wait 0.05 sec. Otherwise, you MAY hang the page and communications will eventually fail. (However, I did some output caching to avoid sending same commands consecutively... So this should avoir the com port flooding)
-
Dacta Control Lab Software
Bliss replied to Dazmundo's topic in LEGO Technic, Mindstorms, Model Team and Scale Modeling
Hello all, By the way, just to let you know, I updated the thread: I added a full online Blockly interface for the Lego Interface B (It's suppose to be multiple interfaces but not tested as I do not have 2 Interfaces). You only need a PC Windows, or Linux, or OSX with a chromium browser, USB port(s) with serial adapter and Interface B. NO python, No C++, No special addons, extensions, etc... It's fully working from the browser. I'm looking for a tester that has multiple interfaces to try this online blockly :-) . Thank you! -
I'm starting to have quite some fun programming my Lego Interface B with Blcoky lol. I'm also having lots of fun designing new blocks for more functionalities. So make sure to hard refresh the Lego Blocky web Page (Ctrl-Shift-R on Chrome in windows 11) once in a while to get the changes. Yesterday I added the One Shot Rising and Falling blocks in the Control+Wait Category. And I added the "NOT" block in the Logic Category. Also, I added in the github folder, some examples projects to load in blockly. If you intend to leave your blockly projects running for a while, do not forget to disable your power management or set it to "Performance" (Win 11) because, Power Saving mode de-activates USB ports... There might be some energy saving parameters in the browser as well but might be more important if you run on batteries... Stay tune for more Additions to the Blockly online programming for Lego Interface B (I'll also probably add eventually the RCX communication)
-
Hello all, So here it is, a first draft of an attempt to make my own Online Blockly programming environment for multiple Lego Interface B's. The requirements? Well no need to install any softwares like python etc but you still need: A Windows PC with Internet access (I don't know if this would work on a Mac, but for a Linux, why not?) A Chromium browser latest version (Chrome or Edge, I used Chrome) usb ports available with USB to RS232 adapters (qty depends how many Lego Interface B you want to try at the same time) Link to my Lego-Blockly page Example Projects to download It seems to work well with one Lego Interface. I can't test multiple. So if anyone could report please? Thank you in advance. On the TOP bar, Connect Lego interface B will open the serial port selector and connect. Once connected you should see LegoB1 - Active in the Device Area on the right. If you press again on Connect Lego interface and select another serial port, you should get LegoB2 - active. (NOT TESTED). Also, you have some logs in the Chrome Console Debug console. Use F12 to open Chrome Console. Check "Debug: Log Device Packets" to see all 19 bytes packets read from Lego Interfaces in the Chrome Console. It takes ressources, so do not leave this checked all the time. Save Project Button does not ask for file name. It saves to defaut file name with a number incrementing in your default download folder. Use the Load Project button to Load json file previously saved. I included an Examples folder in my GiHub that you can downloads and "Load". Please Connect you Interface before loading otherwise, the Device Slot in blocks will show No Device Connected... Press Run to execute a flow, Press Stop to end the program (if in a repeat true, this becomes handy) Press Clear to wipe out the Blocky area. It will ask for confirmation. On the Toolbox on the left, the 2 last category are my custom additions (Not part of the Blockly standard toolbox) The few examples I included in my Github should help to understand how it works. To test with 2 Lego Interface B's, once connected, you could load example LegoB_Out_Follow_Inp: And change the 2 Out block for LegoB2. So Touch Sensor on LegoB1 port 1 pressed, should Activate Output 1 (A) on LegoB2 and Deactivate when touch is released. I also implemented an Output Commands Cache that make sure not to send the same command more than once at a time. So in the previous example where an output follow the status of a touch sensor, we can also make the following Flow: Normally, this flow, when the touch sensor is NOT pressed, would send the command OFF to Output 1 (A) every 0.05 sec but the internal code cache the last command to each port so it sends a same command only once through serial. This allow more flexible coding like industrial PLC (Programmable Logic Controller) code with a scan time :-) There is no cache on Reverse command neither on the ON For Time command. Use those with caution if using the PLC type approach. No problem with Wait Until. BE CARREFUL with using repeat while true block, without the Wait until or Wait time Blocks, you will hang the page... This is a first draft as I said, I will probably add some blocks and features. Do not hesitate to report bugs. Special Thanks to Copilot for the Big Help