"They're all going!" - nod from my colleague; I told him to put them to one side, had a chat to higher ups to make sure I could "acquire" them: "If you can pull em, you can have em! Bin wagons due in 3 days" - managed to pull out roughly 30 screens out of these dud units along with more stepper motors than I knew what to do with and about 30 V-Drives (that's for later).
About half the stepper motors went to a mate who was building a 3D printer - I think he's set for about 8 printers!! But as a thank you, he bought me a Erbauer grinder + blades (SWEET!), which I needed to do some work on the landy - which reminds me, I should post some work I've done on that thing on here!
So did any of these screens work? Some were still in packaging, some I'd removed from fittings but didn't even know if they actually would power on, so I did some digging:
The Screen
Its a 20 Character by 4 line LCD which is backlit in blue and with white text. That's all I knew about it when I first looked at one. After a google: JACKPOT - Matrix Orbital - VK204-25
Turns out it had more connectivity than any other LCD I'd seen: I2C, RS232, TTL, USB, RS422 & Dallas 1-wire (new to me anyway!). I was doubtful about its USB capabilities as I could not see a USB port on it, but it had footprints for one.
It also has an input for a keypad and a set of 6 general purpose outputs.
Physically, it is a 2 boarded device; by that i mean it has one board that appears to handle the communications protocols the user selects and the board with the screen fitted, which I assume is a standard LCD based around a Hitachi HD44780 LCD controller. I assumed this from the interconnecting header between the 2 boards: its pretty similar to most LCD's out there and seems to be a standard that many manufacturers seem to adopt - but from the data sheets and info I can't verify that.
I suppose by that observation, and if you were deft enough, you could pull the LCD Board away from the interface board, if you just wanted the LCD on its own.
It also has an input for a keypad and a set of 6 general purpose outputs.
Physically, it is a 2 boarded device; by that i mean it has one board that appears to handle the communications protocols the user selects and the board with the screen fitted, which I assume is a standard LCD based around a Hitachi HD44780 LCD controller. I assumed this from the interconnecting header between the 2 boards: its pretty similar to most LCD's out there and seems to be a standard that many manufacturers seem to adopt - but from the data sheets and info I can't verify that.
I suppose by that observation, and if you were deft enough, you could pull the LCD Board away from the interface board, if you just wanted the LCD on its own.
Getting Started
When I had pulled them out of their units they were connected by a 4-way molex KK header, which turned out to be the TTL & I2C port, with power pins. I had heard of I2C and have designed systems for I2C devices, but never actually got to grips with it - this opened a perfect opportunity to pull out the Arduino and get started.
Fortunately; Matrix Orbital supply an some demo code designed for the Arduino environment:
- Arduino I2C demo - it's technically not for this screen, though if you pick it apart, it works
- LVK204-25 serial demo - opens download from googlecode in .ino format, no documentation unfortunately but will allow you to communicate to the device if its set in RS232 mode
I whittled up some pull-ups onto a bread board and linked the connections for the I2C bus via them to the Arduino:
such a tidy desk....its not like that now! |
I then pulled the Demo sketch apart and managed to get it display text, as above. Now that I could get it working, I decided to expand the setup so I could test them all.
Test Development
To ensure all aspects of hardware were functional, I decided on a set of tests:
- Make sure the backlight works
- make sure that there aren't any dead pixels
- test to make sure that the contrast is good
- make sure that it can display test legibly - and not garbage/corrupted
- test that the General Purpose Outputs are working
This I thought was enough to go on to ensure that they weren't buggered. I thought about testing the keypad input, but I thought that its mostly a device based on outputs and not to bother.
I decided that each test would loop and then press a button to confirm that test had passed and then move onto the next test. The test takes a little longer then if it went though each test automatically, but I wanted to do something with interrupts to prove to myself I could do it.
After some tinkering with the contrast functions, I decided that I could perform a dead pixel test by ramping the contrast up to full and look for empty spaces in each segment.
After some tinkering with the contrast functions, I decided that I could perform a dead pixel test by ramping the contrast up to full and look for empty spaces in each segment.
So I came up with this setup:
Here's a picture of the back of the LCD to show where all the connections went:
Connections to LCD - 4-pin KK is comms & power, 6-way header is GPO. D-sub 9way can be seen for RS232/RS422 |
The LED's are 5V rated, hence why there is no current limiting resistor on them. I added a resistor & cap to the switch as while testing the code, there was alot of debounce on the interrupt, causing it to skip tests.
After a few trials I settled on this code:
I'm not sure if i should have included the Wire.h library (is it included by default in the arduino IDE?). Anayway; you power it up, after the screen has been setup by running the function LCDSetup(), the while loop runs the the SwitchCase to check the test number it should do. Each time the interrupt button is pressed; the integer: Test is increased by 1, so long as it doesn't already =4, as there are 4 test and going beyond that may cause it to take a hissy-fit!
With each case, is a function to perform a test; within them are the relivant functions to send values to the screen for Backlight brightness, contrast & so forth by using Wire.beginTransmission to the I2C address specified in the beginning of the code (#define I2C_address 0x28, as specified in the manual)
And here's how it worked:
Backlight test |
Contrast/dead pixel test |
Alpha-numeric test |
The Welcome screen |
Toggling GPO |
The setup |
Issues
One minor issue was that the interrupt didn't take affect instantly, it only kicked in till the test had ended. Its not that bad.
One other thing I found: whilst testing some screens that were already packaged; the would power on but only displayed the default screen. After a quick read of the manual: i found that you have to solder some jumpers onto the board to enable the mode you require:
Also you will notice there are some track going from the jumper pads for the RS422 mode, leading to and un-populated IC footprint: U8. This also means that RS422 is not likely to be featured on this model of screen.
One other thing I found: whilst testing some screens that were already packaged; the would power on but only displayed the default screen. After a quick read of the manual: i found that you have to solder some jumpers onto the board to enable the mode you require:
Notice the solder bridges made in the area marked I2C - this means its in I2C mode |
Here: there are 3 0R links in the area marked RS232, just under the silkscreen text LVK204-25 - this means its in RS232 mode. |
I'd like to point out at this point that this is why you RTFM!
I found that un-soldering the links from RS232 and bridging over the pads in the I2C area, I managed to get the screen to work on the test bed. So by default, they are shipped in RS232 Mode.
Outcome
I'm now using this test bed to verify the screens I have work. This is cos I am selling them! yup, they're going to be up on ebay! once I've tested them all, I'll be posting a link up on this blog if your interested in buying one.
They make a great tutorial tool and an excellent display for any project. Plus can expand the outputs of a micro controller project if needed (say you were making a project with an 8-pin ATiny?)
I suppose I learnt a bit more about functions, switch/case, more about using interrupts and a I know more about communicating with device than I did before. At least from this end of the device!
I must admit my code is very messy and thrown about, I really need to hone my skills getting the functions onto one sketch and reference it in the main sketch - something I could do next.
I will be saving a few screens for myself. I would definitely get one - they are quiet a useful little thing, even as a beginner you can learn a lot about I2C.
Feel free to pull my code apart & watch this space for the ebay link if your interested
No comments:
Post a Comment