A Home Wi-Fi Connected Garden Railway

What is your latest project?
User avatar
tom_tom_go
Driver
Driver
Posts: 4824
Joined: Wed Feb 23, 2011 3:08 am
Location: Kent, UK
Contact:

Re: A Home Wi-Fi Connected Garden Railway

Post by tom_tom_go » Tue Mar 13, 2018 8:14 pm

Any videos of a running session with multiple locos?

Southern188
Cleaner
Cleaner
Posts: 40
Joined: Thu Jan 11, 2018 8:37 am
Location: Dorset

Re: A Home Wi-Fi Connected Garden Railway

Post by Southern188 » Wed Mar 14, 2018 8:52 am

Sorry Tom, not yet.

Michael

User avatar
tom_tom_go
Driver
Driver
Posts: 4824
Joined: Wed Feb 23, 2011 3:08 am
Location: Kent, UK
Contact:

Re: A Home Wi-Fi Connected Garden Railway

Post by tom_tom_go » Thu Mar 29, 2018 9:32 am

I have had time to read this again properly and using the track to charge the loco is a brilliant idea.

Do you have sections of the line outside that are powered so the loco can stop and charge up?

Southern188
Cleaner
Cleaner
Posts: 40
Joined: Thu Jan 11, 2018 8:37 am
Location: Dorset

Re: A Home Wi-Fi Connected Garden Railway

Post by Southern188 » Thu Mar 29, 2018 4:54 pm

Yes, I have a one 3 foot section of track powered and park the loco there to charge. It could be extended to top up the charge during normal use but I haven't found a need for that.

Michael

Southern188
Cleaner
Cleaner
Posts: 40
Joined: Thu Jan 11, 2018 8:37 am
Location: Dorset

Re: A Home Wi-Fi Connected Garden Railway

Post by Southern188 » Wed Apr 25, 2018 8:54 am

Location and Automation

I've fitted an L&B open wagon with various experimental circuits. This includes a location device, sound and eventually a camera.

I've looked at various ways of impementing location detection. Ideally GPS would have been good but it isn't accurate enough at this scale. There is also magnets and Infra-Red which is commercially available for LGB type layouts. I've tried magnets, with two sensors either side of the wagon and that sort of works but in the end I decided to opt for RFID (radio frequency identification) contactless cards.

There are two main types of contactless cards Those that operate at 125kHz are used in security and access control. Those that operate at 13.5Mhz are used in banking and concession bus passes. I've tried both but have chosen 125kHz because of the greater range and the aerial is easier to hide.

card reader.jpg
card reader.jpg (31.78 KiB) Viewed 8801 times

The cards (painted and hidden with ballast) are placed under the track and the card reader is located in the wagon with the coil underneath. As the wagon passes over the card it will register the card number and from this the location will be known. The cards can be read at a distance up to 3cms but because the train is moving, the coil has to be placed closer than this to give time for the card to be powered and to transmit it's serial number.

The location id will be sent as an MQTT message for any other device to see. The hand-held controller and PC controller will display the named location and locos will use it for automatic operation.

The components within the wagon are:
   PCB containing Wemos D1 mini microcontroller, step-up regulator and Dfplayer sound chip
   RDM6300 125Khz control board
   Lithium battery and associated charing/protection circuitry
   Loudspeaker
   Coil (underneath)

The automation schedule is programmed using a simple code. This is downloaded from a textfile on the Raspberry Pi when the loco is switched on, so it can be easily changed. A future option will enable the hand-held controller to select from a number of different schedules.

Each line of the schedule contains the following:

   location id, mode, speed, stop time, options (in binary for clarity), acceleration/de-acceleration (milliseconds per speed unit) and points
  where:
   mode = 1 (normal), 2 (timed stop), 3 (random timed stop)
   options are not used, n/u, n/u, n/u, token, whistle, lamp on, direction (0=forward, 1=reverse)

Example schedule:

0, 2, 8, 10, 00000010, 400, 0 // Auto start initial settings: wait 10 seconds, then speed = 8, lamp on, acc = 400
1, 1, 14, 0, 00000110, 400, 0 // normal, speed = 14, lamp on, whistle, forward, acc = 400,
16, 1, 16, 0, 00000010, 200, 0 // normal, speed = 16, lamp on, forward, acc = 200,
20, 1, 10, 0, 00000010, 200, 0 // normal, speed = 10, lamp on, forward, acc = 200,
66, 2, 9, 40, 00000000, 400, 0 // timed stop, stop for 40 seconds, then speed = 9, lamp off, forward, acc = 400
72, 1, 12, 0, 00000010, 400, 0 // normal, speed = 12, lamp on, forward, acc = 400
0 // Repeat from second entry

The points field is for future use. The loco will send the points field as a message at each location. The ESP8266 controlling the points will receive this message and adjust the points accordingly.

