Jump to content

Venderwel

Eurobricks Vassals
  • Posts

    46
  • Joined

  • Last visited

Everything posted by Venderwel

  1. So I somehow managed to merge the Leguino Lego Train PU sketch with ALT's (Arduino Lego Train) lightsensor sketch. And it's working! Not perfect yet, looks like the lightsensor detection is not working as well as I hoped, already mentioned by @aawsum. But besides that the sketch does what I meant it to do.
  2. Well....I'll give it a go anyway, I have those now! And I'll probably learn something from it. But thanx for telling! Now I know that if it doesn't work, it doesn't havet to be me....
  3. That's where I got the idea for the lightsensors from...? Thanx for the offer, I'll probably contact you soon, since I have no experience, so I need examples I can turn into my own. ☺️ Am going to use old 9v engines for the switches. Cheaper then pf or pu engines. And I can cut the wires in half and connect those to the L298. Okay so no 12v.....I'm going to find myself a 9v powersupply then. Maybe a Lego one!
  4. I bought these motor controllers https://www.amazon.nl/gp/aw/d/B081JXSXJ1/ref=ppx_yo_mob_b_track_package_o0_img?ie=UTF8&psc=1. Why 12v? Because I have some 12v power supplies laying around. ? Light sensors: I expect the room to provide enough light to notice that a train is passing by. Good point about the individual cars though! I'll take that in mind! I have little coding experience. I am used to reading and understanding code. I can copy code from other projects and adjust to my benefit. Still there will be enough to learn yes. I will use Arduino on the ESP32 and yes I hope to find out I can control the trains with bt too with. Or otherwise through an other program on pc....much to find out. But that makes it fun! (And probably frustrating sometimes! )
  5. Arduino Lego Trains uses 12v to power the L298 motor controllers.....
  6. Got a whole bunch of male-male, female-female and female-male wires on the way.
  7. That reminds me, I still need to pick up breadboard somewhere, Forgot to order that one. See the Noob I am, I didn't even notice the documentation yet!! And have no idea yet what all that means.
  8. I ordered this one, I hope it's any good. https://www.az-delivery.de/nl/products/esp32-developmentboard
  9. Ha, I may not have been clear on that. No. Noting goes on the trains, they are Powered Up hubs, they have Bluetooth, I can connect with that and hopefully find out how to control them in my script. The ESP32 will be the center control in the layout. The light sensors will be connected to it, so they will detect were there is/was a train on that piece of track. I want to use them to make sections. The l298 will also be connected to the ESP32, and they will run the engines that will operate my track switches. Let's say section one is connected with a switch to section two and three....Train A arrives in section one and I want it to go to section two and stop there. The sensor in section one detects a train and the program flips the switch to turn to section 2. The sensor in section two notices the train and the program stops the train. The sensor in section one notices an other train, but Train A is still in section two, so to avoid a collision, the program switches the track to section three and everybody is happy.
  10. I don't have a HC05 yet...and probably not going to, since I decided to buy an ESP32 instead of an Android Mega. Okay, so have to see where I find a decent 9v power source. So after the advice of you guys what did I buy: 1 38 pin ESP32 board with WiFi and Bluetooth on board. To control everything. 2 L298n modules to control 4 9v motors, for as many track switches. 6 (or more) lm393 lightsensetive optical sensors for train detection. And a bunch of cable stuff, waiting for it to come in, so I can start.
  11. The 12v is to power the L298n modules. At least that is what I read everywhere. As I read it, the L298n converts it to 9v for powering the connected 9v motors that I use for the trackswitches. I'll use lightsensors that run on 3,3-5v to detect a train passing by. Can I use connect ground pins of multiple sensors to one ground pin on the board? Same question goes for the 3,3v connections.
  12. And why PF??? I already have the Powered Up trains. Already have the tracks smart megablocks!
  13. There you have a good point! For a motor I need 2 digital ports and a pwn port. 4 motors make 8 digital ports and 4 pwn These LM393 need Analog output, or can I put those on digital too? Need at least 6 of those. So if I can put these on digital I only need 14 digital and 4 pwn for the moment. And I recon I can put multiple ground and 5v together right?
  14. Oh no problem, English is not my native language either. ESP32 is a board on it's own right? So no need of the arduino mega 2560 board anymore then. Is there an ESP32 with as many ports as the mega?
  15. Am I using an ESP32?? Or do you mean I better use one?
  16. Hello everybody, I'm starting this topic because I want to start automating my Lego Train layout. I am new to this so I have questions you might have the answer to and with that I hope this topic will help other newbies in the future. For starting off I'm thinking of buying: 1 arduino mega 2560. To control everything. 2 L298n modules to control 4 pf motors, for as many track switches. 6 (or more) lm393 lightsensetive optical sensors for train detection. 1 HC05 bluetooth module for communication with bluetooth devices. I think I am all set for hardware. Maybe a 12v powerline to power the L298n's. I have two powered up trains, which I hope to be able to control with the arduino too, didn't find anything about it yet (didn't look hard either though). Is this the right way to go Or do I miss something? Thank for you help.
  17. How much time does it take for the train to drive between end sections sensors? And what is your sensor cool down period. Might be in there.
  18. I am working on a Wikidot page for BAP. http://tbap.wikidot.com/ Anyone cares to help me with it?
  19. Did you configure your the hub of your Train? and set engine to port A?
  20. I know that is why the project works with the distance sensor, but it would be nice if both would be possible, let the user decide what type they want to use: Wanna use color sensor? Okay, use type 2 of self driving module, but beaware..... You want to use distance sensor? Use type 1 of self driving module...etc I'm not sure how @Cosmik42 thinks about it, or other frequent posters (like @Lok24) in this topic, but maybe it's a good idea to start a BAP wiki? I'm willing to volunteer in that, though I never made/started a wiki. But I think it can be very useful to have manuals there and code examples.
  21. I don't think it has to be that hard. You should start bij giving a section the possibility of an end and start switch and also give each section the possibility of a start and end section. In this example, let's say section 0 is the halve circle on the left and we number our sections clockwise: - Section 0: Starts with switch: 4l, 5r, Ends with switch: 1l, 2r - Section 1: Previous section: 0, Next Section: 3 - Section 2: Previous section: 0, Next Section: 3 - Section 3: Starts with switch: 1l, 2r, Ends with switch: 4l, 5r - Section 4: Previous section: 3, Next Section: 0 - Section 5: Previous section: 3, Next Section: 0 Now when a train goes counter clockwise, the program can take these settings and simply turn everything around. In start position you have to configure your train and tell in which section it starts and which direction. I'm not sure if you can make the program detect a turning loop (easy when 1 section is connected left and right to a switch, more difficult when there are multiple sections in the loop) but if you can, you might want to switch status from clockwise to counter clockwise while the train is in the turning loop. I think it's easier too when you know in which section which train is and therefor you can keep history. Yellow train is in section 1 now and was in section 0 before this? Then it's going clockwise. Red train is in section 4 and was in section 0 before? Then it's going counter clockwise. And that needs a decision who is to enter section 3 first. ;-) Keeping track of history of the train is easier with colordetection in sections I guess. I hope you find time to implement the colordetection on sections in the self driving module anyway, maybe let people choose between the 2 options in the program.
  22. Hi people! Finaly got my (88007) color sensors and build them into my 2 trains. Tested them with the PU app, they work like a charm, missing a color tile once in 20 times?? Not sure about that, but not very often. Now I am ready to go to use BAP and the self driving module! Oh heck....the self driving module works with sensors for each section, not with sensors in trains and colorplated sections! Help!!! I don't know how to code from scratch! I do know how to read code and adjust it here and there though. Currently I have a testing track layout with basically two turning loops, connected by a piece of single track, The 2 switches will be automated by an Sbrick in the future, but are not there yet so the switches now work as dummies to split up the track. I'm using red tiles to mark sections and white tiles to stop the trains at stations. I'd like to automate the trains so they ride from section to section, stop for a few seconds at stations and ofcourse won't colide while doing that! Does anyone have a good and complete example (some good comments in it would be helpful!) how to automate my two trains?
×
×
  • Create New...