Forgot Login?   Sign up  
Sunday, November 24, 2024

Forum Search

Keyword

Arduino [or other uCPU] controlled.....

More
11 years 10 months ago #14882 by TheWag
... stop lights, crossing arms, lighting? Lots of possibilities. I'm using a couple of them to run trins on my modules. One in a 2 controller handheld unit and the other controlling track. Also shows voltages of the 12V, 9V (Track), and 5V (uCPU and electronics) busses.

Anyone else playing around with these nifty devices?
Ben

Please Log in or Create an account to join the conversation.

More
11 years 10 months ago #14885 by Kelley
Replied by Kelley on topic Re: Arduino [or other uCPU] controlled.....
Thanks Ben. I seen these things mentioned somewhere on line or in a forum, and was wondering if anyone had experience with them. Everything I seen about these things was all in kind of geekspeak, and I was hoping someone could break down in model railroad terms how they could be wired and used for stuff we can use. How many would one need to operate all the bells and whistles and gizmos on a layout or module?

Please Log in or Create an account to join the conversation.

More
11 years 10 months ago #14888 by TheWag
Replied by TheWag on topic Re: Arduino [or other uCPU] controlled.....
Unfortunately the answer to that is one to many. On the basic level an Arduino can handle some combination of 20 inputs and outputs. There are NUMEROUS ways to increase that. My plans are to place one unit per module and expand it to whatever I need. One module will (hopefully and eventually) have need of ~20 servos (for turnouts) along with some power routing. Then there are the input buttons to make them move. At some point I'd like to get it to drive a DCC booster and convert to DCC. Running lights and other assorted items whenever I can get to them.

If you've got some ideas as to what you'd like to setup, I'd be glad to walk you through.

Ben
The following user(s) said Thank You: Kelley

Please Log in or Create an account to join the conversation.

More
11 years 10 months ago #14889 by markm
Kelley,
Check out the Parallax site (another type of uController) at:
www.parallax.com/Portals/0/Downloads/appnt/stamps/bs1Appnotes.pdf
Section 21: Fun with Trains.
They go into great deal in working with model trains. The examples are N scale, but fortunately since its programmable, all you need is change the maximum throttle voltage to 8V.
While this is not Arduino, the uC chip in the Basic Stamp works the same as the Arduino chip and all the principles are the same...just a different programming language.
I have a bit of experience with such devices, starting in 1973 and a silicon valley engineer for them for 25 of those years, so I'm willing to try to help anyone who wants to use these in model railroading.

Mark
The following user(s) said Thank You: Kelley

Please Log in or Create an account to join the conversation.

More
11 years 10 months ago #14890 by Kelley
Replied by Kelley on topic Re: Arduino [or other uCPU] controlled.....
Thanks. This would be something for me way off in the future. I just have not seen much about these as far a Z scale goes and i would use them mostly for all the special effects. Id be driving the train, and although my turnouts would be manual, I would just use bell cranks.
This is some good stuff and I hope because the components are used by many people for many applications, that they would be cheaper than stand alone items that is used exclusively for just model railroading. All I have planned at the moment are 2 sets of lighted crossings, and I would like them to operate bells as well.
I hope these things will help other people get more fun out of their railroad.

Please Log in or Create an account to join the conversation.

More
11 years 10 months ago #14891 by stonysmith
Replied by stonysmith on topic Re: Arduino [or other uCPU] controlled.....
I have about a dozen of these devices sitting around my workshop. They are GREAT for complex blinky-light devices, but they don't by themselves provide enough current to drive a locomotive.

I did buy a "motor shield" for my Arduino, and it works rather well, except it's rather finicky when the track isn't pristinely clean. I really should take a video of this thing in operation. Hm.. Where's that video camera again?

Please Log in or Create an account to join the conversation.

More
11 years 10 months ago #14892 by markm
From what you describe, to add a traffic light the best solution comes from the August '89 issue of MR. Not only does it control the traffic signal, it can provide the control for the lighted crossings.
You are correct about not having many electronic gadgets in Z, although that seems true in all the scales.

Mark

Please Log in or Create an account to join the conversation.

More
11 years 9 months ago #15038 by CNz220
Replied by CNz220 on topic Re: Arduino [or other uCPU] controlled.....
Ive programmed a PIC microcontroller as a traffic light timer. The disadvantage of these is that the programming is more complex to learn. The plus side is the low cost of the chips. It would not break the bank to have a seperate microchip at each intersection or grade crossing. Its fairly simple to add pushbuttons to the circuit to enable switching between modes, eg. nighttime/daytime operation. I like the idea of integrating a grade crossing interlocking.

Please Log in or Create an account to join the conversation.

More
11 years 9 months ago - 11 years 9 months ago #15044 by stonysmith
Replied by stonysmith on topic Re: Arduino [or other uCPU] controlled.....
At the recent Plano Train show, I asked Richmond Controls if he had any traffic light LED systems. He said "No, there are several other manufacturers doing that so I'm not interested."

What he did not do was tell me who any of these 'other' people were.

Please Log in or Create an account to join the conversation.

More
11 years 9 months ago #15046 by Bill_O
Replied by Bill_O on topic Re: Arduino [or other uCPU] controlled.....
Take a look at Bakatronics there are some interesting modules.

www.bakatronics.com

BK213 Traffic Light Controller, $39.95

Traffic Light controller for Bulb or LED type traffic lights. Includes outputs for walk / Don't walk lights and night blinking patterns

Module:
- Eight Sequenced outputs for 4 way traffic control and walk / don't walk lights
- Micro-processor controlled circuit with pre programmed sequences.
- Voltage regulator on circuit board to enable voltages from 7 to 14 VDC to be used
- Sequences are programmed to turn on and off for a realistic Traffic Light look.
- Will work with Bulb type lights or LED's common anode LED lights
- Walk light output included in module, but can be used without walk lights
- Driver chip is included in the module and can operate lights up to 300ma per circuit
- Assembled circuit board is 1" x 2 3/8" x approx. 1/2" high

BILL

Please Log in or Create an account to join the conversation.

More
11 years 9 months ago #15049 by markm
Stony,
Circuitron has a circuit in the last catalog I downloaded. It looks like a PAL/GAL based unit.
But if you have the Arduino units build your own unit. It's only a couple dozen lines of code, max. Add a 74LS06 or '16 to drive the LEDs and you're ready to go.

I built my first traffic light controller like the MR story, with TTL logic. The next one using a Basic Stamp and the last one using a GAL. Sort of lost interest at the time because of the issues with getting Z scale LEDs.

Mark

Please Log in or Create an account to join the conversation.

More
11 years 9 months ago - 11 years 9 months ago #15081 by markm
If anyone is interested here some basic code for turning an Arduino into a traffic signal:
/*
  Traffic
  Cycles through 2 banks of Red-Yellow-Green LEDs to simulate a traffic signal for model railroading.
  M. Markham 1-27-13
 
  This example code is in the public domain.
 */

// Define the pins that will drive the signal
const unsigned int REDW =     2;    // West - Primary Direction
const unsigned int YELLOWW =  3;
const unsigned int GREENW =   4;
const unsigned int REDN =     5;    // North - Secondary Direction
const unsigned int YELLOWN =  6;
const unsigned int GREENN =   7;
const unsigned int TICK = 500;      // Cycle clock


// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pins as an outputs.
  pinMode(REDW,OUTPUT);   
  pinMode(YELLOWW,OUTPUT);
  pinMode(GREENW,OUTPUT);
  pinMode(REDN,OUTPUT);
  pinMode(YELLOWN,OUTPUT); 
  pinMode(GREENN,OUTPUT);
  // Initialize all pins with red signal in both directions
  digitalWrite(REDW,HIGH);   
  digitalWrite(YELLOWW,LOW);
  digitalWrite(GREENW,LOW);
  digitalWrite(REDN,HIGH);
  digitalWrite(YELLOWN,LOW); 
  digitalWrite(GREENN,LOW);
       
  
  
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(GREENW, HIGH);    // turn the wesr green LED on red off
  digitalWrite(REDW,LOW);
  delay(5 * TICK);               // wait 
  digitalWrite(YELLOWW, HIGH);   // turn the yellow LED on green off
  digitalWrite(GREENW,LOW);
  delay(2 * TICK);               // wait 
  digitalWrite(REDW, HIGH);      // turn the yellow LED off red on
  digitalWrite(YELLOWW,LOW);
  delay(TICK);                    // short wait to present all red
  digitalWrite(GREENN, HIGH);    // Cycle north direction
  digitalWrite(REDN,LOW);
  delay(5 * TICK);               // wait 
  digitalWrite(YELLOWN, HIGH);   // turn the yellow LED on green off
  digitalWrite(GREENN,LOW);
  delay(2 * TICK);               // wait 
  digitalWrite(REDN, HIGH);      // turn the yellow LED off red on
  digitalWrite(YELLOWW,LOW); 
  delay(TICK);                   // wait 
  // Ready to start the loop again  
}

Please Log in or Create an account to join the conversation.

More
11 years 9 months ago #15103 by Zcratchman_Joe
Replied by Zcratchman_Joe on topic Re: Arduino [or other uCPU] controlled.....
Coincidently, the same day Mark posted the code above here, I got an online flyer (junk email) from Radio Shack all about their Arduino’s. Not that they were on sale, but just that they do have them, at least online they do (and probably a lot more expensive than elsewhere online too). But the thing that caught my eye was that they also have DIY books for these devices (like “Getting Started with Arduino”). Might be something to look into if one is thinking about getting involved with them.

