Pages

Tuesday 22 July 2014

My new clock

 I was using the pilite on a Raspberry Pi for a scrolling time display, but I had a problem with it. And anyway, a matrix of 14 by 9 pixels is a bit ... limiting. Then I saw something that gave me an idea.

http://www.amazon.co.uk/gp/product/B00DUU9D64/ref=s9_simh_gw_p263_d0_i3?pf_rd_m=A3P5ROKL5A1OLE&pf_rd_s=center-2&pf_rd_r=1Y21Y7P62VAMVGYP5N25&pf_rd_t=101&pf_rd_p=455344027&pf_rd_i=468294

It's a 4.3 inch monitor, resolution 480 by 272, and it's only £11 - it's designed for using in a car as a DVD display, and to show the view from a reversing camera. I decided not to get the seven inch version, which costs £10 more, and has the same resolution. It'll be just as hard to read.

I bought one, and it arrived yesterday. I plugged it onto 12 volts of power, and into the Raspberry Pi, and it worked straight off. The Pi booted up, and I could see the boot process on the small screen.

You can read the text, just about, if you screw your eyes up, but I didn't expect it to be as good as that. And you can run X-windows, but reading any text will be just as difficult. So what, you're wondering, is the use of a monitor where you can't really read the text?

Enter figlet. You install it with "apt-get install figlet" and it converts this:

17:54

into this:

           #      #######     #     #######    #         
          ##      #    #     ###    #          #    #    
         # #          #       #     #          #    #    
           #         #              ######     #    #    
           #        #         #           #    #######   
           #        #        ###    #     #         #    
         #####      #         #      #####          #    


Which can be read, very easily.

I have an external temperature monitor, that's telling me that it's 29 C outside right now. And I have a monitor that counts the number of distress emails I've had from my servers. And I put all that together, and got this:


And that is readable from across the room.

It wasn't all straightforward. When I told figlet to display the banner from inside my perl program, nothing happened. So I wrote the banner to a file, and I use a bash script to display that file, every five seconds. There's maybe a more elegant way to do this, but - as long as it works!

The Pi wants 5 volts, the monitor wants 12. So I use a 12 volt power supply (a wall wart), and use the 12 volts directly for the monitor, and put it through a step-down DC-DC device to get the 5 volts, so I can run both the Pi and the monitor off the same power supply.

If there's no activity on the keyboard for several minutes, linux blanks the screen. To avoid this, you do "setterm -blank 0"


Computer clocks are notoriously inaccurate. So I have a server that consults a reference time server each day and updates its time from that. All my other servers, including this Pi, update their time once per day from my time server. So it shouldn't ever be more than a couple of seconds out.

For the future ... it occurs to me that I have a dozen or more Raspberry Pis doing various important functions. For example, I have one computer whose function is to gather email from all the various email addresses that I have (probably around 50), put them through a despammer I wrote, and lets me access all my email in one place. It's an important function, and I entrust it to a Raspberry Pi because that Pi has been running nonstop for 536 days now.

I could put a 4.3 inch monitor onto some of them to give me real-time readings of ... well, I don't know what. I'll give it some thought. But if I can put a small monitor onto a Pi for £11, there's going to be some things I can do.

... update ... On Ebay, I just bought a five inch monitor, which seems to be very sure that it's 800 by 480 pixels, for £12.79, free postage. I won't see it for a couple of weeks, though, it's coming from China. At that resolution, it'll probably be good enough to use as a monitor, although it might be that the PAL output from the Pi is the limitation.

 ... update ...

The screen blanks after a number of minutes. to stop that happening, edit /etc/kbd/config
and set BLANK_TIME=0

4 comments:

  1. Is this http://www.ebay.co.uk/itm/800-480-HD-5-Inch-Car-Vehicle-TFT-LCD-Monitor-Screen-2ch-Camera-Video-For-VCR-/261533909090?pt=UK_In_Car_Technology&hash=item3ce4a2c062?

    How do you connect them to the pi? They seem to have AV cables for signal and power?

    ReplyDelete
  2. http://pihard.blogspot.com/2013/09/hack-43-inch-tft-display-to-run-on.html might be useful as it covers how to power that sort of screen from 5v / USB.

    Other possibly helpful links:
    http://www.raspberrypi.org/forums/viewtopic.php?f=64&t=17651
    http://www.wisegai.com/2012/11/29/raspberry-pi-using-a-3-5-tft-car-monitor-optional-powered-using-usb/

    ReplyDelete
  3. You connect to the pi, by plugging the lead from the monitor, into the pi's composite port. That's the yellow one.

    ReplyDelete
  4. That looks very nice. I'll see if I can think of a use for one for me!

    ReplyDelete