xboxtravis7992 I have been given an Arduino Genuino Uno/Romeo board from a university class to use in my school work. I have been wondering were I will use it in the model railroad after the class is done, and this thread is giving me some ideas. ;) I am not a fan though of the C based language the Arduino uses, since it is a bit more complex than some other languages. Still, I can't see anything more than some loops and if/else statements really needed for any model railroad application. The real trick will be wiring it to what ever it is going to be used for!
I have been given an Arduino Genuino Uno/Romeo board from a university class to use in my school work. I have been wondering were I will use it in the model railroad after the class is done, and this thread is giving me some ideas. ;) I am not a fan though of the C based language the Arduino uses, since it is a bit more complex than some other languages. Still, I can't see anything more than some loops and if/else statements really needed for any model railroad application. The real trick will be wiring it to what ever it is going to be used for!
I received one a few years ago the same way, and it's awesome to see so many imaginative uses for this thing in the model railroading community. My layout has relatively few electrical needs in its current form (DC wiring, a few LEDs) and this is certainly not using the Arduino anywhere near its full potential, but as someone rather sensitive to buzzing sounds, one of the pleasant surprises for me was discovering the PWM output frequency could be set above hearing range, at about 30kHz. This eliminated electrical hum that I've encountered with every other throttle I've used. There may be systems that do this automatically, I'm not sure, but there was something very satisfying about figuring that out for myself and enacting it.
Phil
Ok, That works! Working on a new Arduino application. Hope to share it soon. At least I know I can post images from FLICKR and not have to pay the Photobucket "ransom".
Set up a FLICKR account. Not straight forward about how to post URL in a forum but I think this may work. Reposting the missing circuit diagram from my crossing logic application.
The whole point is it's far cheaper than a throttle. If you run trains, why would you be so opposed to installing a perfectly safe and tested app on your phone?
And generally it's an alternative option, not the ONLY way to run trains. But visitors are more likely to have a smartphone than a particualr brand DCC throttle.
--Randy
Modeling the Reading Railroad in the 1950's
Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.
dehusman fieryturbo There is no configuration on WiThrottle. You connect to the wireless network the railroad is on, and it broadcasts what locomotives are configured in JMRI. You can also store your personal locomotive IDs in the application - i.e. you can take your phone to any layout that has JMRI and use it. the SRCP based controller is the same, without the convenient broadcast of what locos are part of the layout. The rub is that for me to operate on YOUR railroad, I have to put WiThrottle on MY phone. If I don't have WiThrottle on my phone I can't operate on your layout. The interchangeability assumes that everybody will have WiThrottle as an app on their phone. If your guests don't have a smart phone, don't wish to put the app on their phone or don't have enough battery on their phone then you would have to provide phones for them to use. For example I don't have WiThrottle on my phone so if I came to your layout, I would not be able to operate using my phone.
fieryturbo There is no configuration on WiThrottle. You connect to the wireless network the railroad is on, and it broadcasts what locomotives are configured in JMRI. You can also store your personal locomotive IDs in the application - i.e. you can take your phone to any layout that has JMRI and use it. the SRCP based controller is the same, without the convenient broadcast of what locos are part of the layout.
The rub is that for me to operate on YOUR railroad, I have to put WiThrottle on MY phone. If I don't have WiThrottle on my phone I can't operate on your layout. The interchangeability assumes that everybody will have WiThrottle as an app on their phone. If your guests don't have a smart phone, don't wish to put the app on their phone or don't have enough battery on their phone then you would have to provide phones for them to use.
For example I don't have WiThrottle on my phone so if I came to your layout, I would not be able to operate using my phone.
I went the WiThrottle/cell phone route for guests to use. They use mine, cost me $7.50 each from WalMart, delivered. If someone drops it & breaks it no big deal.
Just don't activate the phone service. Any incoming calls (such as a wrong number calling you) will most likely disconnect the phone from WiThrottle.
DigitalGriffin I'm sure if you ask nice enough one of us might put together a program for you and show you how to hook it up.
Thanks Don. I need to find out about it first, so maybe I'll check out what NYCModel has posted. Once I figure out what type of a project to use it on, I'll have things narrowed down a little.
I have no road crossings, to need crossing signals, and the 8 track signals I have are powered with an MRC power pack, and control with rotary switches, so I'm not sure what I would even do with Arduinos.
Mike.
My You Tube
There are many different microcontrollers or other programmable devices that could be used for MRR applications. The Arduino Uno and similar products were designed to lower the barriers to entry for people without an electrical engineering background. The boards are relatively inexpensive and already set up with the interface circuitry needed for quick and easy prototyping with different LEDs, motors, sensors, etc. Programming one doesn't require special hardware other than a computer and a USB cable. The language syntax is relatively simple to learn and there are many free libraries available that make specific tasks easier.
There are certainly less expensive and more powerful/versatile microcontrollers to be had, but not without added complexity. It's not as compact as other microcontrollers and it's set up for breadboarding rather than for deployment.Not MRR-related (still no room for a layout at my place) but I used one in an art project with speed-controllable motorized elements and selectable multi-colored and patterned LED lighting controlled via smartphone over Bluetooth. Assembling and painting the wooden frame for the artwork took longer to finish than wiring up the circuitry and programming the computer did. Bob
Perhaps my description of using an Arduino to control my crossing gates and flashers was a case of jumping off of the deep end and it may have scared some people off. Since I had experience with programming and electronics I was comfortable with the complexity of the project as a starting point to Arduino applications. Having said that, I too started out initially with a beginners kit produced by the Arduino folks. https://store.arduino.cc/usa/arduino-starter-kit
BTW, shop around as you can find these kits at a cheaper price. Besides containing an Arduino Uno, breadboard and loads of parts it includes a corresponding "Arduino Projects Book". This book starts from the ground up and describes how to connect and code for all of the parts included.
Yeah, the Photobucket debacle has rendered my project images and diagrams unreachable. I need to set up a Flickr account.
mbinsewi graymatter Oh and another Dummies book for the library. Maybe that's where I should start. I do have another situation, in the not too distance future, the lay out I have in this house will more than likely be my last lay out in this house. Cap Cod style, to many stairs. So, I'm not sure what I need to know about Arduinos, except things I don't understand, interest me. Mike.
graymatter Oh and another Dummies book for the library.
Maybe that's where I should start.
I do have another situation, in the not too distance future, the lay out I have in this house will more than likely be my last lay out in this house.
Cap Cod style, to many stairs. So, I'm not sure what I need to know about Arduinos, except things I don't understand, interest me.
Don - Specializing in layout DC->DCC conversions
Modeling C&O transition era and steel industries There's Nothing Like Big Steam!
I bought a $27 kit that has motors, leds, breadboards, wires etc
and the arduino. Oh and another Dummies book for the library.
That's why I said the Pi is a coompletely different animal. It's a general purpose computer (proof how powerful 'cell phone' CPUs have gotten) that happens to have some GPIO pins to control things. An Arduino is about as opposite as you can get.
There seems to be a lot more interest in animation, even the simple sort of thing like turning lights on and off. Some people are out to change that <5% figure. It's not difficult to do, and the results can be pretty eye-catching..
rrinker If you can do all that to the Walthers turntable, you can wire an Arduino to make some lights turn on and off randomly in structures. Or, look again at Geoff Bunza's articls, simulate someone watching a TV. Or flicker like oil lamps, if you model an earlier era. It's much like DCC. Do you need to knwo what goes on under the decoder's shrink wrap to make effective use of DCC? Absolutely not. You just need to know which wires go to the track, which go to the motor, and which go to the lights. Raspberry Pi is a whole different ballgame compared to Arduino. They were definitely not designed with the electronics novice in mind. Arduino, as I mentioned, was developed originally for artists and designers, not computer programmers. There's even one that is designed to be sewn into clothing. --Randy
If you can do all that to the Walthers turntable, you can wire an Arduino to make some lights turn on and off randomly in structures. Or, look again at Geoff Bunza's articls, simulate someone watching a TV. Or flicker like oil lamps, if you model an earlier era.
It's much like DCC. Do you need to knwo what goes on under the decoder's shrink wrap to make effective use of DCC? Absolutely not. You just need to know which wires go to the track, which go to the motor, and which go to the lights.
Raspberry Pi is a whole different ballgame compared to Arduino. They were definitely not designed with the electronics novice in mind. Arduino, as I mentioned, was developed originally for artists and designers, not computer programmers. There's even one that is designed to be sewn into clothing.
If I can't do it Randy, I'll have to hand by my astrospace and computer science credentials. :)I'm not going to argue which is better on Raspberry Pi Zero versus Arduino. It's a right tool for the right function. But the Pi can do more with more languages and more io options. My favorite is hosting a low power JMRI server (and turntable sounds)The point being <5% are likely to use such implementations and they are highly customized.
While Raspberry Pis and Arduinos are very useful and powerful little devices, they are more of an advanced application for larger layouts, and an additional cost. 99% of people here some days have a problem just getting their DCC loco to work right.
For me I have the old Walthers "Analog" turntable with the left and right buttons. I replaced the left and right buttons and hotwired in a sensor that detects when the table is moving (Signal High Pin) on the GPIO. When it sees the motor going it starts up a turntable sound. When it goes low it plays the turntable stop sound. It's a little laggy but works mostly well. I also replaced the wiper conductors with slip ring. It's much more reliable and no electrical cutout on the tracks when you "flip" polaritieshttps://www.amazon.com/s/ref=nb_sb_noss/134-0879825-8864010?url=search-alias%3Daps&field-keywords=slip+ring
I agree with you that they are highly useful. But for most, out of practical reach. I'm sure someone could make a small business of making turnkey Raspberry Pi JMRI servers and Arduino devices.But me, I freely share knowledge and let people explore it on their own.
dstarkMel...where can I get a hardware picture or drawing of that arduino random lighting generator? So very sorry to read of your daughters passing. Such a terrible thing, my thoughts and prayers are with you. God bless
OK, I'm gonna look up Geoff's articles and see what I can learn. Right now, well, later today, I'm going to jump into JMRI for the first time. Been working on a loco, and I want try it all out.
Bit by Photobucket. Those missing pictures WERE the hardware diagrams.
Read Geoff Bunza's articles - it really IS that simple to do this.
WOW ! what were those 3 pages about? We need a emoticon in here that shows something flying over your head, for guys like me.
Maybe we need a special forum for electrical engineers, so they can swap code stories.
Never mind, my little layout works just great with hand thrown turnouts, and signals powered and controled by rotary switches.
I thought they were just little motor controls.
EDIT: It seems like Dave H. is out there swinging for rest of us. I'll never need anything like this anyway. I'll just move on.
Everyone just assumes everyone knows what goes where and writes and shows sketches.......some of us need to see the hardware too.
rrinkerArduino version of C (it's not really C, it's actually derived from Processing),
It is C/C++, it's not "derived" from processing (The IDE is deirved from the Processing IDE, and is written in java). It uses the avr-gcc compiler. Processing is an intepreted language based on Java. A limited subset of standard I/O is available to micro controllers in general, as there is no file or operating system. Although there are a lot of atmel/arduino optimized functions provided, most C/C++ commands work just fine. http://www.nongnu.org/avr-libc/user-manual/group__avr__stdio.html
Steve Spence
KK4HFJ (Ham Radio)
http://arduinotronics.blogspot.com
Remind me to never post code again. At least not early in a project development. That being said, the code does indeed work for travel in either direction on either track. Remember that all my passenger cars and cabooses pickup track power and are detected by the ODs so a train has to completely clear a block for that input to go HIGH. The system has only been in use for a week and is very much in the debug mode. Indeed I have already found an issue in the unlikely event that I make a westbound or eastbound move and then reverse the direction of the train. The gates and/or flashers then stay on until all 3 blocks are clear. I may or may not try to fix that. My layout is meant for "roundy round" operation and that pleases me so I really don't care. To each his own.
printf() is available in the Arduino version of C (it's not really C, it's actually derived from Processing), however there is no standard I/O like there is when compiling C code for a PC using any of the common operating systems like Windows, Linux, or OSX. To activate the serial port for debugging you must use the serial library as shown in the otiginal code, there is a handy serial terminal built in to the Arduino IDE that can be used to vew the debugging output and/ot send data to the Arduino.
Yes, the new code is shorter but then all teh initialization steps have been left off as well, with Arduino and other microcontrollers you need to define the I/O pins for th required use - digital output, digital input, digital input with integrated pullup, or analog input.
For a very complex layout (although not even the Arduino Mega has enough I/O pins to handle all the detectors, signals, and other accessories like crossing gates for all that big of a layout, unless you go nuts with shift registers to expand the pin count, in which case the code will need additional functions that resemble in no way at all part of the layout logic to handle the shift register I/O), arranging the logic liek this does make it a bit easier to read, and with a bit more code the CHECK() functions can be configuredto handle blocks that just drive signals as well as ones that have crossing gates and/or signals. And it will run faster, although speed is generally not a problem with railroad stuff. However, for a simpler situation, like just driving two grade crossings, I'd postualte the more inefficient version is more easily understood by the beginner (or non) programmer. Simple IF-THEN constructs, rather than more complex nexted IF-THEN-ELSE IF structures. Again, the second way is definitely more efficient in both processing speed and in use of resources, and is the sort of thing I would expect to see as the final product from someone with a lot of programming experience, however the initial approach is totally correct for the exercise at hand. One other thing, once it is all working, all of the serial calls can be commented out to again speed up the loop speed as well as save resources. ANother way to do some simple debugging, if all the pins aren't used, is to use some leftover pins to light LEDs at specific points in the code. Or a routine can be written to blink the included LED on Pin 13 of all Arduinos at different speeds so you can follow along in the code just by watching the blinkign LED instead of hooking up the serial cable.