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!

Light "controller" of sorts

3249 views
46 replies
1 rating 2 rating 3 rating 4 rating 5 rating
  • Member since
    January 2006
  • From: Northeast OH
  • 2,268 posts
Posted by NeO6874 on Thursday, November 8, 2018 7:28 AM

Well, I got the PCBs from China yesterday, and other than a few gaffes on my part, such as that label that is half off the board ... they turned out well.

Soldered one up yesterday, and it works pretty nice -- especially with having slowed it down to ~1 second between cycles, rather than the 100ms I was using during testing.

 

Here's a couple of pics of the completed board:

 

 

If anyone's interested, I'd be willing to ship you one.  Would rather see them go to a good home, than sit here collecting dust.  Just PM me and we'll hammer out what timing you want on the LEDs, and your shipping addres.

Board'll arrive (nearly) ready to run -- you'll just need a 9-24v power source (it "should" work with AC or DC, but I can't find my MRC pack to test it with so, I'd recommend not using AC), LEDs, and their current-limiting resistors.

-Dan

Builder of Bowser steam! Railimages Site

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Tuesday, October 30, 2018 5:40 PM

 Very true. There's little truly new. I'm not one to reinvent the wheel, I always look for prior works, change or incorporate them if possible, before I ever try to come up with solution on my own.

                          --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 2006
  • From: Northeast OH
  • 2,268 posts
Posted by NeO6874 on Tuesday, October 30, 2018 2:32 PM

I have the distinct feeling anything I feel like trying to tackle has probably been done (and possibly better) ... Some crazy smart types in this hobby if you know where to start digging ...

-Dan

Builder of Bowser steam! Railimages Site

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Tuesday, October 30, 2018 1:53 PM

 Actually I back-doored into it, since I saw the expansion board on the MRCS site and they mentiont he limitations there, but I was curious about the chip they used so I looked it up and got the data sheet. ANd found out there is already an Arduino library that supports both versions (for some reason I like SPI - dunno, I just like it better than I2C). So among other parts, I have some MCP23S17's ready to build a prototype circuit. Soon as I finish getting the finalized schematic for my turnout controller, and getting the boards spun. And more or less finalizing the software. It works perfectly fine but I'm tweaking it a bit. Then I will start work on my version of the cpNode. I've already done the very basic "hook an RS484 adapter to an Arduino and use JMRI to turn an LED on and off" test.

                                   --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 2006
  • From: Northeast OH
  • 2,268 posts
Posted by NeO6874 on Tuesday, October 30, 2018 12:32 PM

Yup, I must be blind Smile

-Dan

Builder of Bowser steam! Railimages Site

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Tuesday, October 30, 2018 11:11 AM

 Table 1, page 3, in the MCP23x17 data sheet.

                            --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 2006
  • From: Northeast OH
  • 2,268 posts
Posted by NeO6874 on Tuesday, October 30, 2018 11:00 AM

Yeah, I wasn't seeing either spec in the tables.  It's probably just somewhere in the text and I just glossed over it, in looking for the tables.

-Dan

Builder of Bowser steam! Railimages Site

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Tuesday, October 30, 2018 6:56 AM

 The 23x17's can drive something like 45ma or so per output, to a max of 160ma for the whole chip, so if you use all 16 lines for output, it's no more than 10ma per line. Which is fine for LEDs. If you need more, just add a drive like a ULN2003.

 The key thing to remember is that there are usually two specifications on data sheets for anything that has multiple drive lines - how much each line can handle, and how much total you cna have for the whole chip. Most have a combined total that is much less than the per line limit times the number of lines. 

                                       --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 2006
  • From: Northeast OH
  • 2,268 posts
Posted by NeO6874 on Tuesday, October 30, 2018 5:25 AM