The token option is again for future use. I'm looking forward to implementing this.

Following widespread testing, I've realised that using a wagon for location is much easier than installing it in each loco. The coil assembly is also less noticeable under a wagon. The wagon will eventually be covered so that the electronics aren't visible and I am also going to include the circuitry in a coach.

Here's a video of a loco under automatic control on an extension that is currently under construction. There are 3 cards on this section, the one on the curve slows the loco as it approaches the station and one at the station brings the loco to a halt. The loco will start again after the appropriate delay.

https://youtu.be/Vxh79lHODzM

Must stop hummimg when I take a video!


Michael

User avatar
gregh
Trainee Driver
Trainee Driver
Posts: 566
Joined: Sun Apr 01, 2018 5:44 am
Location: Sydney, Australia
Contact:

Re: A Home Wi-Fi Connected Garden Railway

Post by gregh » Wed Apr 25, 2018 11:05 am

I am just flabbergasted at your skills.
It's always great to read about a project that is 'pushing the boundaries', even if way beyond my skills or needs.

Just to add a little about using servos etc outside. I use Picaxe outside, usually in a small clip lock food container, which is then inside a building. Plenty of vaseline on the picaxe pins. Servos are in buildings or even in small signalling 'cupboards. No problems in 15 years, but we don't get snow here.
Greg from downunder.
The Sandstone & Termite's website: https://members.optusnet.com.au/satr/satr.htm

Southern188
Cleaner
Cleaner
Posts: 40
Joined: Thu Jan 11, 2018 8:37 am
Location: Dorset

Re: A Home Wi-Fi Connected Garden Railway

Post by Southern188 » Tue Aug 14, 2018 10:04 am

Belated thanks to Greg for his comments. Here's an update.

Thanks to Virgin Media there has been a change to the wi-fi system. After they dug up the road I waited a year before signing up but whilst the speed is fast the router is not very good. The original wi-fi was a repeater in the summerhouse but the VM router cuts out occassionally so everything now runs off a completely separate network using the original BT router.

The good weather means that trains are running most days and the system is proving very reliable, though there has been the odd problem. The auto mode is great especially when Al fresco dining, gardening or just relaxing watching the trains go by.

I have a new hand-held remote control. I realised that if something happened to the original it's not something I could buy from Ebay. Also, the PCB push button on the original were proving unreliable. The new one is in the same type of case but now has proper case mounted buttons and two rotary controllers so I can easily control 2 trains at once. This meant that I needed more I/O lines so I have updated the micro-controller to an ESP32. This incorporated battery management so the electronics is now the ESP32, LCD display and battery only.

I have a new loco (Accucraft Yeo) which has been updated and my first points working controlled from an ESP8266. The remaining 3 points will be connected over the winter.
P1000456.JPG
P1000456.JPG (268.37 KiB) Viewed 8445 times
P1000472-001.JPG
P1000472-001.JPG (300.7 KiB) Viewed 8445 times

There is an interesting article on page 38 of the August 2018 edition of Garden Rail. It's wierdly entitled 'Wireless DCC, "learning the lessons of leaves on the line"' and it's by Dagnall Clutterbuck. It's how he has used ESP8266 modules in his outdoor railway. Like myself he is using MQTT but his locos are DCC controlled. I'm not alone :) .

Michael

User avatar
FWLR
Driver
Driver
Posts: 4262
Joined: Sat Aug 05, 2017 9:45 am
Location: Preston, Lancashire, UK

Re: A Home Wi-Fi Connected Garden Railway

Post by FWLR » Wed Aug 15, 2018 7:56 am

Nice looking loco that Yeo.

The electric board underneath, would it not be susceptible to all the muck the world throws at it…

Southern188
Cleaner
Cleaner
Posts: 40
Joined: Thu Jan 11, 2018 8:37 am
Location: Dorset

Re: A Home Wi-Fi Connected Garden Railway

Post by Southern188 » Wed Aug 15, 2018 10:26 pm

Yes Rod, a nice looking loco, Accucraft have done a good job. The electronics have been in the same position in my Lew, which has been running for 4 years. No problems with muck so far.

Michael

User avatar
tom_tom_go
Driver
Driver
Posts: 4824
Joined: Wed Feb 23, 2011 3:08 am
Location: Kent, UK
Contact:

Re: A Home Wi-Fi Connected Garden Railway

Post by tom_tom_go » Thu Aug 16, 2018 11:51 am

I think isloating this setup from your home network is a good idea anyway.

User avatar
FWLR
Driver
Driver
Posts: 4262
Joined: Sat Aug 05, 2017 9:45 am
Location: Preston, Lancashire, UK

Re: A Home Wi-Fi Connected Garden Railway

Post by FWLR » Fri Aug 17, 2018 8:51 am

