Monthly Archives: May 2015

Lego Tracksections

And we are back for the next level! It’s time to divide up the track in sections so we can have a couple trains driving around. I found the blog at Lego.wordpress.com really interesting because it makes use of photosensors. I used microswitches, but they tend not to work really well with a carpet and everything, so I started using LDR’s instead. The result looks a bit likes this:

IMG_3028 IMG_3027 IMG_3026

I used a couple little prints to put the LDR’s on with a 10k Ohm resistor as voltage divider. This works pretty much ok. In the last picture you can see the first attempt of the setup. In the meantime I changed it a little bit, but not too much. The “railplan” looks like this at this point:

LegoTrainSchematic

In short, this is what happens so far:

1. Get the sensor reading

2. Determine the previous sensor (so you know which way your train is going)

3. Set the correct flags so we can call a function to get the trains up and running (e.g. what section will the train in be next?)

4. The function to get the trains running checks for some things. Of course we need to know if the next section to where the train is going will be busy or not. This can later be used to set switches and signposts!

As of this evening the sensors started acting up, but my detection mechanism worked flawlessly. It gives the current position, train number and next section via the Arduino Serial Monitor.

Ah well, more to fiddle around with! Catch you later!

Lego on Arduino

For the past couple days I’ve been working on getting my Lego trains to run via an Arduino (actually, it’s a fake one, but who cares!). On my YouTube channel (link) you can find my first attempt at stopping and starting with ease-in and ease-out. It’s, ofcourse, done with an infrared light, but the track is too big, so I ordered more LED’s from China. Takes a while to get here though …

The next task will be dividing the track into sections so two trains can drive the same track, but stay out of each others hairs and/or pass each other. After that there will be, hopefully, signalposts and automated switches.

The track division is made with old “micro” pushbottons from some alarmclocks. For now this works fine, but I’m planning on using LDR’s instead. The pushbutton methode dates back to about the stoneage, but it still works fine. I’ll be posting a movie about that soon.

B.t.w, you should also check out http://legopal.wordpress.com. Got some inspiration from there. I also Roland Wiersma a lot of thanks for creating the LegoPowerFunctions library for Arduino, found on GitHub. This library works really well!

Cheers!