Yeah, the 6971s are for a different LED-based project of mine (not related to MRR'ing). 

Those registers you mentioned look like simple i/o expanders -- I probably misread the datasheet, but it didn't look like they could deal with LEDs -- or at least I couldn't find the ratings on a pin.

I'm not currently skilled enough to set up a multi-board communications network, so the "expansion board" idea I'm thinking about is simply that the backplane supplies 5VDC power to the card(s) that're plugged in.  Each card then has its own microcontroller doing whatever it's been programmed to do.

Maybe in the future, write up something more complex (although, by then, I think whatever that ends up being would also involve "hey MRR editors, how much does the smallest ad space cost?")

-Dan

Builder of Bowser steam! Railimages Site

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Monday, October 29, 2018 8:37 PM

 That's sort of how MRCS does their cpNode - thye have add-on boards for IO expanders using the MC23017, and it just interfaces to the main board with 4 wires, 2 for the I2C and 2 for power and ground, and you can daisy chain another one to the first.Nice thing is the hardware design is the same for no, one, or two expansion boards. It's all just a software change to address the extra ports over the bus.

 I checked out the MAX6971 - it seems liek it's really meant for controlling large LED strings - with 36 volts per channel you can hook 10 LEDs in series and then it's a constnat current cource for each one - plus PWM on the enable pin controls the LED brightness. Might be an option for layout lighting, but it's way overkill for structire lighting. There are cheaper smaller LED constant current drivers for single or small quantity LEDs - then you don;t have to supply any resistors on the LEDs themselves.

                                        --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 2006
  • From: Northeast OH
  • 2,268 posts
Posted by NeO6874 on Monday, October 29, 2018 6:39 PM

Heh, I've got a boatload of the sn74 registers right now. This initially started out as a project to see how small I could get the code while making the missus a little present (and yep, I crammed it into an attiny25 using plain Arduino IDE code.  I think if make use of more inline assembly, I can shrink it some more).

As I was playing with it, I figured it might be useful on a layout.  

Expanding it is more just a thought exercise -- 32 individual random LEDs is already probably pushing it Smile.  But it helps me learn if I have a semblance of an actual project (like pluggable cards in a power bus to act as brainboxes for ... something Wink).

I was also looking into the Maxim Integrated MAX6971 series - but they're 4.50 apiece (yuck).

 

-Dan

Builder of Bowser steam! Railimages Site

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Monday, October 29, 2018 4:42 PM

 If you really need ports, there are the devices I am planning to use on my CMRI nodes - Microchip MCP23S17 poort expanders. There is a 23017 which is I2C and a 23S17 which is SPI, and each has 16 I/O pins. So 2 pins (or 3 if using SPI) becomes 16 - but not quite. Each 23x17 has 3 address lines to set the internal address, so you can have 8 of them per bus, so 2 or 3 pins becomes up to 128 pins! Not quite as cheap as the 74HC595 shift registers, but they also don;t do bit shofting to get the output - each 8 bit port (there are 2 per 23x17) is individually addressable. They are $1.30 in single unit quantities from the usual distributors, maybe cheaper on ebay. But remember, that's 16 pins for that, so 2x of the shift registers. And there are Arduino libraries for either version.

                                       --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 2006
  • From: Northeast OH
  • 2,268 posts
Posted by NeO6874 on Monday, October 29, 2018 10:30 AM

gregc

 

 
NeO6874
The MOSFETs will handle something silly like 20 amps

 

did you actually build a circuit using mosfets?   if so, were they discrete or an array?

i have large discrete mosfets, but the fdc6401N is rated at only 3A.   still plenty

 

 

Just a test board, and actually, now that I double-check the parts ... they're actually FQP30N06L, and rated to 32A apiece.  (Not the FQP27P06 which're 27A)

-Dan

Builder of Bowser steam! Railimages Site

  • Member since
    January 2006
  • From: Northeast OH
  • 2,268 posts
Posted by NeO6874 on Monday, October 29, 2018 10:24 AM

Yeah, The edge-connectors are just an idle thought -- I think that connectors in general look cleaner than using header pins; and "needs force to insert" tends to also mean "needs force to remove".

Going with the "split" approach, the brainbox board is 1.0 x 1.3 inches -- just big enough for an attiny, capacitor, and an rj45 connector for power/signal output (or programming input). 

Remotes in or near buildings would then take input, and have howevermany shift registers the building needs (up to four, assuming we stick with that ATTiny25 ... I haven't really messed with seeing how well the code scales, so let's assume we can double it (8 registers, 64 LEDs) with a -45, or double it again (16 registers, 128 LEDs) with an -85).

 

