Jump to content

Kolaf

Eurobricks Vassals
  • Posts

    24
  • Joined

  • Last visited

Everything posted by Kolaf

  1. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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.
  16. Hi all, It has been awhile since last time, but I have now completed my first prototype experimental Lego train engine (which is evidenced by its design). I have filmed it going one round on my kitchen tables and uploaded to YouTube. Below I have pasted in the text from the video description on youtube which describes what you see. I apologise for the bumpy filming, but I had to fight my three-year-old for control of the tables and train :) Begin pasted text: This is a prototype research Lego engine. It's powered by a Lego power functions XL motor which again is powered by six rechargeable AA batteries (divided into two battery holders for maximum flexibility). The control is provided by an Arduino board (Roboduino), with input from an IR receiver and a distance sensor. Interface between the board and the engine is a regular electronic speed controler. Using the Harmony one remote control I can control the target speed, and the train will smoothly accelerate up to the target speed in either direction (the acceleration is perhaps a bit slow for now). When encountering an obstacle on the track (like an illegally parked police car in this demo) the engine will emergency brake, and standstill until the obstacle has been removed. Once the track is again clear it will automatically accelerate up to the previously set target speed. Once the train approaches the railway station I can command the engine to stop using the remote control, and it will smoothly decelerate to a standing position. This is the first step towards automating the Lego train. Eventually it should be able to detect train stations and curves to automatically adjust its speed/stop for a period of time. Hope you like it.
  17. What kind of robot have you made? Yes, I have started on a prototype engine. I have hooked a power functions XL motor through an ESC, together with an IR receiver and a distance sensor. I am able to control the train with my regular TV remote control, and the train slows down automatically when approaching obstacles across the track. When the obstacle is less than 5 cm away the train stops completely :) I am working on refining the software, and also adding additional sensors to allow for more autonomous operation. Will get back with pictures and video later.
  18. I guess you could put it that way, although I'm not sure how numbers are encoded in barcodes. The encoding I plan to use is similar to what is used in IR codes. Each "high" (H) delimits a series of lows (L). The length of lows determines whether a 0 (LLL) or 1 (LL) is encoded. For example, HLLHLLHLLLHLLH translates to 1101. Since the train travels at varying speeds and we know the length of each high, we can use this to calibrate and correctly determine the length of the low assuming that the rates of the change in speed of the train is slow compared to the length of the low portions of the code. This can then be used to have the train stop at stations, decelerates realistically toward stations, slow down in curves or downhill, and even differentiate between stations. With regards to the layout, it is currently on my dining room table so drilling holes is out of the question. I'm planning on building a separate table so I will have to wait until then to get everything perfect :-)
  19. Thanks! I'm sorry to disappoint you, but the remote control is an Infrared remote control (Logitech Harmony one), and not RF. Interfacing the IR to the microcontroller was quite simple, and as I already have the transmitter the solution turned out quite cheap. I believe an RF solution would be more expensive/complex. Anyway, I have found that the reach and sensitivity of the IR system is not bad, I can point my remote control in the opposite direction and signals are still received by the controller. For what I am planning a simple RC car system will not afford minimal out of control I want to have from the system, e.g. running multiple switches, signal lights, and also various functions on the engine itself when I get that far. The board is preassembled, I do not have the patience to solder such small things :-/. I bought it from Trossen Robotics and they shipped it and some more stuff to me in Norway.
  20. Nice, it's a much cleaner design than my own. The problem is, as I have stated previously, that I am inexperienced with building things that look nice from scratch. This can be exemplified by a couple of pictures that are included here of the silo that comes with a farm set. I have automated the unloading mechanism in it with a servo controlled by my remote control. In the first picture the mechanism is bare, and in the second picture I have tried to cover it up. As you can clearly see I have not done a good job. Do You guys perhaps have any ideas/suggestions as to how this can be achieved in a more elegant manner? This third picture is of the mechanism I plan to use to encodecommands along the tracks to be read by my automatic locomotive. The strip of Lego can encode one of 15 different commands that will be read by the locomotive using the small black sensor in the picture. Finally, I have included a short video of my entire setup as it is now. There is one remote controlled switch, the remote controlled self unloading silo, and finally train crossing with updated software. There are still a few bugs in this video which have been ironed out in later versions. Please, if anyone has suggestions on how this can be beautified, e.g. making it look like Lego and hiding the cables I would be grateful.
  21. I completely agree, things would look much better in the Lego style. The problem with Lego mindstorms is that it is much more expensive than buying cheap servos. I am working on addressing things up and hiding cables, and I will show you more details once everything is completed. My problem is that I am more into the technical stuff them into Lego building (although I like that as well), so all the technical stuff is done first regardless of the cosmetics :-/
  22. The next chapter in my Lego prototyping quest has completed. I have created an automatic train crossing using two sensors, two servos, and an Arduino board. There is one sensor at either end of the crossing which can detect when a train passes. As soon as either of them detect the train the gates are closed. The gates remain closed until the sensor the other side first has detected the train as it passes and then no longer detects any trains. In this way the gates remain closed until the entire train has passed regardless of the number of cars and the speed of the train. Once I get longer leads I can place the sensors farther away from the crossing and thus slow the speed of the gates. I apologise for the very crude design, but given time bubble builds everything into neat Lego constructions which hides everything from sight. Also, the servos I use are a bit old, which is why things seem to shake. These will be replaced by new ones later on. The video is included below:
  23. Thanks for your reply. The reason for using IR is that it is cheap and easy to implement. I believe RF receivers are more expensive, and I do not have a suitable RF transmitter, but I have a suitable IR transmitter. The board is quite expensive, about $50. There are cheaper alternatives, the stock Arduino board runs about $25-$30, but the great thing about the Roboduino board is that it is designed for easy connecting servos and sensors without having to have an additional breadboard or something. Using solenoids is a great tip, they seem to require less space allowing a more compact design, I just have to figure out what they are called in Norwegian to find them in a Norwegian store :) The challenge with the Lego trains switches is that the power required to switch between the two positions is quite high. If it were possible to modify this to remove the "threshold" you have to overcome to move to switch it would be easier to design a small actuator to control it. For the cargo I was thinking about building a container car and have some sort of rail on top to move a crane to and fro. Your suggestion is obviously easier to implement, and would probably look more realistic.
  24. Hi, I am new to Lego trains, I just received the cargo train set for Christmas. I have always wanted to play with robotics, and this has been the perfect opportunity to meet for starting this. Plan is to automate both the track and the train itself. I will use one microcontroller for the track, controlling switches, lights, train crossings etc, and a second microcontroller on the engine to take care of driving. Everything will be controlled by my infrared remote (Logitech Harmony one) and additional sensor input. This is a long-term project, but I have made a first stab at creating a automatic Lego train switch. A video of the working setup is embedded below. this is of course just a beginning, I need to build a full switching house around this in order to make it look even remotely authentic. I appreciate feedback/ideas on how to improve the design, it is not yet very stable (the connection between the servo and the switch toggle). I expect to have further updates as I progress, but don't be impatient. My largest challenge will be to build/modify an engine to house the batteries, sensors, Lego Power functions XL engine, and the microcontroller. The plan is as follows: -- automatic switches -- (automatic) signal lights -- automatic track crossing with automatic booms, lights, and everything -- more? For the engine: -- build engine to house Power functions XL motor, batteries, a few servos, and the microcontroller -- control the train motion using my remote control -- add a forward sensor to stop the train when the track is obstructed -- add a sensor which can read instructions embedded alongside the track (e.g. increase speed, decrease speed, "train stop in 40 cm" to have a realistic slowdown to a station, etc). -- The ability to switch between manual and automatic control -- stop and start automatically on red and green lights, maybe even emergency brake on red lights and obstructed track even in manual mode -- more? A self loading/unloading cargo car, the details of this are unclear yet. I would really appreciate ideas/comments to the above list :) Merry Christmas to all, Frank
×
×
  • Create New...