Bliss Posted Monday at 11:50 PM Author Posted Monday at 11:50 PM @Toastie, Wow, I knew from your other threads and posts that you don't do things halfway and this is no exception. This is a very cool setup as you can easily use USB or BT (HC-05). I'm working on a version based on the Int.A V2, but is uses WebSocket through wifi. It's using an ESP32 to make the bridge between wifi and the Arduino serial. ESP32 (WIFI) here replaces an HC-05 (BT) It still under testing and I'm not sure I will officially release it as the setup is a bit more complex to get a bit more speed and a lot more distance... The setup for the WebSocket Bridge requires: Need Wifi (goes through a wifi router. I guess everybody has wifi at home... I guess it could work with ESP32 in AP mode... I did not test this) Wire RX2, TX2 of ESP32 to TX, RX of arduino... Need nginx sofware on the computer that has blockly (small exe and conf file) Upload the Lego9750_ws sketch (which is almost the same as the v2) into an arduino uno or nano. (This is temporary as I want to adapt so it is the same sketch) Upload a ESP32_WS_Bridge sketch into an ESP32 Wroom (I use mini esp32 devkit) You must edit the sketch to enter your wifi ssid and password before you upload. Once uploaded, use the arduino IDE serial debug to get the IP address of the ESP32 Edit the nginx.conf to put this ip address. Start NGINX. Enter https://127.0.0.1 in chrome to accept security warning and get the welcome to nginx page... In blockly, select Int.A WS and connect... Use the same blocks as for Int.A V2... So as you can see, it's more setup but it's feasible. After many iterations, it's appears to work reliably but it has not been easy. So i might add the files in my github and some instructions but not sure anyone will use it :-) Quote
Gunners TekZone Posted yesterday at 01:07 AM Posted yesterday at 01:07 AM (edited) 6 hours ago, Toastie said: Now I have a BT/USB Int.A interface for LEGO Blockly, which works without Int.A connected - regarding the outputs. I can just carry the lill Uno with me when traveling ;) Input wise, bold switches, as the 4.5V touch sensors work as well (but logic is inverted). Oh wow! Very nice!! Makes me want to build something similar to fit in my current MEGA with display sandwich (it is already three boards thick including MEGA and display), to add in the Blockly BT option, and a nicer Int-A connection with less dupont. As well as just for the fun of building it Alas... First I still need to find a way to merge the MEGA Touch Screen control and Blockly interface code together... And catch up with all the Blockly changes... But all that requires too much thinking So for now I just lurk BTW... I have noticed that both of my Interface-A's only output 3.7 - 3.8vdc (but it is stable even with motors running) regardless of type of AC or DC adapter connected to them. Can others measure their voltage outputs and let me know what they are? Thanks! I am wondering if I need to do some regulator upgrades in both of mine?? Edited yesterday at 03:16 AM by Gunners TekZone Quote
Toastie Posted yesterday at 09:56 AM Posted yesterday at 09:56 AM (edited) @Gunners TekZone Thanks - and yes, the BT connection clears up some mess, particularly when you feed Int.A as well as the Arduino/Mega from the same 9-12 V power supply. That doesn't even violate the strict LEGO philosophy of isolating everything on the Int.A power side incl. GND from the PC power side, as air is rather non-conductive :D Also, the Dupont type connection to 9750 (I am always using when prototyping) is a bit shaky when moving the equipment around. 18 hours ago, Gunners TekZone said: Can others measure their voltage outputs and let me know what they are? Thanks! I am wondering if I need to do some regulator upgrades in both of mine? The circuit diagram of 9750 says "+4V" as feed voltage for the power MOSFETs of the 6 outputs and the permanent 4V output. So I guess 3.7 - 3.8V is fine. My three 9750's are all in the same range as yours on the permanent 4V output. Best Thorsten @Bliss Thank you - well, I am trying to do it as clean as I can, but that does not mean much! 19 hours ago, Bliss said: I'm working on a version based on the Int.A V2, but is uses WebSocket through wifi. It's using an ESP32 to make the bridge between wifi and the Arduino serial. ESP32 (WIFI) here replaces an HC-05 (BT) THAT sounds also really cool! Yes, Wifi seems to be everywhere ... don't the Shelly people use customized ESP32s to use and extend Wifi range at the same time for all their wireless stuff? There are some Shellys (Wifi power plugs) in the house, as the Huawei EMMA controller for our PV system knows how to talk to them. "No sun, no juice" control :D How about using the Arduino "UNO Rev4 WiFi" board with RA4M1 and ESP32-S3 controllers for that purpose? There are also ample of LEDs on the board itself, as shown for example here: https://www.reichelt.com/de/en/shop/product/arduino_uno_rev4_wifi_ra4m1_esp32-s3-353108?country=de&CCTYPE=private&LANGUAGE=en EDIT: And it has BT as well ... All the best Thorsten Edited 17 hours ago by Toastie Quote
Bliss Posted 10 hours ago Author Posted 10 hours ago 19 hours ago, Gunners TekZone said: Alas... First I still need to find a way to merge the MEGA Touch Screen control and Blockly interface code together. Correct me if I'm wrong but your display + mega setup is for testing "Interface A" inputs and outputs only, there is no lego project program running in this setup? This is the setup we see on LVL1 website right? The version 1 of Interface A blockly driver using arduino is using LVL1 arduino code so I guess you could add the necessary code in arduino to support the touch screen but you would need to add some kind of button, on the touch screen maybe, to switch between outputs controlled by the screen or outputs controlled by blockly so they don't fight each other... However, I'm planning to get rid of v1 arduino code and replace it with v2 arduino code which is a totally different code not compatible with LVL1 as it is more like Int.B protocol in v2 version. But it does not mean you cannot integrate the touch screen to v2 arduino code... It just might be less obvious as the original LVL1 touch screen mega program would have to be modified a bit. Both versions are still avail in lego blockly but I encourage every one to start using Int.A v2 and convert their v1 blockly program to v2.... Why did I make a Int.A Arduino v2? It's to try to optimize serial requests... Every time we checked inputs in a loop, it was doing a read request to the arduino... If we check input 6 and 7 in a loop, it was 2 separate read request. In v2 arduino sends a packet with all input states (even output states). Blockly app read continuously in a separate internal routine like Interface B. In v1, LVL1 version is using TEXT commands and it takes few bytes per command. (1 byte for each characters) v2 now uses only byte opCode. Like interface B. I'm not sure it is realy faster and efficient but it feels like it is ;-) Quote
Toastie Posted 4 hours ago Posted 4 hours ago 5 hours ago, Bliss said: I'm not sure it is realy faster and efficient but it feels like it is ;-) I have the same feeling, but did not yet stress test. I shall do that over the weekend - if you leave V1 up until then, that is. Also, I like your V2 Arduino code much better than the V1 version. Regards Thorsten 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.