Although 16 registers is 1.12 A if we're driving them as hard as they'll go (70 mA apiece), and 24AWG wire is only rated for 570mA per conductor (and I'm not 100% sure we could use two conductors)

-Dan

Builder of Bowser steam! Railimages Site

  • Member since
    July 2009
  • From: lavale, md
  • 4,678 posts
Posted by gregc on Monday, October 29, 2018 9:34 AM

NeO6874
The MOSFETs will handle something silly like 20 amps

did you actually build a circuit using mosfets?   if so, were they discrete or an array?

i have large discrete mosfets, but the fdc6401N is rated at only 3A.   still plenty

greg - Philadelphia & Reading / Reading

  • Member since
    January 2009
  • From: Bakersfield, CA 93308
  • 6,526 posts
Posted by RR_Mel on Monday, October 29, 2018 9:04 AM

NeO6874

Nice - will have to check the 'bay for those guiderails.

 

I really like that "cards in a box" approach -- toying around with a redesign that'll be similar now.  Except that I'll add a backplane power source, and some card-edge connectors for power.  (outputs will be the other side, not sure what yet, maybe 8p8c).

 

I also prefer that type of back plane but I tried that early on and had problems with pin alignment.  I solved the alignment problem but I use the Arduino type connectors and didn’t like having to apply as much pressure as needed to plug them in.  I don’t like to force things.
 
 
 
I’ve standardized on connectors for my layout, the Arduino header type for my Arduino wiring and the micro header connectors for everything else.
 
 
 
There is a 5cm x 7cm card (very close to the same size as a UNO) that has edge connectors and I might give that a shot down the road.
 
 
16 x2 on each end of the card.
 
Mel
 
 
My Model Railroad   
 
Bakersfield, California
 
I'm beginning to realize that aging is not for wimps.
 
  • Member since
    January 2006
  • From: Northeast OH
  • 2,268 posts
Posted by NeO6874 on Monday, October 29, 2018 8:44 AM

gregc

the uln2803/4 is a darlington array that is useful as a sink (pulling something to ground).

is there a similar device (octal array) for sourcing (Vcc) higher current?

i've found devices like fdc6401n (dual, hex).

 

 

I'm using SN74HC595 Shift registers -- though they're (IIRC) limited to 20 mA per pin, or 70 mA total through VCC  (or GND - though I've never bothered trying to use them as sinks).

at 5 volts, with a nominal forward voltage of 3-3.3V, the little test-array I'm running is pushing about 8-9 mA / LED (220 Ohm resistors)

Granted, these are chineseium LEDs, so they may not all actually be anywhere near that value (but after 4 days of running, the shift registers were still working fine...)

-Dan

Builder of Bowser steam! Railimages Site

  • Member since
    January 2006
  • From: Northeast OH
  • 2,268 posts
Posted by NeO6874 on Monday, October 29, 2018 8:29 AM

Nice - will have to check the 'bay for those guiderails.

 

I really like that "cards in a box" approach -- toying around with a redesign that'll be similar now.  Except that I'll add a backplane power source, and some card-edge connectors for power.  (outputs will be the other side, not sure what yet, maybe 8p8c).

-Dan

Builder of Bowser steam! Railimages Site

  • Member since
    January 2009
  • From: Bakersfield, CA 93308
  • 6,526 posts
Posted by RR_Mel on Monday, October 29, 2018 8:25 AM

gregc

the uln2803/4 is a darlington array that is useful as a sink (pulling something to ground).

is there a similar device (octal array) for sourcing (Vcc) higher current?

i've found devices like fdc6401n (dual, hex).

 

I did a lot of research when I was trying to figure out the easiest way to build a high current driver and the highest current I found in a chip (seven channel) was 500ma.  Because my max current is under 100ma I didn’t dig any deeper.
 
I originally went with a Toshiba TD62304 but switched to the ULN2003 because the TD62304 more than quadrupled in price in a year.  I paid just over $1 for the originals and the UNL2003 is 25¢ from a US Seller.  The only spec difference in the two is the TD62304 is inverted and the UNL2003 doesn't need 5 volts.  Samo samo on the connections pin 1 in pin 16 out on both.
 
Switching to the ULN2003 works out better because the sketch is normal now, I didn’t like to change the code for the inverted output anyway.  Now the UNO is interchangeable between LED and high current.
 
 
Mel
 
 
My Model Railroad   
 
Bakersfield, California
 
I'm beginning to realize that aging is not for wimps.
 
  • Member since
    January 2009
  • From: Bakersfield, CA 93308
  • 6,526 posts
Posted by RR_Mel on Monday, October 29, 2018 7:53 AM

NeO6874

Hmm, seems my response didn't send yesterday.  What'd you use to make that card tray, just some aluminum sheet and styrene U-channel?

 

I used 1/16” sheet Aluminum for the top, bottom and sides.  ½” Aluminum angle for the corner bracing.  I drilled and tapped the angle for 4-40 flat head machine screws and counter sunk them for flush mounting.
 
I found some 7 inch nylon card guides on eBay and cut them in half.  I removed the snap-in mounting tabs and glued them to the Aluminum using Amazing Goop (my go to glue for everything but Styrene and wood).
 
As I planned on inserting the Arduinos from the front all the tapered card guide slots are toward the front.
 
 
 
This is a rear view with two UNOS on the left an a MEGA on the right.
 
I made two identical card shelves that fit in the left corner of my control panel so I have room for 16 Arduinos.  The card shelves or racks fit tight in the side compartment so no mounting is necessary.
 
If the ambient temperature in the compartment gets too warm from the DC to DC converters I have a contingency plan for a 3” 12 volt whisper fan to remove the heat.
 
 
 
This is what it will look like when finished, the upper portion of the left panel has Velcro strips to hold a 7” Tablet (view finder for my camera car).  The Tablet was stolen during a break-in last November and I need to order a replacement.  My MRC Prodigy controller slides under the DC 7000 Sound and Power on the right. 
 
I operate my layout dual mode, the Sound and Power for DC and Prodigy for DCC.  The two systems are interlocked using a relay powered off of the Sound and Power, turning on the Sound and Power switches the rails to it and drops the Prodigy.
 
 
Mel
 
 
My Model Railroad   
 
Bakersfield, California
 
I'm beginning to realize that aging is not for wimps.
 
  • Member since
    July 2009
  • From: lavale, md
  • 4,678 posts
Posted by gregc on Monday, October 29, 2018 7:07 AM

the uln2803/4 is a darlington array that is useful as a sink (pulling something to ground).

is there a similar device (octal array) for sourcing (Vcc) higher current?

i've found devices like fdc6401n (dual, hex).

greg - Philadelphia & Reading / Reading

  • Member since
    January 2006
  • From: Northeast OH
  • 2,268 posts
Posted by NeO6874 on Monday, October 29, 2018 4:46 AM

Hmm, seems my response didn't send yesterday.  What'd you use to make that card tray, just some aluminum sheet and styrene U-channel?

-Dan

Builder of Bowser steam! Railimages Site

  • Member since
    January 2009
  • From: Bakersfield, CA 93308
  • 6,526 posts
Posted by RR_Mel on Saturday, October 27, 2018 3:46 PM

I built an Arduino card shelf to hold my Arduinos.  I find having them handy and easy to get to much better than scattered all over my layout.  If I want to change the program it’s a piece of cake.  Finding the ribbon cable for wiring my layout was one of my best finds.  Hundreds of neat looking wires in my “D” rings.  I use the ribbon wire for almost everything on my layout that doesn’t require high current.
 
 
 
I’ve made several changes since I took these pictures, I mounted a cheapo digital panel meter on top of each DC to DC converter so I can easily monitor the voltages.  The converter on the left is set to 1.35 volts for my 1½ volt micro bulbs, the center converter is 5 volts and the one on the right is 8½ volts for all of my 12 volt GOW bulbs.  The converters have an 8 amp rating at ambient cooling and 12 amps with forced air cooling. 
 
The converters are powered from a 12 volt 30 amp switching power supply.  This power arrangement is the best I’ve had in my 60+ years of model railroading, as well as the lowest cost per amp.
 
This is my bench supply.
 
 
Two converters glued to a 12 volt 15 amp switching power supply with two cheapie digital panel meters.
 
Randy, I want to thank you again for all of your help over the years!  You’re help has helped many Forum Members.
 
 
Mel
 
 
My Model Railroad   
 
Bakersfield, California
 
I'm beginning to realize that aging is not for wimps.
 
 
  • Member since
    January 2006
  • From: Northeast OH
  • 2,268 posts
Posted by NeO6874 on Saturday, October 27, 2018 3:15 PM

I like the regulator on-board (although I'm definitely using the complex one - can simplify it pretty heavily) -- don't have to find a home for a buck converter then.

Actually, dropping the register, and a smaller header, those could probably be maybe an inch and a half square ... 

Smaller buildings could be fed from beneath, like we do with signals.

-Dan

Builder of Bowser steam! Railimages Site

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Saturday, October 27, 2018 3:07 PM

 AN 8 pin micro will fit on a very small board. Rather than board mount the resistors, put them near the LEDs, which are mounted in the ceiling anyway. I have no desire to build power eegulatoors on every board I build - instead I am using those small buch converters you can get super cheap - I did find there are two kind, one witht he input and output capacitors mounted witht heir leads perpendicular tot he board edge and ones with them parallel to the edges. The perpendicular ones seem to sometimes have the leads busted loose when the boards get cut apart from their large panels, so far none of the parallel ones I've gotten have that issue. A board with small terminals for the 8 pin micro would be even smaller than this converter module. Using LEDs means no high current drivers to add, and warm white LEDs look perfectly fine to me - though I haven't tried the cheapo Chinese ones which may end up being some odd color temperature and look wrong. 

 Should be able to fit something liek this in all but the smallest shack.

                                             --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 2006
  • From: Northeast OH
  • 2,268 posts
Posted by NeO6874 on Saturday, October 27, 2018 2:29 PM

Good deal Smile 

Trying to think up a decent circuit that'd work in a structure and only need power (so even get rid of ribbon cables) -- but sizing kinda demands SMD things (ugh... it's bad enough with chips, resistors and diodes are just silly)

-Dan

Builder of Bowser steam! Railimages Site

  • Member since
    January 2009
  • From: Bakersfield, CA 93308
  • 6,526 posts
Posted by RR_Mel on Saturday, October 27, 2018 12:54 PM

NeO6874

Nice Smile.  That's $7.50 including the uno, right?  Just about the same as getting 10 of these spun up from the prototype place -- about $6.50 per, although I have a gazillion resistors and capacitors on hand, so I didn't order anything new there.

Yes $7.50 includes the UNO.  Actually I did a closer look at costs and only spent a total of $47 and some change on all eight houses, just under $6 per house for the controllers including the high current driver boards.
 
I install all my Arduinos in my control panel and use flat ribbon cable between the controllers and the structures.  The grey cable is easy to label using a black Sharpie.  I keep an eye open for the ribbon cable and have found it cheaper than using hookup wire or even TELCO frame wire and no spaghetti bowl either.
 
I wire all of my structures with a male micro connector in the basement to keep things neat.  A dual row 2X8 pin for 14 bulb structures and dual row 2X12 pin for 20 bulb structures.
 
 
Click of the picture for full screen
 
I recently picked up a new unused 100’ roll of 26 conductor #28 for $17 free S&H delivered.  Works great for my 20 bulb structures, I parallel four #28s for the 8 volt bulb supply.   With all 20 bulbs on the max draw is just under 800ma (including the Arduinos) at 8½ volts, four #28s works out to 1 amp.  My longest run is 20’ with a drop of .08 volts at max current.
 
 
Mel
 
 
My Model Railroad   
 
Bakersfield, California
 
I'm beginning to realize that aging is not for wimps.
 
  • Member since
    January 2006
  • From: Northeast OH
  • 2,268 posts
Posted by NeO6874 on Saturday, October 27, 2018 12:16 PM

Oh, and for your distributed-lighting plan, something like this?

http://www.djph.net/media/RndLight-8_v1.0.pdf

 

-Dan

Builder of Bowser steam! Railimages Site

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Saturday, October 27, 2018 11:31 AM

 Seems to be ok when you are just recommeneding a place you've gotten good service from. I didn't add the usual "no connection, just a satisfied custoomer" disclaimer since I figured it's pretty obvious I do not live in China and therefore do not own a Chinese company but, just in case - there it is. 

 Also no links, I think most people can find it on their own without posting potentially forbidden links. Then again, after the other week at work - this will make no sense unless you are a Windows administrator, but I had someone ask for help finding GPO (Group Policy) templates for a product. I wasn;t even familiar witht he product, so first I had to look that up. Then I simply types in Google "GPO templastes for <product>" and the very first hit had step by step instuctions to install the required templates and where you copy them from. The person I was helping said he had been tryuing to find the answer on Google but wasn;t having any luck. Seems just too obvious to me to type just those couple words, since it is precisely what is being searched for, but what do I know? I can understand it when I have to get creative and use alternative words for things to find what I'm looking for, that sort of thing  chalk down to experience, in that somewhere in my life I've heard that alternative term and then try that, which may result in success whereas someone not familiar with the alternative term can;t find anything helpful in searches. But this sort of thing - I mean, the phrase I types in was even in the help request sent to me, as this guy said "I can't find the GPO templates for <product>" Copy and paste your last 4 words to Google, voila!

                           --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!