Sano23 Posted January 14, 2022 Posted January 14, 2022 Hello I control my two trains (bluetooth) with legoino + ESP32 and this works ok. Now I want that every train have their own arduino mini or ESP32 with color and ultrasonic sensor like HC-SR04 for automatic drive. ¿Can I comunicate arduino/esp32 in trains with the first esp32 board that control the trains via bluetooth if this one is controlling the trains via bluetooth + legoino? Thank you Quote
Lok24 Posted January 14, 2022 Posted January 14, 2022 Hi, I think it has nothing to do with legoino. Have a look at ESP-NOW, but it's WiFi Quote
Toastie Posted January 14, 2022 Posted January 14, 2022 8 hours ago, Sano23 said: I control my two trains (bluetooth) with legoino + ESP32 and this works ok. Welcome on EB! Now, this means that as of now you have LEGO hubs on the trains, correct? If so, do you want to 1) replace the LEGO hub with an ESP32 or 2) add the ESP to the train to operate the sensors you are talking about? Best Thorsten Quote
Sano23 Posted January 15, 2022 Author Posted January 15, 2022 Hello Toastie. Now I control the lego train hub with ESP2 and legoino, but I want to put sensors in the trains to become autonomous. My idea is put lego colors pieces on the rails as codes to control the two train velocity and put an ultrasonic sensor to avoid crashes and some sensor in the station to stop the train "x" seconds maybe. I wolud like to know how comunicate all this with my working ESP32. I was thinking to make all comunication via wifi maybe and control the train with bluetooth. PD: I think is option 2. But I will accept any suggestion Quote
Kalindor71 Posted January 15, 2022 Posted January 15, 2022 What I have done is the following, use a powered up hub on the train to control it. Use an ESP32 to control the powered up hubs (I think up to 9 hubs can ben controlled like this). Use reed sensor to detect position/speed and connect those to a separate ESP32 to be able to send the input to the controller. Mattzobricks has all the software needed..... Quote
Lok24 Posted January 15, 2022 Posted January 15, 2022 Hi, that's completety different, @Sano23 wants to add an ESP32 to each train to add sensors. Each train should be autonomous. (Whay should they communicate then?) @Kalindor71 uses 1 ESP to control up to 9 trains, this is what I showed here already. So @Sano23 could you please describe the desired architecure including all(!) HW-components? Interesting question! Quote
Sano23 Posted January 15, 2022 Author Posted January 15, 2022 8 hours ago, Lok24 said: Hi, that's completety different, @Sano23 wants to add an ESP32 to each train to add sensors. Each train should be autonomous. (Whay should they communicate then?) @Kalindor71 uses 1 ESP to control up to 9 trains, this is what I showed here already. So @Sano23 could you please describe the desired architecure including all(!) HW-components? Interesting question! Well it's a bit dificult to concrete my desire architecture Lok24. My son have two new trains from this chirstmas and I've an arduino with bluettoth and ESP32 to make some simple circuits. And this days I found legoino library example navigating from internet. First I think is put a screen info in the station with information and make some servo barriers, but it could be nice that train go in the little circuit I've and stops when found a lego color brick like this video. But when my son put this bricks it posible to have a crach and I think hc-sr04 that I 've from arduino pack I could be nice to avoid it. And here we are with 2 trains, 1 arduino and 1 ESP32 and searching as musch information as I can to build something simple to my son and strat my first project. Thanks Quote
Lok24 Posted January 16, 2022 Posted January 16, 2022 Thanks for explanation. But for stopping a train if there is another train in front you only need to control the second train itself, no need to send command to the leading train? I cannot imagine any scenario why trains should interact with each other. 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.