Thats great to hear Michael. Do you have anymore videos of it running please.

Southern188
Cleaner
Cleaner
Posts: 40
Joined: Thu Jan 11, 2018 8:37 am
Location: Dorset

Re: A Home Wi-Fi Connected Garden Railway

Post by Southern188 » Fri Jun 12, 2020 8:42 am

It's been a while so I thought I would update this thread with the latest developments on my railway.

My railway has expanded, and there are now 13 items controlled by ESP8266 and ESP32 processors. There are 7 locos (1 steam), 2 wagons (sound and location), a railway station (sound, lights and 6 points), 2 handheld remote controllers and one central controller.

The main change has been the removal of the wi-fi network! Whilst it worked well it had it's disadvantages, required external power for the router, 15 seconds startup for router and each device and was difficult to run my locos elsewhere.

I now use ESP-Now, a peer to peer protocol developed by the manufactures of the ESP range of processors for direct wireless communication. It effectively works like a 2.4Ghz wireless keyboard communciations with a computer. In practise it works well, all devices can communicate with each other and has the advantage of being instantaneous and is low power. If I had known about this protocol earlier I probably wouldn't have gone down the wi-fi network route, but it has been fun and that's what hobbies are all about :) .

The automation mode continues to be an nice option to use and can now control 6 points, following the addition of a points controller. The addition of a LGB KGF field loco and an Accucraft Baguley Diesel to the fleet means that these can be setup to run automatically whilst the main locos are operating.

https://youtu.be/1BOpqjPOD0E

Lockdown projects have seen the addition of an electronic token system which allows multiple locos to operate without them running into each other, a doubled headed option and several new buildings.

https://youtu.be/a-R3EhYzYSA


Michael
Last edited by Southern188 on Fri Jun 12, 2020 10:16 am, edited 1 time in total.

User avatar
ge_rik
Administrator
Administrator
Posts: 6497
Joined: Sun Oct 25, 2009 10:20 pm
Location: Cheshire
Contact:

Re: A Home Wi-Fi Connected Garden Railway

Post by ge_rik » Fri Jun 12, 2020 9:00 am

Sounds intriguing. I've tried doing a web search for more info but not found much so far. Can you recommend a good source?

Rik
------------------------
Peckforton Light Railway - Blog Facebook Youtube

User avatar
philipy
Moderator
Moderator
Posts: 5033
Joined: Sun Jan 30, 2011 3:00 pm
Location: South Northants

Re: A Home Wi-Fi Connected Garden Railway

Post by philipy » Fri Jun 12, 2020 9:31 am

Rik,
I suspect that "EPS" should read "ESP"?
https://www.espressif.com/en/products/s ... w/overview
Philip

Southern188
Cleaner
Cleaner
Posts: 40
Joined: Thu Jan 11, 2018 8:37 am
Location: Dorset

Re: A Home Wi-Fi Connected Garden Railway

Post by Southern188 » Fri Jun 12, 2020 10:18 am

Thanks Philip, yes that's the correct link and I've corrected the typo.

User avatar
FWLR
Driver
Driver
Posts: 4262
Joined: Sat Aug 05, 2017 9:45 am
Location: Preston, Lancashire, UK

Re: A Home Wi-Fi Connected Garden Railway

Post by FWLR » Sat Jun 13, 2020 11:14 am

Very nice smooth operating. Are you operating both locos from the same controller :?:

Great videos by the way :thumbright: :thumbright:

User avatar
ge_rik
Administrator
Administrator
Posts: 6497
Joined: Sun Oct 25, 2009 10:20 pm
Location: Cheshire
Contact:

Re: A Home Wi-Fi Connected Garden Railway

Post by ge_rik » Sun Jun 14, 2020 10:33 am

Southern188 wrote: Fri Jun 12, 2020 10:18 am Thanks Philip, yes that's the correct link and I've corrected the typo.
Thanks to you both. Looks interesting.

Rik
------------------------
Peckforton Light Railway - Blog Facebook Youtube

Southern188
Cleaner
Cleaner
Posts: 40
Joined: Thu Jan 11, 2018 8:37 am
Location: Dorset

Re: A Home Wi-Fi Connected Garden Railway

Post by Southern188 » Sun Jun 14, 2020 10:52 am

FWLR wrote: Sat Jun 13, 2020 11:14 am Very nice smooth operating. Are you operating both locos from the same controller :?:

Great videos by the way :thumbright: :thumbright:
Thanks Rod. I modified my remote control to send the same speed signal to both locos. Was rather pleased and surpised when it worked so well.

My remote control has two knobs, normally used for controlling 2 locos. In doubled heading mode, the left one controls the speed to both selected locos and the right one can provide a speed offset in case the locos are not matched. As I only use the same type of loco from the same manufacturer, I haven't found this necessary yet.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests