Eurobricks Vassals
  • Content count

  • Joined

  • Last visited

About Kolaf

  1. Automated train -- extended

    This is difficult to achieve, at least the first one if you do not know the speed in advance. Alternatively you could have the deceleration as a function of speed so that the train will always spend the same amount the track decelerating. This is somewhat similar to what I was proposing with the stop signals, except that I use IR signals instead of regular light. You could say that if I disable the 10 second start timer, I would have basically what you describe except that I would manually start the train with the remote control. In order to have the automatic control the trains (something which I also am aiming at) you will also need to sometimes detect which tracks the train is on. For instance, take the setup I show in the video, where the station is on the side track. The control needs know whether the train stopped on the side track, always just passing by on the main track in order to determine whether it is safe to allow a second train in the opposite direction onto the piece of track that is shared. I will either use micro switches on the track or some cheap proximity detectors to achieve this.
  2. Automated train -- extended

    I see what you mean. My engine implements the functionality to accelerate and break smoothly after a control input, but given the speed and size of the setup, the rate of change is to be quite fast in order for the change to be visible. I therefore have a quite high rate of change on my setup now. When the train reached the signal, it will start running again 10 seconds later, i.e. I use a timeout. However, I can override this using the remote control to tell it to stay there longer, or start earlier. The automatic running toggle simply turns the effects of the read codes on or off. If the automatics are turned on, the channel change at speed is based on input from the code, but I can also control that using the remote control to change its speed or stop. If the automatics are turned off, it is only the remote control controlling the train. If not using a timeout or user input, how are you proposing to get the train started again after it has stopped?
  3. Automated train -- extended

    I agree, there are lots of possibilities. Hadn't thought about putting the sensor on the track, and the code on the train. This will be quite complex, so I will stick with the one sensor on the train for now. My immediate future plans involves adding the signals, that combine with an IR led which will cause the train to stop when it approaches a red signal. When the signal turns green, the train will start. Also try to automate the switches and interface them to the computer so that I can control them with a simple UI, which also will be made available on android phone :) Thanks for the YouTube link, I hadn't seen that one. It looks like he's doing something similar, but without a direct relationship to "command words" of a certain bits length. I must admit I'm curious as to how he has implemented it. My main reason for using a regular microcontroller was price, and to a certain extent size. Lego stuff is expensive. In the set up I have now I can turn the automatic control on and off by clicking a button on my remote control. This will determine whether the train reacts to the codes it passes. Furthermore, I can always override the train is doing using the remote control. In that sense I guess I already have combination you hint at. The speed of the control does not have to be very fast, the speed has to be sufficient to detect every state at least two times. This means that every high must be sampled at least two times by the passing sensor. Given the width of one stud and the speed of the train, it should be a simple matter to calculate the minimum speed of your sampling code.
  4. Automated train -- extended

    Interesting. So you mean that I could encode four bits in parallel. I guess I could if I switch to a different sensor than what I'm using now. I'll definitely think about it. But what would you use a large number of commands for? There is stopping, different speeds, sounding the horn, but what else?
  5. Automated train -- extended

    Since the train is based on power functions, there is nothing principally wrong with having multiple trains on the track simultaneously. The trick is stopping them from colliding ;) As I said initially, the train is controlled by a microcontroller connected to a reflex detector mounted underneath the first carriage. It detects the passing of every white, four stud long flat (studless) brick mounted in the middle of the track. The distance between the bricks determines whether a zero or a one is encoded. Currently I use codes that are three bits long, initially supporting eight different commands. However, this is further limited by the fact that every code will be read in both directions depending on the direction of the train. Care must therefore be used when designing the codes and the commands they trigger. Initially, I'm using the coach to slow down and speed up the train as it approaches curves/leaves curves, and passes stations/stopping points. They can also be used for other tasks such as sounding a horn etc. The microcontroller interfaces with the train through a regular motor control and used in electric RC cars. Please free to post some more specific questions if you have them :)
  6. Hello again, It is time for another update in my quest for automating a power functions Lego train layout, but without necessarily using power functions :). This time around I have switched to a smaller circuit board (Arduino mini pro), allowing me to embed almost everything into the new Lego passenger train. It still has a prototype feel that I have too resold on some wires in order to hide them inside the train. Nevertheless, it works brilliantly. Here's what's happening in the video below. I have embedded some codes in the tracks around the station which are read by the reflex detector on the lead carriage on the train. These clothes will cause the train to as it approaches the station, before it stops when reaching the station. The trail then later the station for 10 seconds before it resumes its previous speed. This speed is kept until it passes the code to increase speed which is only upward slope following the station. On the other side of the bookshelf the speed is decreased again to account for the downhill towards the station. When reaching the station the channel against top 10 seconds, before it pulls out in the other direction. This time you will more easily see how it accelerates after passing the acceleration code embedded in the tracks. To summarise, I only start the train, the rest is automatic. Enjoy!
  7. Electify Your Train Switches

    Umm, there isn't really a list of bricks. This was just a proof of concept, I will try to build a better looking solution when I'm back from holidays. With regards to the parts, I'm using a micro servo which is typically found in small model aeroplanes. This is the only non-Lego part. To avoid ruin the servo I had to remove the resistance in the train switch with a pen knife. Then, to make things simple, I just glued the servo to a small Lego plate and built it up to the proper height. In this case I also glued a cog on to the servo because this was what I had lying around. I could also use a regular servo arm which comes with the servo, avoiding the need for the cog wheel. The servo is connected to an arduino microcontroller. Specifically, I'm using the roboduino board, an arduino clone which supports simple connections of servos and stuff. I connect a regular IR receiver bought at my local electronic parts store, and I control these using a regular TV remote control (more precisely my DVD player remote control). The servo I used is called HiTec HS-55.
  8. Electify Your Train Switches

    I forgot to mention that the upside of using servos is that they do not draw much power when stationary, and that they can easily be powered by a microcontroller. This means that I can use a single microcontroller to control all my switches, either programmatically or based on sensor input along the track or my infrared remote control :)
  9. Electify Your Train Switches

    Reading about your modification inspired me to rework my own solution. I exchanged the standard servo I previously used with a micro servo, and removed the internal friction points in the switch. This allowed me to make it quite compact solution. The solution is displayed in the image below, where I have moved a cog onto the servo. I did this for another project, and I do not think it is necessary to do that here, simply use a standard servo arm which fits in between the two pins on the switch control slider. With the appropriate bricks, this could be built into a neat little switch house.
  10. Electify Your Train Switches

    I've done something similar using standard servos . My solution suffered from the same problem as the train I recently posted, it lacked any finesse. I like tohe Solenoid-idea, and I have been keeping my eye out for a smaller version of what you have.
  11. Automated train engine

    I have done some more experimentation, and figured out how to place the code embedded within the track itself. The code will build one or two plates high between the two rails that make up the train track. This means that it is no longer necessary to have the detector poking out of the side of the train, rather it can be mounted within the engine with a view downwards. The downside of this approach is that every code has different meanings depending on which way it is rate, so I would need a longer code (more bits) to come up with a decent system. It is difficult not to run out and buy a new passenger train set straight away to put this into a nicer looking train set :)
  12. Automated train engine

    As I mentioned in my first post, if I have to get either the passenger or cargo train set with the new power functions engine. I could then use a new engine with the accompanying battery box, so that I would only have to fit the microcontroller into the train.
  13. Automated train engine

    Hi all, if I just thought I would share with you one of the baby steps of the train project I'm working on. I'm currently using a very crude Lego model, but I guess this will be improved once I get one of those new PF train sets. This is a prototype Lego train built with a power functions XL engine, a RoboDuino arduino board with an IR receiver and a reflex detector. Through the IR receiver I can control the speed and direction of the train using the remote control for my DVD player. The reflex sensor is used to detect codes embedded in Lego along the track. The code is billed as high and low spots, where the length of the low spots indicates whether a zero or a one is encoded. Two examples in the video are 01 and 10. The first code indicates that the engine should slow down, and the second code is a stop command. Notice how the engine is commanded forward by the remote control. It quickly ramps up to full speed and continues like this until it reaches the first code block. Once the first code block is read, the engine slows down to a more moderate speed. This speed is maintained until the engine reaches the second code (a stop command). Once the code is detected, the engine quickly decelerates to a full stop. This will be expanded in the future, hopefully with less noticeable codes, to support a wider range of different commands. If we combine this with timers, we could get a very dynamic languages able to speed up and slow down, for instance straight and curved tracks, and which also will stop at given points (stations) for some period of time, before it continues. Further extensions of this idea are very welcome. Thanks for watching.
  14. Just starting with Lego trains

    I used a regular TV remote control (a harmony 1 from Logitech). I haven't tried it with the Lego train transmitter, but I guess the same principles would work. I just used a simple ardunio IR library floating around on the web.
  15. MOC: Robot controlled Lego engine

    Thank you both for your enthusiasm. There is nothing mindstorm in it, the distance sensor is something I got from the same store where I bought the Arduino board. Similarly, the IR receiver and everything else is standard electronics, the only Lego thing in the drive system is the motor. Since the video I have tweaked the acceleration and braking functions to look more "real". Even when approaching an obstacle it will emergency brake (which takes 5 to 10 cm), instead of stopping instantly as it does in the video. I need to work some on the design, though. Does anyone have a better idea for the drive train from a power functions motor? It looks quite big at the front there. Also, the design of the boogie is a bit flimsy to be small enough to fit into the body.