Jump to content
  • entries
    58
  • comments
    140
  • views
    34,473

Hot Spots & Speedos

GWMark

501 views

Continuing in my catch up of things I have done in the last 12 months…

I am a bit of a sucker for gadgets, so when I came across a chip that offered simple and cheap WiFi I started to think about using it for model railway purposes. I found on ebay a little board that had the WiFi chip on it, along with all the circuitry needed to make the thing work, the ESP-01 board. It was available for about £4 from the UK or about £1 direct from China - I had to have a play. The chip in question, an ESP8266, is not just a WiFi chip but also an embedded microprocessor, with input/output pins and all the usual features of such a processor.

So I came up with the idea of adding a rotation sensor to a wagon wheel and programming this chip so that it counted the wheel rotations, did a simple bit of maths to work out the speed and offered a website that gave the current speed, average speed and distance travelled. Almost everything I needed was already on the little board I could buy from ebay, all I needed to do was to interface a rotation sensor and write some software to download into the processor.

Since I wanted to make this battery powered rather than rail powered - because I wanted to use it on both DC and DCC and wanted the peer to stay on when the train as stationery - I went for a rather large wagon to house the circuitry and battery, a Parkside Dundas kit of a GWR Mink G.

blogentry-7152-0-38807600-1433157509_thumb.jpg

The wheel sensor consists of an LED and phototransistor built in to a single unit, known as a photo-interrupter. I small brass strip was soldered to a 2mm wheel bearing and inserted on the axle of the wagon. A slot was cut in the bottom of the wagon, above the axle, for the sensor to poke through and the sensor built onto a small piece of stripboard with a socket for the ESP01 board.

blogentry-7152-0-02879400-1433157538.jpg

Every half revolution of the wheel the light beam is interrupted. So using simple maths, pi * d is the circumference of the wheel, the time between the beam being interrupted is measured in microseconds and hence the distance covered in the time can be worked out and the speed, allowing for the scale, can be determined. Remembering of course to divide the distance by 2 since the beam is interrupted twice per revolution.

It was fairly easy to write the code that was to be downloaded into the little ESP-01 board, this basically allowed the board to connect to my household WiFi whilst at the same time being a WiFi hotspot of its own. This meant I could connect a laptop, phone or tablet to the WiFi hotspot housed in the wagon and use the wagon anywhere I liked. As well as being a hotspot the software was also a web server, so I standard web browser, such as the one you are reading this with, could connect to the wagon and display a page with all the data about the wagons speed and distance traveled.

blogentry-7152-0-59918400-1433157576_thumb.png

I still have things I want to do to this; the switch will be changed and made accessible without having to remove the roof, which is currently held on with a magnet. I want to replace the battery with a possibly smaller rechargeable one and have it charged via the track power - when it is available. I also want to add more to the software so that it not only has the current speed and distance, the speed and distance for the current trip but also for the lifetime of the wagon. The definition of "trip" is based on a configurable period of non-movement - i.e. if the wagon doesn't move for a given time, default 1 minute, a new trip is started. I also want to improve the configuration interface via the website it offers.

The other thing I am thinking about would be to provide an application on my laptop that gathers the data every few seconds and draws graphs of speed, acceleration etc, just to see how comfortable we make trips for little passengers!

Clearly this is just a bit of fun, but I can see a lot of other possible uses for this sort of cheap WiFi technology, especially for the likes of garden railways to setups in which lots of control wiring is difficult. These things are really a spinoff form the current buzz around the "Internet of Things", but I think us modellers can take advantage of this trend.

  • Like 6


1 Comment


Recommended Comments

As a 15 yr old modeller - this is cool! You could also attach a vibration sensor to add further data to passenger comfort charts.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.