The Next Station Is... Posted March 22, 2013 Share Posted March 22, 2013 Those following my blog might have noticed my experimentation with the Arduino open-source platform for controlling trains. I haven't actually posted a lot of my more recent developments but I've done quite a bit with it and there's plenty more potential yet. I'm just curious to see how many other people here have experimented with it and what you've been able to achieve? 1 Link to comment
CaptOblivious Posted March 22, 2013 Share Posted March 22, 2013 Perhaps it goes without saying that I certainly have been experimenting with Arduino + model railroading…very keen to see what you have done! 1 Link to comment
sedril Posted March 22, 2013 Share Posted March 22, 2013 I've been trying to build a signal control system using a Raspberry Pi. Now I've got my hardware sorted in terms of what I need, I just have to get it all. I'll make a thread once I've got some actual hardware to show off. I've found a tool called Fritzing which has helped quite a lot - http://fritzing.org . It's let me play around with different designs before going out to get the hardware. Link to comment
cteno4 Posted March 23, 2013 Share Posted March 23, 2013 Was amazed to see the video playback powere of rasbury pi! Quite amazing for $35! Jeff Link to comment
stevenh Posted March 23, 2013 Share Posted March 23, 2013 I haven't touched the Arduino for some months/years, but you can find a little inspiration from the articles here: http://modelrail.otenko.com/arduino 1 Link to comment
sedril Posted March 23, 2013 Share Posted March 23, 2013 Yeah, I almost lost to my Wife's media player project. I've got another one on order! I've found that it's easier to find hardware to interface with the Arduino though. The Pi uses 3.3V GPIO, which makes it a pain to connect to just about anything without a level converter or some sort. Link to comment
The Next Station Is... Posted March 24, 2013 Author Share Posted March 24, 2013 CaptOblivious - I haven't been doing anything too ambitious, especially without a permenant layout! I'm concentrating on wireless multi-track control at the moment. Still in development but hoping to have something nicely assembled by the summer! Sedril - Fritzing is an interesting tool... If I get somewhere near enough to a finished design I may even stick something through their PCB fabrication service. cteno4 - I haven't really explored the Rasbperry Pi yet... The display output does sound interesting... Stevenh - The Otenko blog is an awesome resource and really inspired me to start experimenting with the Arduino. Link to comment
CaptOblivious Posted March 26, 2013 Share Posted March 26, 2013 CaptOblivious - I haven't been doing anything too ambitious, especially without a permenant layout! I'm concentrating on wireless multi-track control at the moment. Still in development but hoping to have something nicely assembled by the summer! Sedril - Fritzing is an interesting tool... If I get somewhere near enough to a finished design I may even stick something through their PCB fabrication service. cteno4 - I haven't really explored the Rasbperry Pi yet... The display output does sound interesting... Stevenh - The Otenko blog is an awesome resource and really inspired me to start experimenting with the Arduino. A permanent layout is hardly a prerequisite for ambition! I don't have one! Link to comment
KenS Posted March 30, 2013 Share Posted March 30, 2013 I'd been planning to build a simple tram controller for an out-and-back line with two trams passing in the middle using an Arduino, a few photodiodes and sensors, and a motor shield. I even bought the parts. But other things have kept me from working on that part of the layout (for a couple of years now). I wrote up my design for this if anyone's interested. But obviously it's never actually been tested. Note that while mine was double-track most of the way, it would actually work nearly identically if the center double-track section wasn't much longer than the center station, and the line was mostly single-track. Link to comment
The Next Station Is... Posted March 31, 2013 Author Share Posted March 31, 2013 A permanent layout is hardly a prerequisite for ambition! I don't have one! CaptOblivious - I've been oblivious (pun intended!) and not noticed that old Railstars link in your signature! The work you've been doing with the OpenLCB/NMRAnet stuff is pretty fascinating and although I'm not at the stage yet of doing anything like that, I'm hoping one day to give the IO:duino a try! I'd been planning to build a simple tram controller for an out-and-back line with two trams passing in the middle using an Arduino, a few photodiodes and sensors, and a motor shield. I even bought the parts. But other things have kept me from working on that part of the layout (for a couple of years now). I wrote up my design for this if anyone's interested. But obviously it's never actually been tested. Note that while mine was double-track most of the way, it would actually work nearly identically if the center double-track section wasn't much longer than the center station, and the line was mostly single-track. KenS - I've had a look and what you were doing is pretty interesting. It'd be great to see it in action if you do get round to completing it. Had you got round to testing the sensors? I've also mulled over current sensing (some motor driver boards have built in current sensing which the Arduino can read) and Tomix's TCS sensors (which will require a purchase and a dissection session!). For those interested, I've attached a photo of my current controller development. A couple of notes - it's directly connected into a motor driver at the moment but has been tested wirelessly (using Xbee-style radios) and I'm planning to make a permanent wireless receiver next. Also, I'm using potentiometers so I can use those nice handles. Finally, it's underpinned in software by an Arudino library that I'm working on for DC control. It's coming along but there's a couple of bits of functionality I want to add in before making it widely available. Link to comment
CaptOblivious Posted April 1, 2013 Share Posted April 1, 2013 Where did you get those knobs!? I must know... Link to comment
Guest Closed Account 1 Posted April 3, 2013 Share Posted April 3, 2013 Out of Pi http://www.cnn.com/2013/04/02/tech/innovation/raspberry-pi-sale/index.html?hpt=hp_c3 Sounds like the start of a whole new computer era. Link to comment
cteno4 Posted April 3, 2013 Share Posted April 3, 2013 It is a very impressive little machine. I got to play with one out at the Monterey bay aquarium last month. Amazing video capabilities for a tiny $35 board! Blew me away! Jeff Link to comment
The Next Station Is... Posted April 5, 2013 Author Share Posted April 5, 2013 Where did you get those knobs!? I must know... Search eBay for "raytheon knob" - there is a US-based seller of surplus parts that stocks them and other similar types. Otherwise, they're near impossible to buy retail; I spent a year (!) looking for a supplier after seeing them in the manufacturer's catalogue. 1 Link to comment
KenS Posted April 6, 2013 Share Posted April 6, 2013 KenS - I've had a look and what you were doing is pretty interesting. It'd be great to see it in action if you do get round to completing it. Had you got round to testing the sensors? I've also mulled over current sensing (some motor driver boards have built in current sensing which the Arduino can read) and Tomix's TCS sensors (which will require a purchase and a dissection session!). No, I never got around to testing anything other than loading the most basic program into the Arduino. I really ought to breadboard up those sensors and see if I can write a simple program to detect them. Current sensing is an interesting idea, although it wouldn't help with my design, since I'm using one motor controller per train, not per track section. Link to comment
KenS Posted April 14, 2013 Share Posted April 14, 2013 So I got inspired to play with my Arduino, but before I got to working on the sensors, I got sidetracked into playing with PWM. The Arduino defaults to 489 Hz PWM, which made my test loco "sing" rather loudly, and annoyed me. I spent the last few days working out how to get "supersonic" PWM out of an Arduino, complicated by the fact that I'd bought a Mega, which is a bit different from the usual ones in the timers it uses. And since I'm going to eventually use an Uno, I actually had to figure it out for both of them. Tonight my bargain-table loco I use for such experiments (go on, burst into flame, see if I care) ran back and forth on a bit of straight track under simple timer control using 32 kHz PWM. Once I've got things a bit more tested and the code cleaned up, I'll post something on my site and include the sketch I used. BTW, I've been using Sparkfun's Ardumoto, which has problems on my Mega because it ends up bent over the USB jack, and sometimes doesn't make good contact. Tonight in Radio Shack, I noticed they're stocking the SEEED motor shield (overpriced, since it's V1 and they're selling it at the V2 price), so I picked one up to play with. It uses different pins, and I think I like the assignments better. The Ardumoto also requires tampering with the timer used by delay if you use it on one of the 32UA Arduinos like the Leonardo, which is another negative for it. Plus the SEEED has a honking big heat sink. Depending on how it works, I may switch to that one. I also found a SEEED relay shield at the Shack, which is going to be my block power switching controller for the tram line. I'd though I was going to have to prototype my own (I'm quite happy to leave the electrical circuit design to someone else on this project). Next Station, you didn't (as far as I can see) say which motor shield you are using. It looks similar to the SEED, but not quite identical to mine. What is it? 1 Link to comment
KenS Posted April 15, 2013 Share Posted April 15, 2013 I've posted about my experiences so far on my site, along with the current version of my Arduino sketch (scroll to bottom of post), which is working with both the Ardumoto and seeed motor shields on my Mega, but otherwise untested. 1 Link to comment
KenS Posted May 4, 2013 Share Posted May 4, 2013 In case anyone's interested (and the lack of other posts here makes me wonder), I've managed to get my Arduino sketch for reading IR photodetectors working. There's a post on my site about it, and a couple of pages with additional detail, including a link to the program. The IR phototransistor/LED combination I'm using seems to work quite well. Although the detectors do pick up room light, the amount of change from an object blocking the LED seems to be easily distinguished from changes in the ambient light (it helps that both LED and detector have lenses to focus them on each other). I haven't yet set it up with a train to see how well it works as part of a control system, but I'll be getting to that. Link to comment
KenS Posted May 15, 2013 Share Posted May 15, 2013 I now have my code working to the point where I made a simple DC "power pack" using an Arduino and a motor shield, along with a potentiometer and three switches. It's still not automated or using the sensors, but it's most of the functionality I need. And it was really cool to see it in action after all that work. There's a post on my site about it. And I put the code for my motor-control library (not the sensor code, as that will ultimately go in the sketch that uses the library), along with the example program (simple_throttle) up on a github repository in case anyone else wants to play with it. One warning: I appear to have fried one motor shield in the course of things. I don't know if it was something I did, or a design flaw or what, but my seeed studios V2 shield is now an expensive paperweight. My ardumoto shield seems to be working just fine though. I'd advise treating this library as experimental, and not trusting an expensive model to it at this time. 1 Link to comment
Glenocon Posted September 5, 2013 Share Posted September 5, 2013 http://m.youtube.com/watch?feature=c4-feed-u&v=WwHUSB792VI My Audrino which aim going to use to control my Kato point motors. The next step is to get the motor driver chip and build the board. This basic setup will drive at least 6 point motors and can expand to do the hole layout salt lake route using Kato track kit. The layout was only started to be build in August 2013. Please contact me if you need any help with this. 1 Link to comment
KenS Posted September 7, 2013 Share Posted September 7, 2013 Thanks for the pointer to the MynaBay DCC library, that's likely to be useful (not for my current project, but I can think of a number of things I could do with it and an Arduino Pro Mini). Link to comment
KenS Posted September 28, 2013 Share Posted September 28, 2013 (edited) I've been continuing to play with my Arduino, spending the last few weeks getting "charlieplexed" LEDs (tri-state logic multiplexing) to work. Along the way I got curious about how these would look on video, thinking that timing that was right for the human eye to blend the pulses so that the LED looks like it's continuously lit wouldn't work the same for a camera's shutter. And, indeed, it does not. What's really interesting is that some speeds below the "safe" threshold showed problems as well (but others did not). I'm suspecting that there's some kind of interaction between multiples of the pulse frequency and the shutter frequency creating a "beat" that causes the LED to be missed periodically, and that in turn creates an appearance of pulsation. I also discovered that video cameras do a terrible job of defining their shutter speed. 60 fps is supposed to mean a shutter speed of 1/120-second or faster (due to arcane reasons relating to film shutters), but that *everyone knows* online wisdom is just plain wrong. My Sony camcorder seems to have a shutter speed around 1/60-second at 60 fps (which, in hindsight, makes a fair bit of sense). Anyway, I took a bunch of the video I'd shot in testing this, and assembled a short demo showing how those problems occur. It's eventually going in a blog post I haven't written yet, once I get a bit more done on the software so I can publish the code with it, but I thought I'd share it here too. What this is doing is driving 12 LEDs arranged as 6 pair of red/green LEDs (emulating two-lamp signals). Each "signal" is lit red to start, and I cycle through the six, turning one at a time green, just so you can see it's working. But underneath all that, I'm actually lighting only two LEDs at a time, diving the 12 LEDs into three banks of two pair each. Each bank is on just long enough for 3x that time to fit my "cycle speed". For the human eye, this would look fine for cycle speeds under 20 msec or so (I can see problems at 25 msec myself). But for the camera, it's seeing problems down as low as a bit above 8 msec depending on the shutter speed, and at a couple of speeds below that (the "beat" frequencies I mentioned). Note: Youtube's compression makes some of the fainter pulsing behavior hard to see. Which I guess is a win since my video only gets seen online, and thus I don't need to worry about a small amount being present. Also, the circuitry seen contains more than just the LEDs. It's my current test-bed for my tram controller, with IR sensors and some controls, as well as the signal LEDs. The breadboard in the back with the LEDs on it contains all of the LED-control circuitry (12 LEDs, a bunch of resistors, and a whole lot of wire. The circuit diagram is attached. Update: my blog post is up, with the program for the arduino linked at the end. It's a simple demo (the one used in the video to cycle through the LEDs) that shows the basic code I'm planning for my Tram Controller project, and reports a number of interesting timings so I can try things out and see how they affect that. I think that code's done now, and I'm about to copy it back to the under-development Tram Controller program. Edited September 29, 2013 by KenS Link to comment
NJHA Posted April 6, 2014 Share Posted April 6, 2014 Bringing an old thread back to life... Reason? Well, i want to experiment with arduino and DCC. What is my idea: 1-Develop a DCC station with a screen to control trains and turnouts (i want an equipment that i can extend if needed, just by adding another power source for instance). 2-Equip such station with an ethernet/wifi module, so that i can use a computer to control the trains. 3-Develop a throttle, that i can use with conjunction with the station. 4-Develop a wireless module so that i can control trains using a mobile phone. A pretty ambitious project, that will also serve as a supporting project for my ongoing PhD thesis. My problems are: 1- I have never worked with arduinos before, have a rough idea on what are they, but nothing else. 2- I have some knowledge on DCC but i need more in-depth information. Where can i find the standards on DCC? NMRA? other source? That is all for now. Link to comment
kvp Posted April 6, 2014 Share Posted April 6, 2014 Arduinos are based on small microcontrollers but have a very programmer friendy development environment and a c like programming language. Basic functionality of the controller is digital input and output, analog input and digital pwm output. This is enough to connect a couple of throttles, provide output for a booster and handle communication with a pc. Most arduinos are not really strong enough to drive a large lcd, but there are lcd modules that can be controlled though some form of serial communication. A simple throttle can be made from a few buttons, a few leds and a potmeter. There are wifi modules for arduinos too. In your case, i would put the high level logic, handling the screen and network communication into an embedded pc and use the arduino (connected to the pc through usb) for low level i/o only. It's easier because all real time jobs (throttle i/o and DCC packet transmission) can be handled by the arduino, while the gui and network can be handled by the pc's os, which is much easier and can be built faster than doing everything on the arduino. Between the arduino and the tracks, you will need a booster that can take digital TTL level signals from the arduino and output a strong enough DCC singal. You can use multiple boosters if you want to separate track and accessories power. If you want to make a booster yourself, afaik there are plans for this on the webpage of the open dcc project. For DCC protocol info, NMRA and the web is a good starting point. Generally it's a serial protocol with a special framing and variable bit length (a form of pulse width modulation). All commands start with a bit sequence, followed by an address byte, then some data bytes and end with a checksum. Link to comment
NJHA Posted April 6, 2014 Share Posted April 6, 2014 Thanks for the input kvp. I don't think i will use embedded pc's. I want to use standard, off-the-shelf, easy to get components. Price factor is also a concern and price tag for an embedded pc is quite high (about 10x higher than an arduino). Like i said i am not familiar with arduinos, so i know nothing about their processing power/capabilities. I have seen from the arduino site that there are a lot of shields that can be used with them, acting like a kind of add-on. I think i will try first with just one arduino. I see they have low memory (32Kb), but one can use micro-SD cards in them, so space wont be an issue i hope. If i see that the load is too much for just one to handle, i think i will take your advice and do some load balancing. If needed i can set one up for communication and gui control and another one for DCC control. Got to test it first. I'm signing up for trouble :) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now