Computer controlled (timed cycle) layout lighting

Post all your model railway electronic problems, solutions and discoverys here.
User avatar
TimberSurf
Posts: 1807
Joined: Wed Jan 08, 2014 5:47 pm
Location: N.Wales
Contact:

Computer controlled (timed cycle) layout lighting

Postby TimberSurf » Sat Jun 11, 2016 1:32 pm

Computer controlled (timed cycle) layout lighting

Computer controlled (compressed time cycle) layout lighting = running a 24 hour cycle of on/off lighting control to simulate a "day" but over a shorter duration (i.e. 2 hours see's rotation through daylight to night to daylight again, then repeats)
This is my current project. Some sophisticated layouts are run to a timetable, so its my intention to do similar, but to a compressed time. This will include the layout functions (lights, motion action accessories, etc.) to be synchronised with the train timetable.
It would be possible to do with electronics (4017's chained together) or with the likes of PIC chips or programmable IC's like Arduino, but my preference for ease, is a PC.
Much investigation lead me to an inexpensive ready made solution LedWiz] (for pinball machines) that gives (PC) USB control of 32 channels. There are many 1,2,4,8 and 16 channel relay output cards available for PC control, but this only gives on/off control. The advantage of the pinball card is that not only do you get 32 outputs (for £30), but each one is completely variable in intensity (255 steps). This not only means complete control of timing, but also maximum final intensity and variable intensity on the fly (special effects). There are four banks of 8 outputs, each could have a different operating voltage as it switches the -VE (neg). If the supply is 5V, then no resistor is needed for LED or 6v Bulbs, or a higher voltage can be supplied (12v, 24v, etc.) but with an appropriate current limiting resistor.
Various special features can be added programmatically, such as Sodium pre-ignition, Sodium starter fail, gas light flicker, TV multicolour flicker, belisha beacons, traffic lights, etc. The list is endless!
There is also a 16 input/16 output card, so reactive elements could be introduced (buttons, red switches, block control, etc.)

I am well on the way, having procured the LedWiz PCB's and some switches and connectors and box. My intent is to have a on/off/on switch per channel, giving permanently ON (test/manual), OFF, and ON (Auto controlled by PC). Housed in a small control panel box, the outputs will be connected to a 37 pin D Sub connector (detachable from layout for testing, moving, rework, etc)
I have written the base code in Visual Basic in a spread sheet, but at a later point, once refined and beta tested, may migrate to an Exe file for distribution as a standalone.
I will start adding further details to this thread, including pics and video and will eventually implant the design and this write up onto my website.
Image
Lumsdonia <--- Hit link to go to my website for full story and wiring advice!

User avatar
TimberSurf
Posts: 1807
Joined: Wed Jan 08, 2014 5:47 pm
Location: N.Wales
Contact:

Re: Computer controlled (timed cycle) layout lighting

Postby TimberSurf » Sat Jun 11, 2016 1:48 pm

Here is the front panel on the PC, its an excel spreadsheet. All controls are there, including three settable time on periods per channel
Attachments
Layout Light Cycle 800.jpg
Excel front end
Layout Light Cycle 800.jpg (157.36 KiB) Viewed 1158 times
Image
Lumsdonia <--- Hit link to go to my website for full story and wiring advice!

User avatar
End2end
Posts: 3367
Joined: Sun Jan 12, 2014 9:58 pm
Location: At the end....... and sometimes at the other end

Re: Computer controlled (timed cycle) layout lighting

Postby End2end » Sat Jun 11, 2016 9:20 pm

Hmm very interesting Timbersurf. I shall be watching this closely. :idea:
Thanks
End2end
"St Blazey's" - The progress and predicaments.
Welcome‎
Planning
Building
St. Blazey's Works & Depot thread

User avatar
TimberSurf
Posts: 1807
Joined: Wed Jan 08, 2014 5:47 pm
Location: N.Wales
Contact:

Re: Computer controlled (timed cycle) layout lighting

Postby TimberSurf » Fri Jun 17, 2016 11:12 pm

Below is a quick sketch, note the PSU I am using is 10A, so I will be fusing 4 circuits to something like (20ma x 30 leds = 600mA) 1 Amp per quarter of the board.
Alternate channels used for clarity as an example

32 CH Lighting Circuit.jpg
Example circuit
32 CH Lighting Circuit.jpg (105.69 KiB) Viewed 1098 times
Image
Lumsdonia <--- Hit link to go to my website for full story and wiring advice!

User avatar
Teedoubleudee
Posts: 44
Joined: Mon Sep 19, 2016 9:13 am

Re: Computer controlled (timed cycle) layout lighting

Postby Teedoubleudee » Mon Sep 26, 2016 9:10 pm

Great thread, will follow with interest.

Tricky Dicky
Posts: 201
Joined: Tue May 03, 2011 10:01 pm

Re: Computer controlled (timed cycle) layout lighting

Postby Tricky Dicky » Fri Sep 30, 2016 1:18 pm

TimberSurf wrote:Here is the front panel on the PC, its an excel spreadsheet. All controls are there, including three settable time on periods per channel


Will a Raspberry Pi not run the spreadsheets? Libre Office has a spreadsheet program quite a few spreadsheet programs have converters to allow other spreadsheet files to be opened. I have not checked out Libre office but that board looks like just the thing the Pi was designed to run.

Richard

User avatar
TimberSurf
Posts: 1807
Joined: Wed Jan 08, 2014 5:47 pm
Location: N.Wales
Contact:

Re: Computer controlled (timed cycle) layout lighting

Postby TimberSurf » Fri Sep 30, 2016 4:03 pm

My personal preference is for a PC, as I have lots (old) lying about and I am highly spread sheet literate and not so much in programing!
I am sure the raspberry would run the code! But the point of a PC is that it comes with the input keyboard/GUI/screen "out of the box". Media centre PC's and notebook PC's are readily available for approx. £100 or less, if second hand and most people are likely to be more familiar with them than programmable units like Arduino/Rasberry etc.

I agree that once the times and modes are set, and the layout functions are static, just a Rasberry could run it (no need for PC) but to set timers and tweak settings, either a PC or some form of touch screen input device would be required! (the cost just shot up from £35!)

The program could be run in Libre Office on a PC, but eventually I would like to make a standalone .exe file in VB so the software would be distributable, rather than messing about in a spread sheet and dll's (spread sheet was convenient to store the timings as a development tool, but ultimately a VB program with lots of variables is all that would be needed)

I don't doubt that some clever wiz kid could write an app on a phone and run it from that!
Anything is possible!
Last edited by TimberSurf on Sat Oct 29, 2016 9:50 am, edited 1 time in total.
Image
Lumsdonia <--- Hit link to go to my website for full story and wiring advice!

User avatar
End2end
Posts: 3367
Joined: Sun Jan 12, 2014 9:58 pm
Location: At the end....... and sometimes at the other end

Re: Computer controlled (timed cycle) layout lighting

Postby End2end » Sat Oct 01, 2016 2:25 pm

I had a crazy thought about this last night.
If you had led lighting made up of strips or connected led's as the layout lighting you could program them in sequence using this to represent the sun moving across the sky during the day. :idea:
For my layout I am envisiging a beam along the length of the layout carrying the lighting which is what brought me to the idea.
Thanks
End2end
"St Blazey's" - The progress and predicaments.
Welcome‎
Planning
Building
St. Blazey's Works & Depot thread

User avatar
TimberSurf
Posts: 1807
Joined: Wed Jan 08, 2014 5:47 pm
Location: N.Wales
Contact:

Re: Computer controlled (timed cycle) layout lighting

Postby TimberSurf » Sat Oct 01, 2016 4:41 pm

The original plan was to use one channel to drive an output with a sinusoidal wave from 0% through 100% to 0% over the 12hr compressed day, fed into a capacitor to smooth the Pulse Width Modulation waveform into varying voltage and then feed that into a circuit board I have bought that converts 0-5V DC input into a mains dimmer output for the room lights. The same could be done with a white light and some blue filters/LED's for the opposing 12hr night as the "moonlight".
If several channels were used, multiple lights could be used spread in an arc across the room and "swap" the peaks across them to imitate movement through the day. This would give a "moving" shadow across the layout.
Modern RGB LED's could be used to set the colour of the lights or careful selection of the colour temperature, spots.
Cool White LED's, would give moonlight 5700K-6500K
Warm White Led's would give daylight 2700K-3200K
Now available up to 12W (1000lumen) and dimmable!
Obviously the above would be in synchronisation with model lighting on the railway!
Image
Lumsdonia <--- Hit link to go to my website for full story and wiring advice!

User avatar
End2end
Posts: 3367
Joined: Sun Jan 12, 2014 9:58 pm
Location: At the end....... and sometimes at the other end

Re: Computer controlled (timed cycle) layout lighting

Postby End2end » Sat Oct 01, 2016 5:44 pm

Day AND night :!: Now there's a prospect.
Could this whole system including the building lights be programmed on, but then run independently of a pc? Like a flash dump of info onto one of the chips on the ledwiz then removing the usb cable from it?

Looking foward to seeing this in action. :) perhaps a time-lapse for a whole cycle?
Thanks
End2end
"St Blazey's" - The progress and predicaments.
Welcome‎
Planning
Building
St. Blazey's Works & Depot thread

User avatar
TimberSurf
Posts: 1807
Joined: Wed Jan 08, 2014 5:47 pm
Location: N.Wales
Contact:

Re: Computer controlled (timed cycle) layout lighting

Postby TimberSurf » Wed Oct 12, 2016 9:25 pm

TimberSurf wrote:I am well on the way, having procured the LedWiz PCB's and some switches and connectors and box. My intent is to have a on/off/on switch per channel, giving permanently ON (test/manual), OFF, and ON (Auto controlled by PC). Housed in a small control panel box, the outputs will be connected to a 37 pin D Sub connector (detachable from layout for testing, moving, rework, etc)

Finally got round to assembling the hardware, slow as there is a lot to solder. Some pics below of half done......
32 switch rear.jpg
32 switch rear.jpg (87.43 KiB) Viewed 836 times

Inards.jpg
Inards.jpg (69.17 KiB) Viewed 836 times

that's the wires to the external connector, needs 32 wires to LedWiz then a PCB full of 32 LED's wired to a connector as the test output
Image
Lumsdonia <--- Hit link to go to my website for full story and wiring advice!

DonB
Posts: 415
Joined: Sun Dec 30, 2007 9:01 pm
Location: Long Eaton
Contact:

Re: Computer controlled (timed cycle) layout lighting

