Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I need to create an information service on trains to deliver live information. I am looking for some ways to go about this.

There are already existing LCD monitors in many of the train wagons. They are powered from the battery. When the train is moving, I would like the screens to display the following information: i) about the route, next stops etc. ii) news items iii) video adverts to be shown when the train is within a GPS 'corridor'.

For this to work, we need to place GPS on board. We also need to be connected to the internet to be able to get live data (for the news items) and to be able to push new video content when it becomes available. I don't want to have to visit each train wagon just to load up new data.

I had originally thought I would need to have an app built in Android that did all this, but I think it would be easier all round if I could get this to work via HTML5 on a browser. So far I have come up with the following 2 hardware possibilities:

1) Buy cheap, 2nd-hand tablets with broken screens (as I should still be able to control it using a mouse). They should have GPS capability either in-built or via a dongle and be internet-enabled (likely a SIM card). Output the display to the LCD screen. 2) Install a laptop with the same capabilities.

With 1) it is possible to buy older tablets or with cracked screens etc. so the cost can be kept lower, although it would be impossible to get a standard type (which would be far easier to maintain). They can be bolted onto the back of the monitor. The disadvantage is that the output from the tablet may not be high enough resolution when blown up onto an LCD

With 2), a laptop, the resolution issue can be more easily overcome. It also may be easier to source working laptops with broken/missing screens.

I imagine that I will need to send information about the GPS location to a server every 10 seconds or so, maybe in a simple GET in a URL, so that I can present the information on a web-page. This might work for information like the next stop, and news feeds, but the videos will likely be longer than 10 seconds. So how do I deliver the content?

Among the things I am wondering is if a browser connected to the internet can do all this. The location needs to be continually updated. Instead of simply playing everything on a loop, things happen when the train is in certain areas e.g. approaching/leaving a station. One way to do it is send the GPS data back every 15 seconds and then refresh the browser web-page to display content based on that GPS location and direction.

Additionally, would video content cache correctly? When a browser needs to show that content, it would be nice if there wasn't a lot of lag as it tries to download a new video (or display an existing one).

And, although using machines with broken screens, which are more cost-effective and less of a target for theft, they become less user-friendly. What happens in the event of a power-outage? It is possible to reboot everything correctly to have the browser displaying everything and connected to the GPS and internet?

Lots for me to solve :)

share|improve this question
1  
You are planning to use one machine per LCD screen? Sounds like a maintenance nightmare. Did you consider to use just one machine per train, placed in a locked room, combined with a video wall controller? For example, look here: 9xmedia.com/new/products/multi-screen-pc.php (there are other vendors as well). –  Doc Brown Dec 26 '13 at 22:05
1  
I would also reccomend against second hand equipment. How about a raspberry pi to drive the lcds? raspberrypi.org –  jdv-Jan de Vaan Dec 26 '13 at 22:13
    
The one machine per train is a good idea, although I would like to make the system usable in other forms of transport e.g. buses. The Raspberry Pi is a possibility - it would be less expensive and the same system for all to look after. As far as browsers go, I think I have Midori, Netsurf, Chromium and Luakit. I haven't used any of these yet (or Raspberry Pi). Any ideas on how I should obtain and deliver the content? –  user1194034 Dec 26 '13 at 22:54
    
Just curious: how were those LCD monitors used before? Doesn't there exist already some infrastructure to supply them with content? And what about the powersupply "from the battery"? Do you mean "from the train waggons' batteries, which are automatically recharged?" Or do they have their own batteries which can run out of power? –  Doc Brown Dec 27 '13 at 9:32
1  
Have a look at this, experiments into using cheap Chromecast devices for digital signage in a museum: labs.cooperhewitt.org/2013/… Open source as well. –  Hugo Dec 27 '13 at 11:53

1 Answer 1

up vote 1 down vote accepted

Content management in this kind of environment can actually be pretty tricky business, depending on what you want... I would try to keep it simple.

You will need an application on the client side that is responsible for loading data. This could be as simple as a script that runs as a cron-job on a little linux box (like raspberry-pi) that runs once a day (at 2am if possible) which would kickoff an RSYNC to a folder stored on your central server. This script would need to be smart enough stop the user visible UI, do the RSYNC, check the data to make sure its not corrupted (by maybe computing an checking a hash code), and then restart the user facing UI. Please note that this component could also be something very sophisticated that runs all the time and establishes a persistent TCP connection with the server where an administrator could push updates to the device(s) on demand. Whatever it is, this component needs to be extremely robust... and able to recover from errors. Use Python ;)

If you are using RSYNC you could keep a separate folder for each train or route in order to keep the volume of transferred data down.

The user facing component could be written as a stand alone app in the preferred language for the platform (java for android) or in HTML5/Javascript or in a mixed application (Maybe java or QT UI with an embedded web browser?). The code/binaries for this component could be shipped to the device via your data distribution mechanism. The app would monitor the GPS coordinates and display content as necessary (assuming all the content is pre-loaded). The content needs to ship with meta-data to let the UI know when/where to display content.

The complexity of the central server will scale with the complexity of the client application and the capabilities you want...You might want to write a web app with a nice REST interface for the clients to use, or not. You probably want implement some way for client applications to inform you of problems (a crashing load). This could be done by exposing a REST interface for clients to use...

Rasberry Pi would be a good choice for client side hardware. Check out the following:

http://www.cooking-hacks.com/3g-gprs-shield-for-raspberry-pi-3g-gps

(Disclaimer: I've never used this so have no idea how well it works.)

share|improve this answer
    
Thank you for the advice. As far as hardware I am probably looking at: Raspberry Pi Model B, 3G/GPRS shield for Raspberry Pi, 3G antenna, GPS antenna, Case, Power supply, HDMI to DVI cable, SD card storage. Not an inexpensive solution, but it should do the job. For software, it looks like I should be brushing up on Linux and building a REST service :) –  user1194034 Dec 27 '13 at 2:22
    
Using a Raspberry Pi is a good idea, but I would still tend to have a intermediate server on the train which works as an interface between the internet and the raspberry clients, and also as a cache for the content. So the GPS and internet connection will only be needed on that server, and new content has to be uploaded over the internet only to the server, which then distributes it to the clients by local Wifi. –  Doc Brown Dec 27 '13 at 9:22
    
I would recommend against long-term use of RSYNC. Yes, it is simple and available on any Linux platform. However, it breaks as soon as you try to scale or create a high-availability cluster. Maybe use it as you get started, but structure your code in a way that you could easily swap out for a web service later. I'm a big fan of REST too ;) –  Michael K Dec 27 '13 at 15:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.