{"id":1074,"date":"2003-05-13T14:29:43","date_gmt":"2003-05-13T13:29:43","guid":{"rendered":""},"modified":"2017-03-08T11:33:35","modified_gmt":"2017-03-08T11:33:35","slug":"diy-cheap-and-easy-colour-lcd-panels","status":"publish","type":"post","link":"https:\/\/automatedhome.com\/hardware\/diy-cheap-and-easy-colour-lcd-panels.html","title":{"rendered":"DIY Cheap and Easy Colour LCD Panels"},"content":{"rendered":"<p style=\"text-align: left;\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"\/images\/reviews\/ant_small.jpg\" alt=\"\" width=\"150\" height=\"100\" \/><br \/>\nSubmission by <a href=\"mailto:ant@ant.org\">Ant<\/a>\u00a0&#8211;\u00a0If I started talking to you about LCD panels for home automation use, you&#8217;d probably start thinking about kit from the sort of suppliers that you&#8217;re vaguely aware of in the same way you&#8217;re aware of the outer planets: you know they&#8217;re there, but you&#8217;re unlikely to ever have anything to do with them.<\/p>\n<p style=\"text-align: left;\"><div class=\"sj-gblock\">\n<script language=\"javascript\">\n<!--\ngoogle_ad_client = \"ca-pub-5598479065369258\";\ngoogle_ad_width = 300; \ngoogle_ad_height = 250; \ngoogle_ad_format = \"300x250_as\"; \ngoogle_ad_channel = \"7058025304\"; \ngoogle_ad_type = \"text_image\"; \ngoogle_color_border = \"FFFFFF\"; \ngoogle_color_bg = \"FFFFFF\"; \ngoogle_color_link = \"52a79f\"; \ngoogle_color_url = \"CFFFDF\"; \ngoogle_color_text = \"000000\"; \n\/\/--> \n<\/script>\n<script language=\"javascript\"  src=\"http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\"><\/script>\n<\/div>But if I told you that this was a DIY project, I&#8217;d probably put you in mind of some sort of 2-line LCD PIC bodge job, of the sort favored by UKHA&#8217;s inner sanctum of &#8220;How Much?! I&#8217;ll build it myself!&#8221; ubergeeks. And I mean no disrespect here, as I&#8217;m one of them.<\/p>\n<p>This project is about neither of the above approaches. You probably won&#8217;t even have to get a soldering iron out. Some C or C++ coding skills might be of use &#8211; at least until there are ready-to-use apps available. What we&#8217;ll end up with when we&#8217;ve finished is an LCD control panel with the following features&#8230;<\/p>\n<ul>\n<li>2.9 inch colour TFT screen with backlight, capable of displaying 65,536<br \/>\ncolours at 240&#215;160 pixels, at 60Hz<\/li>\n<li>ARM7TDMI 32-bit RISC processor running at 16.78 MHz<\/li>\n<li>16kb BIOS<\/li>\n<li>256kb on-board RAM<\/li>\n<li>32kb fast cache RAM<\/li>\n<li>96kb Video RAM<\/li>\n<li>up to 32mb flash\/ROM memory<\/li>\n<li>hardware graphics acceleration for multiple bitplanes, sprites, windowing,<br \/>\neffects, transformations<\/li>\n<li>6 channels of 8-bit stereo audio (2 DACs, onboard harmonic synthesis &amp;<br \/>\nnoise generators)<\/li>\n<li>Li-Ion rechargeable battery<\/li>\n<li>10 buttons<\/li>\n<li>UART configurable for standard operation, or multidrop serial operation<\/li>\n<li>downloadable software, or run from flash\/ROM<\/li>\n<li>several <em>free<\/em> development environments &amp; many development resources<\/li>\n<li>fully documented architecture<\/li>\n<\/ul>\n<p>By now you&#8217;re probably thinking that I&#8217;ve inhaled too much of the old solder\u00a0flux. What about if I told you that this little lot would set you back under<br \/>\na tonne? And that you can go buy it on the High Street? \u00a0OK, enough teasing &#8211; I&#8217;m sure the more astute readers have guessed what I&#8217;m\u00a0describing, and the remainder will shortly be thumping themselves in the &#8216;nads\u00a0with belated realisation.\u00a0What we are talking about here, ladies and gents, is Nintendo&#8217;s GameBoy Advance.<\/p>\n<p>The GameBoy Advance (GBA henceforth) has until recently been a rather nasty\u00a0little customer, with a truly horrid screen and a penchant for batteries in\u00a0large quantities, topped off by an ugly plastic case available in a wide selection\u00a0of entirely awful trendy colours. In short, not the sort of thing you&#8217;d want\u00a0to bolt to the wall of your gaff. Fortunately, Nintendo have recently released\u00a0the GameBoy Advance SP, which addresses the above issues by providing a backlight\u00a0for the screen, a rechargeable Li-Ion battery, and a natty clamshell design,\u00a0which makes the unit about the same size as a stack of 3 minidiscs. Click the\u00a0thumbnails below for a better look.<\/p>\n<p align=\"left\">I originally picked up one of these because of a game called Metroid\u00a0Fusion. I&#8217;m not generally partial to console games, but this was by way of an\u00a0homage to it&#8217;s precursor &#8220;Super Metroid&#8221; on the Super Nintendo, which\u00a0once saw me and my best friend skiving off work for a week in order to complete\u00a0it. The game was utterly\u00a0marvellous, but after completing it, I started eyeing\u00a0up my pretty new GBA in a way which had it feeling somewhat uneasy.<\/p>\n<p align=\"left\">Surely, I reasoned, there must be some more useful, geeky, and\u00a0altogether Ant-like purpose to which you might be put? After faffing about on<br \/>\nthe internet for a happy couple of hours, I determined that the GBA internals\u00a0were quite well documented, that all the tools necessary were available for\u00a0free, and that the additional outlay was minimal.<\/p>\n<h2 align=\"left\">Assembling the hardware<\/h2>\n<p align=\"left\">For starters, you&#8217;re going to need a GBA SP, or even the old GBA,\u00a0available from the likes of Dixon&#8217;s. The SP will set you back about 80 quid,\u00a0and I&#8217;ve seen the regular GBA going for around 50. All we need in addition to\u00a0this little setup is a programming cable, and optionally a FLASH cartridge.<\/p>\n<p align=\"left\">The programming cable I opted for was a Flash2Advance Linker,\u00a0available from <a href=\"http:\/\/www.divineo.co.uk\" target=\"_blank\">Divineo<\/a>\u00a0for \u00a324.95. I also picked up a 256Mb flash card for about a tonne, although\u00a0there&#8217;s a 128Mbit version available for \u00a379. The flash cartridge is entirely\u00a0optional though, as the GBA will boot from a remote host via the cable.<\/p>\n<h2 align=\"left\">Building software<\/h2>\n<p align=\"left\">The official Nintendo development environment for the GBA costs\u00a0big money, but fortunately there are a number of free development environments<br \/>\nout there, and a veritable plethora of supporting tools, including graphics\u00a0and sound conversion utilities and emulators for just about every platform under\u00a0the sun, including the XBox, and Java (you&#8217;ll encounter the Java emulator shortly).<\/p>\n<p align=\"left\">I opted for the HAM development\u00a0environment http:\/\/www.ngine.de.\u00a0It&#8217;s available in both windows and linux variants, and even\u00a0has a visual IDE if you like that sort of thing. Personally, I&#8217;m a vim man,\u00a0but each to their own. HAM is basically a cross-compiler tool chain, a target-resident\u00a0library which you can use in your own programs, a sound library which plays\u00a0MOD (tracker) files, and a bunch of other useful stuff. I also downloaded the\u00a0VirtualBoy Advance emulator, which again\u00a0is available for many platforms. The emulator allows you to quickly prototype\u00a0applications without having to download them to the actual hardware.<\/p>\n<p align=\"left\">The HAM devkit comes with extensive documentation and several\u00a0example projects. I used these, and some\u00a0online tutorials\u00a0to get going. I also made extensive references to <a href=\"http:\/\/www.cs.rit.edu\/~tjh8300\/CowBite\/CowBiteSpec.htm\" target=\"_blank\">CowBite&#8217;s\u00a0Virtual Hardware Specifications<\/a> which describe the hardware in great detail.<\/p>\n<p align=\"left\">HAM provides a library of well documented functions which make\u00a0it fantastically easy to develop code for the GBA. The meat of this library<br \/>\ndeals with graphical functions as you might expect. The GBA supports up to four\u00a0simultaneous alpha-blended graphics layers, and a wide variety of functions\u00a0for mucking about with them.<\/p>\n<h2 align=\"left\">An example application<\/h2>\n<p align=\"left\">After a bit of initial experimentation, I decided to try my hand\u00a0at a UKHA application for the GBA, to see what was really involved. What I was<br \/>\nafter was a menu system that would display the status of various common home\u00a0automation elements, and issue commands to them as appropriate. My idea was\u00a0to have a structured menu environment, linked to something like a xAP backend\u00a0to do the donkey work over the GBA&#8217;s serial port. I&#8217;ll be honest and confess\u00a0up front that I didn&#8217;t quite get there, thanks to the deadline for submitting\u00a0this article. What I <em>did<\/em> achieve was a smoke and mirrors demo of most\u00a0of the graphical side of things, complete with thumping techno soundtrack! All\u00a0it needs is some additional work to generate menus on the fly, and a xAP bridge\u00a0or equivalent to do the communications with the rest of the system. Here&#8217;s a\u00a0screenshot:<\/p>\n<p align=\"left\">Ok, so it&#8217;s not pretty, but the screenshot doesn&#8217;t really do it\u00a0justice. Refer to the emulated version below, or the AVI. \u00a0This demo allows you to navigate around the screen with the directional pad,\u00a0change the state devices with the A &amp; B buttons, and swap between menu pages\u00a0with the L and R buttons (OK, so there&#8217;s only one menu page at the moment&#8230;.)<\/p>\n<p align=\"left\">All this was achieved in the space of about two days, and just\u00a0over 500 lines of code. To be honest, the majority of the time invested was\u00a0spent faffing about in Photoshop and the GIMP to get the images in the right\u00a0format for the GBA to understand. Programming for the GBA is peculiar in that\u00a0it turns the normal programming experience on it&#8217;s head: doing stuff like fancy\u00a0rotating &amp; scaling alpha-blended graphics is a piece of cake, but doing\u00a0simple text output is significantly trickier. The font I used was shamelessly\u00a0lifted from the Linux Console Project, and a better alternative could be had\u00a0with a little time expended. Similarly, the graphics are somewhat plain as I\u00a0was in a rush to get something running.<\/p>\n<p align=\"left\">My <a href=\"static\/ant\/source\/ukha_gba.tar.gz\">sources<\/a> are available\u00a0here. Please note that neither the C source code nor the makefile or professional-grade:\u00a0I&#8217;d be embarrassed to churn out something like that in my day job. Rather, the\u00a0source code has grown organically as I&#8217;ve experimented!<\/p>\n<p align=\"left\">I&#8217;m hoping that if this article generates sufficient interest,\u00a0we can get a project underway to recode something more suitable which can be\u00a0used &#8220;off the shelf&#8221; by the UKHA populace in general.<\/p>\n<h2 align=\"left\">Running code on the target hardware<\/h2>\n<p align=\"left\">The best way to play with this demo is to download one of the\u00a0emulators (see links below) and load it up. I used VisualBoy Advance extensively<br \/>\nwhile developing, but there&#8217;s nothing like seeing it run on the actual hardware.\u00a0For this you have two options: you can either &#8220;bootstrap&#8221; the code<br \/>\nso that it&#8217;s downloaded by the GBA&#8217;s BIOS over the serial link each time it&#8217;s\u00a0turned on, or you can program it to a flash cartridge and run it like any other\u00a0application. The relevant software comes with the link cable, and is a trivial\u00a0drag and drop affair.<\/p>\n<h2 align=\"left\">Try it out!<\/h2>\n<p align=\"left\">If you&#8217;ve got Java enabled, you can experiment with the fruits\u00a0of my labours below. The picture of the console below is the cheaper, inferior<br \/>\nstandard GameBoy. I couldn&#8217;t find a skin for the new GameBoy SP. Note also that\u00a0you don&#8217;t get sound, but then being Java, I&#8217;m amazed that it works at all. For\u00a0the full multimedia experience, download one of the emulators listed below,\u00a0and try <a href=\"static\/ant\/binary\/ukha.gba\">my application<\/a> in that.<\/p>\n<p align=\"left\">(In this emulator, you need to use the cursor keys on your keypad\u00a0to emulate the directional pad, the &#8216;R&#8217; key for the A button, the &#8216;T&#8217; key for\u00a0the B button, the &#8216;E&#8217; key for the &#8216;L&#8217; button, and the &#8216;Y&#8217; key for the &#8216;R&#8217; button.\u00a0Press &#8216;Z&#8217; to reset.)<\/p>\n<h2 align=\"left\">Potential<\/h2>\n<p align=\"left\">Clearly this little beasty has considerable potential as an HA\u00a0controller. It could be mounted to the wall fairly easily as it is, and when<br \/>\nclosed would be not much larger than a standard light switch. The unit only\u00a0requires two connections: the serial cable and a power supply, although it will\u00a0run from its internal battery quite happily. It might even be possible to use\u00a0a standard non-SP GBA if you have good direct lighting, although in that case\u00a0I&#8217;d recommend a custom case mod, as I certainly wouldn&#8217;t want the purple monstrosity\u00a0above bolted to my walls.<\/p>\n<p align=\"left\">GBA programming is both quick to learn and rapid to prototype\u00a0given a little software knowledge. The tools to do it are widely available,<br \/>\nwell supported, and most importantly, free\u00a0If there&#8217;s sufficient interest in the project, I hope to do a\u00a0follow-up article in which I will advance the demo above to a more useful stage,\u00a0incorporating a generic menu definition parser and a xAP or xPL back end, as\u00a0well as in depth coverage of the various serial communications modes offered\u00a0by the GBA.<\/p>\n<p align=\"left\">All in all, for an outlay of a hundred pounds, you can&#8217;t really\u00a0go wrong. I&#8217;d recommend Metroid Fusion while you&#8217;re at it. If you start to tinker\u00a0with a GBA, or have any further questions, contact me via the mailing list.<\/p>\n<h2 align=\"left\">Links<\/h2>\n<ul>\n<li>Lik-Sangs<br \/>\ncomprehensive review of the GBA-SP, including internal shots &#8211;\u00a0www.lik-sang.com<\/li>\n<li><a href=\"http:\/\/www.cs.rit.edu\/~tjh8300\/CowBite\/CowBiteSpec.htm\">CowBite&#8217;s<br \/>\nextensive GBA Hardware reference document<\/a><\/li>\n<li>the HAM development environment &#8211; http:\/\/www.ngine.de<\/li>\n<li><a href=\"http:\/\/www.divineo.co.uk\/\">Divineo, purveyor of many a fine console<br \/>\naccessory<\/a><\/li>\n<li>Virtual Boy Advance, the best (IMHO) emulator\u00a0http:\/\/vboy.emuhq.com<\/li>\n<li>Boycott Advance, another emulator\u00a0http:\/\/boycottadvance.emuunlim.com<\/li>\n<li>Aaron Roger&#8217;s excellent HAM tutorial\u00a0http:\/\/www.aaronrogers.com\/ham\/<\/li>\n<li>GBA programmers&#8217; tools utilities, and reference &#8211; http:\/\/www.gbadev.org<\/li>\n<li>more programmers&#8217; stuff &#8211; www.gbaemu.com<\/li>\n<li><a href=\"http:\/\/www.devrs.com\/gba\/\">www.devrs.com\/gba\/ &#8211; more programmers&#8217;<br \/>\nstuff<\/a><\/li>\n<\/ul>\n<ul>\n<li><a href=\"static\/ant\/source\/ukha_gba.tar.gz\">Ant&#8217;s UKHA demo source code<\/a><\/li>\n<li><a href=\"static\/ant\/binary\/ukha.gba\">Ant&#8217;s UKHA demo (GBA ROM format)<\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Submission by Ant\u00a0&#8211;\u00a0If I started talking to you about LCD panels for home automation use, you&#8217;d probably start thinking about kit from the sort of&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":"","apple_news_is_paid":"","apple_news_is_preview":"","apple_news_is_sponsored":"","apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":[],"apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","footnotes":""},"categories":[15],"tags":[],"class_list":["post-1074","post","type-post","status-publish","format-standard","hentry","category-hardware"],"apple_news_notices":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/automatedhome.com\/wp-json\/wp\/v2\/posts\/1074"}],"collection":[{"href":"https:\/\/automatedhome.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/automatedhome.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/automatedhome.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/automatedhome.com\/wp-json\/wp\/v2\/comments?post=1074"}],"version-history":[{"count":29,"href":"https:\/\/automatedhome.com\/wp-json\/wp\/v2\/posts\/1074\/revisions"}],"predecessor-version":[{"id":35720,"href":"https:\/\/automatedhome.com\/wp-json\/wp\/v2\/posts\/1074\/revisions\/35720"}],"wp:attachment":[{"href":"https:\/\/automatedhome.com\/wp-json\/wp\/v2\/media?parent=1074"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/automatedhome.com\/wp-json\/wp\/v2\/categories?post=1074"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/automatedhome.com\/wp-json\/wp\/v2\/tags?post=1074"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}