@@@ Radio Shack still sells electronics????? Who knew?

Please Log in or Create an account to join the conversation.

More
11 years 9 months ago - 11 years 9 months ago #15104 by stonysmith
Replied by stonysmith on topic Re: Arduino [or other uCPU] controlled.....
Most local Radio Shack stores actually have an Arduino or two in stock. At $34 for the "Uno", it's only $5 more than at AdaFruit
or DigiKey

Please Log in or Create an account to join the conversation.

More
11 years 9 months ago #15105 by TheWag
Replied by TheWag on topic Re: Arduino [or other uCPU] controlled.....

stonysmith wrote: Most local Radio Shack stores actually have an Arduino or two in stock. At $34 for the "Uno", it's only $5 more than at AdaFruit
or DigiKey


Yeah, save on shipping and hope it encourages them to get back to their "roots".

Please Log in or Create an account to join the conversation.

More
11 years 9 months ago #15120 by markm
Joe,

Zcratchman_Joe wrote: @@@ Radio Shack still sells electronics????? Who knew?


Yeah but they're trying hard not to. They've been selling components for "robotics experimenters" for some time starting with the Parallax Basic Stamp (which is one of the reasons I recommend it), motion and proximity sensors, even a GPS module. But as far as local availablity, I would describe it as spotty. The Shack near me has downsized to a phone and stereo store. But if I'm willing to do the "3 hour tour" down to Sacramento, a Rancho Cordova store is well stocked and the owner quite helpful.

As for the DIY books I haven't found one yet that I would recommend. The Arduino uses a programming language called C++: very powerful but not the easiest to learn. IMHO the books I looked at in B&N gloss over important concepts for a beginner and diverge into topics not really related to the Ardiuno. To me this is important when the books cost more than the system! If you know the C++ language, I would say that nearly every book I looked at will do. When I find an appropriate book for the group, I'll certainly post it.

I do find it a bit amusing that a chip I worked on nearly 20 years ago is the heart of a 21st century product.

Mark

Please Log in or Create an account to join the conversation.

More
11 years 9 months ago #15122 by TheWag
Replied by TheWag on topic Re: Arduino [or other uCPU] controlled.....

markm wrote: Joe,
As for the DIY books I haven't found one yet that I would recommend. The Arduino uses a programming language called C++: very powerful but not the easiest to learn. IMHO the books I looked at in B&N gloss over important concepts for a beginner and diverge into topics not really related to the Ardiuno. To me this is important when the books cost more than the system! If you know the C++ language, I would say that nearly every book I looked at will do. When I find an appropriate book for the group, I'll certainly post it.


I'm partial to the adafruit tutorials. Got me up and running. Arduino Lesson 1 - Blink

Please Log in or Create an account to join the conversation.

More
11 years 9 months ago #15126 by Zcratchman_Joe
Replied by Zcratchman_Joe on topic Re: Arduino [or other uCPU] controlled.....

TheWag wrote: I'm partial to the adafruit tutorials. Got me up and running. Arduino Lesson 1 - Blink

Yes, this is pretty good, however they also mention Lesson 0, which I could find nowhere on the site.

How about www.ladyada.net/learn/arduino/index.html for the beginner that needs that extra - getting started - kind of help.

Joe

Please Log in or Create an account to join the conversation.

More
11 years 9 months ago - 11 years 9 months ago #15135 by TheWag
Replied by TheWag on topic Re: Arduino [or other uCPU] controlled.....

Zcratchman_Joe wrote: How about www.ladyada.net/learn/arduino/index.html for the beginner that needs that extra - getting started - kind of help.


Yeah, same folkz. I guess when they "upgraded" to the new system they missed something. :pinch:

Please Log in or Create an account to join the conversation.

More
11 years 9 months ago - 11 years 9 months ago #15137 by markm
I've looked at both sites, and a few others, plus 3 or 4 books. While I wouldn't discourage anyone from using them, they all look a lot alike with the same examples and similar commentary and they all seem to miss the fact that programming a microcontroller is different than a microprocessor (PC) and the subilites they miss can make a big difference in the success of a program.

Just as an example of what is missing, the blink example uses the definition:
int led = 13;
This could also be coded as I did in my example as:
const unsigned int led = 13;
or
#define led 13

While the differences are not important on a PC, knowing when to use each one can be critical on a uC.

As I posted ppreviously, I've not found a source I'd recommend, but if anyone has any other documentation, I love to learn about it.

Mark

Please Log in or Create an account to join the conversation.

Time to create page: 0.354 seconds