Trains.com

Subscriber & Member Login

Login, or register today to interact in our online community, comment on articles, receive our newsletter, manage your account online and more!

Preliminary design for my Arduino-based CMRI node

16095 views
35 replies
1 rating 2 rating 3 rating 4 rating 5 rating
  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Friday, August 11, 2017 8:14 PM

 Mel - I would think the key would be to count the steps and hope the motor you are using has good repeatability. Another way would be to use a servo, you'd have to run linkage up the post but you could definitely stop it facing the right way.

                              --Randy

 


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    January 2014
  • From: Moneta, VA USA
  • 1,175 posts
Posted by gdelmoro on Friday, August 11, 2017 7:37 PM

WOW and I thought Latin was hard to learn Tongue Tied. you guys are on a whole different level!

Gary

  • Member since
    July 2009
  • From: lavale, md
  • 4,678 posts
Posted by gregc on Friday, August 11, 2017 7:36 PM

rrinker
I started thinkign about my CMRI node design.

could you summarize what CMRI defines?   I assume it's rs-485 based, so what is the packet structure/size?

rrinker
My basic node will have 5 of these (they are less than $1 each!) for 64 output ports for signal LEDs and turnout control, and 16 input ports for block detectors and switch position feedback

is each node fixed?   Have you considered making the number of inputs/outputs configurable at startup through a configuratoin command?

rrinker
 Most implementations (other than Bruce Chubb's SMINI and SUSIC boards) leave the CMRI node address selection in code, so you have to change and recompile the sketch for each node. Since all I/O on my board comes from the 23S17's, I have plenty of pins to put in jumpers or a DIP switch to set the address in hardware.

are you dedicating 5 inputs for address?

you could use optional pull-up/pull-downs on 5 of the outputs that are read at start up to determine the address before programming the I/O pins as outputs

another alternative is to program the address in the atmel EEPROM

rrinker
D10 for the slave select line for the output bank

D9 for the slave select line for the input bank

can you explain the purpose of these?

rrinker
The library for the 23A17 allows you to specifiy which data pin is used as the select. So I am dividing up the inputs from the outputs)

can explain this more?  why divide the inputs and outputs?

I assume there are 16-bit transmitted to/from the device during each interval.  The master (arduinoe) sends an output bit while the salve (MCP) sends the corresponding input.

It's been a while since I worked on I2c.  Doesn't it precede data with an address.   I see the 23S17 uses a !CS.   Does this require a separate data pin to select each chip?

 

 

greg - Philadelphia & Reading / Reading

  • Member since
    January 2009
  • From: Bakersfield, CA 93308
  • 6,526 posts
Posted by RR_Mel on Friday, August 11, 2017 6:58 PM

Marc_Magnus

 

 
 Mel,
 
I beleive but not sure you can find may be an answer on the following blog for step by step motor contol by Arduino.
 
In the case of not, you could probably answer this bloger, he answer at any question about Arduino and share the answer.
 
Good luck.
 
Marc
 
The address is 
 
http://model-railroad-hobbyist.com/blog/geoff-bunza
 

I’ve tried emailing him a couple of times and didn’t get any response, same thing with Bruce Kingsley.
 
Thanks for your input Marc.
 
Mel
 
Modeling the early to mid 1950s SP in HO scale since 1951
 
My Model Railroad   
 
Bakersfield, California
 
I'm beginning to realize that aging is not for wimps.
 
  • Member since
    December 2003
  • From: Quebec
  • 983 posts
Posted by Marc_Magnus on Friday, August 11, 2017 6:47 PM

 

 

 

I haven’t been successful using an Arduino as a stepper motor controller for operating a wig-wag crossing signal.  I need help with the programming, I haven’t been able to stop the swinging pendulum (30°-0-30°) straight down.
 
 
Mel
 
Modeling the early to mid 1950s SP in HO scale since 1951
 
My Model Railroad   
 
Bakersfield, California
 
I'm beginning to realize that aging is not for wimps.
 
 
 
 Mel,
 