Postby DonB » Fri Oct 14, 2016 4:57 pm

This makes the automation I've used for my lighting (555 timers & relays) look quite clumsy!
Looks interesting. I shall be following progress on this.
Could we have a video when it's all up and running please?
Don

My Layout Thread: viewtopic.php?t=14899

User avatar
TimberSurf
Posts: 1807
Joined: Wed Jan 08, 2014 5:47 pm
Location: N.Wales
Contact:

Re: Computer controlled (timed cycle) layout lighting

Postby TimberSurf » Thu Oct 27, 2016 9:04 pm

Finally soldered up the last connections last night.
Installed the software on my new PC (a huge struggle! ended up having to find a more up to date .DLL)
Got my original breadboard tester reworking on Device 1 (I have 3 boards [Device 1-3])
Then tried my old PC on Device 2, nothing ! arg!
Eventually worked out its my software, forgotten to put a line in to send program 2 to Device 2! :oops:
Connected the above switch system and a test light board (made specifically for testing). Wonders never cease, it all works!
One light is not working, so needs some diagnostics in the switch box, something for tomorrow night, then I will release a video!
Image
Lumsdonia <--- Hit link to go to my website for full story and wiring advice!

User avatar
hockeyshooter
Posts: 6
Joined: Thu Feb 09, 2017 10:22 pm
Location: near Milton Keynes, UK
Contact:

Re: Computer controlled (timed cycle) layout lighting

Postby hockeyshooter » Thu Feb 09, 2017 11:10 pm

Interesting. 500mA per channel is a lot - although it does say you must not try to pull that from all channels at once! Once programmed, can you disconnect the computer and it will then just plod on by itself to the schedule you've set or does it require the computer to be connected all the time?

User avatar
TimberSurf
Posts: 1807
Joined: Wed Jan 08, 2014 5:47 pm
Location: N.Wales
Contact:

Re: Computer controlled (timed cycle) layout lighting

Postby TimberSurf » Thu Feb 09, 2017 11:21 pm

Hello and welcome to the forum hockeyshooter
Unfortunately it needs a host (PC) attached to work. It's just dumb I/O, no processor or memory.
But it is cheap for 32 outputs and they are PWM controllable (unlike lots of PC output cards that just fire relays)
As its USB, anything can control it, so Arduino, Raspberry etc or an old 286 PC would do!
Image
Lumsdonia <--- Hit link to go to my website for full story and wiring advice!


Return to “Electronics”

Who is online

Users browsing this forum: No registered users and 1 guest