I beleive but not sure you can find may be an answer on the following blog for step by step motor contol by Arduino.
 
In the case of not, you could probably answer this bloger, he answer at any question about Arduino and share the answer.
 
Good luck.
 
Marc
 
The address is 
 
http://model-railroad-hobbyist.com/blog/geoff-bunza
  • Member since
    January 2009
  • From: Bakersfield, CA 93308
  • 6,526 posts
Posted by RR_Mel on Friday, August 11, 2017 5:53 PM

Keep up your Arduino information coming Randy.  I for one really appreciate any and all Arduino input.  Thumbs Up  Thumbs Up
 
I have a working 14 block signal system using single light three color H5 signal heads driven with an Arduino MEGA as well as three 14 port Arduino UNOs programmed as Random Lighting controllers for three houses.
 
I also have my remote 180° panable Q5 camera on a depressed flat car working, it uses a pair of Arduino Nanos with Blue Tooth for servo control.  It would be nice if I could find a Q5 camera that works right.
 
I’m working on using Nanos for controlling all kinds of automation, figures, vehicle lighting and operating doors.
 
If my health holds up I plan on replacing my turnout machines with the SG90 servos driven by Arduino.
 
I haven’t been successful using an Arduino as a stepper motor controller for operating a wig-wag crossing signal.  I need help with the programming, I haven’t been able to stop the swinging pendulum (30°-0-30°) straight down.
 
 
Mel
 
Modeling the early to mid 1950s SP in HO scale since 1951
 
My Model Railroad   
 
Bakersfield, California
 
I'm beginning to realize that aging is not for wimps.
  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Preliminary design for my Arduino-based CMRI node
Posted by rrinker on Friday, August 11, 2017 4:47 PM

 With the turnout controller nearly done, I started thinkign about my CMRI node design. Like the turnout controller, prototyping is being done using Arduinos, but the final product will be built using bare Atmel ATMegas328P chips since the in use boards don't need things like extra voltage regulators, USB ports, or unused pins.

 To get enough digital pins, I am using Microchip MCP23S17 port expanders. These communicate to the Arduino with SPI, and each one has a pair of 8 bit ports. My basic node will have 5 of these (they are less than $1 each!) for 64 output ports for signal LEDs and turnout control, and 16 input ports for block detectors and switch position feedback (not sure if I am going to do that). That should cover any interlocking I can think of, but just in case I will lay the boards out with a space for an extra chip each on the input chain and output chain (simple code change to add the extra bits - or leave off a chip or two when not needed).

 Most implementations (other than Bruce Chubb's SMINI and SUSIC boards) leave the CMRI node address selection in code, so you have to change and recompile the sketch for each node. Since all I/O on my board comes from the 23S17's, I have plenty of pins to put in jumpers or a DIP switch to set the address in hardware. So far I have the following pin arrangements:

A0-A5 for the address selection, which allows 64 of these nodes. I looked at my prelimiary track plan and it looks like I will need no more than 1/4 that number at most.

D13 for the SPI SCK clock line

D12 for the SPI MISO line - data from the 23S17 to the Arduino

D11 for the SPI MOSI line - data from the Arduino to the 23S17

D10 for the slave select line for the output bank

D9 for the slave select line for the input bank

(note on the last two, the 23S17 has 3 address pins of its own, which allows up to 8 of them on one SPI line, or the 2317 which uses I2C can do the same). The library for the 23A17 allows you to specifiy which data pin is used as the select. So I am dividing up the inputs from the outputs)

D0 and D1 are the serial port

D2 for transmit enable to the RS485 transceiver chips

D3 for a status LED that tells me the loop is running.

Questions? Comments?

                            --Randy

 

 


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

Subscriber & Member Login

Login, or register today to interact in our online community, comment on articles, receive our newsletter, manage your account online and more!

Users Online

There are no community member online

Search the Community

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
Model Railroader Newsletter See all
Sign up for our FREE e-newsletter and get model railroad news in your inbox!