My first computer was an Intel 4004 prototyping board which I received in 1972 in exchange for writing an assembler that ran on it. I consider myself a "software person" but there was no distinction back then, so I designed and built a 4K dynamic RAM board to substitute for the UV-erasable ROMs that Intel designed the board for, and I designed and built a floppy disk controller for one of the first 8" floppy disk drives available to the public (meaning the engineers, there were no personal computers in the early 70s). And I wrote the operating system for that disk system. It was pretty crude, but it ran, and it was more than anybody else in the HomeBrew Computer Club had for several years. That was then, this is now.
Over the course of years, I obtained several different computers (usually in exchange for software), but the best of them was loaned to me in 1984. I eventually paid him a fair price, and after that I mostly bought computers, all of them Macintoshes until Apple killed the system. Nothing else came close. I bought two WinXP computers and later an OSX laptop, but nothing has the power of the Mac, not even its archaic Unix replacement. So I still do everything on the Mac, but that's not the real world I live in, and if I'm going to sell my services as a computer expert, I need to do it on something people use today. Windoze and Oh-Ess-Ex are in a death struggle to see who can make the hardest computer to use, but neither of them will overtake Linux anytime soon (see "Unix: The Good, the Bad, and the Ugly"). Windows owns the market in desktops and their laptop clones, so if you want to do anything for the mass market, Windows is where to do it. I didn't decide that, Bill Gates did. He's out of the picture, but then so also is Steve Jobs, and it will take the bean counters who replaced them a while to mess things up bad enough to make room for something better.
So I'm doing this computer summer camp thing, and the kids bring their own laptops, maybe half Windows, half OSX, one or two Linux. All of them run Java, and I had already decided that Java is a far better language than C/C++, and besides, one of the prerequisites for the program was that they swere recommended by their high-school CS teacher and all those classes teach Java. Anyway, I picked a project for the 2017 program that they could do and finish (see my blog post "Summer Videos"), and which would look sexy and much harder than it really was, so it would look good when they presented it in public and/or mention it on their college applications, and that project required a camera which came with Win10 drivers and (poorly supported) Linux drivers. So we did it on a Windows computer.
This next summer we plan to build on that success to actually drive a model car. That means we want Windows on a computer inside the car. There is exactly one single/small-board computer running Windows -- a couple other vendors say they can run Windows, but only one comes with it actually installed and running -- and that is the LattePanda. Most of the online reviews downgrade LP because it does not run Linux (it can, but Linux tends to have poor hardware control, in this case it cannot access all the I/Os), but like when TIME magazine pans a movie, that's a plus. Linux is sooo hard to use that it tends to suck all the energies out of anybody trying to support it, so a Win-only vendor will be much better able to support the users.
Other than Linux, the biggest complaint about LattePanda is its power management. So I got their "starter kit" which includes a small fan and five tiny copper heatsinks labelled "For Raspberry Pi" and no instructions on how to install any of them. Apparently when the processor gets too hot, it cycles its clock rate down to 20% or less. That's not a problem for this application -- we use designed code, not AI (see "The Problem with 21st Century AI"), for better performance and reliability, but some commentators say the processor could fail from the heat. So I guess I get to figure out how to install the fan in the plastic box with no instructions.
I tried putting the box together, and it fits the LP board tightly. There are ventilation holes on the bottom facing a large flat piece of unexplained metal, which might cover the Arduino co-processor, but I don't know for sure. There are vent holes on two of the side pieces facing each other above the circuit board (so air flow could go in one side, across the circuits, and out the other) but the box is not tall enough to mount the fan in such a way to have it blow the air in that direction, and not wide enough for air flow in the bottom to make it past the board and out the holes on the upper side. Besides, the curved blades of the supplied fan suggest that it blows the air into a flat backing that seems to be covered with a sticky patch. On closer inspection, I see tiny ribs on the side of that backing facing the fan itself, perhaps that is some sort of heat sink, and the sticky side should be pressed onto the processor chip, if only I could figure out where. None of the videos or instructions I could find said anything at all about where to put these things.
On second thought, most of those on-line reviews ran it straight out of the box without any fan or heatsink or anything. I tried that, and it worked. I gingerly touched the big piece of metal on the top side covering what I assume is the processor chip, and it didn't even feel warm. The reviewers complaining about heat were running video games, but I'm just driving servos. Eventually we need also to decode the camera input, but that's not as heavy as a video game.
The instructions for installing the 7-inch 1024x600 video screen were clear and simple, and Windows came right up -- the boot-up sequence is a little convoluted, we are told to wait for the red light on the bottom to go out (which takes maybe a half-minute or so), then press and hold the start button, but pecking the button seems to work fine. Windows knows the screen is only 600 pixels tall because it places the taskbar correctly at the bottom, but many of the Win10 dialogs and menus seem to assume a taller screen: the shut-down menu does not show when I right-click the blue Win icon in the bottom left corner, but wiggling the mouse around sometimes scrolls it up into view; a couple of times a dialog box displayed their action buttons under the taskbar, with only a few pixels showing, and I had to guess which one to click, stuff like that.
The bottom of a circuit board seems like a dumb place to put an LED that you must watch as part of the power-on sequence, but it's very bright (to distraction) even by reflection off the tabletop, so almost I wish it were not so close to the edge of the board. The time and date were sometime in 2016 when I first powered this up, so I changed the time and date to be current. The next day, the time and date were set to when it last ran the previous day. Obviously there's no clock battery on this system. One of the reviewers mentioned that and offered a battery fixup. I think it took more hardware hacking than I'm inclined to do at this stage in my life, so maybe I'll just let the date get stale, correcting the clock only when it matters. The default setting is to set the clock "automatically" but mostly I run Windows systems behind an air-gap firewall for security, so that's no help.
After some 50 years in this industry, I'm a little pair-annoyed (much worse than single-annoyed ;-) -- actually I'm not paranoid at all, everybody (at least all the hardware) really is out to get me -- so I make full-system backups before making significant changes. Earlier this year, when developing the tools for the summer camp vision project, I reverted to a saved system backup some half-dozen times before I got a workable system for Java reading the camera. The LattePanda has three USB ports (think: keyboard, mouse, and external drive for backup), but the hard drive never came up. It had an LED next to where the cable went in which shone brightly, but no sound nor vibration to suggest that the drive actually spun up, and its icon never appeared among the other junk in the Explorer window. After I shut down the computer, the drive started clicking as if it was trying to start up.
Fortunately, I had previously asked my benefactor (the camp director) and received a powered USB hub. After inserting that into the path, the drive came up and worked fine. Obviously the 2-amp power brick that came with the computer is inadequate for anything more than running just the processor alone. One of the reviewers said so too. The camera we used this year is powered from USB, and the camera itself gets hot, so the power needs updating before we can use this computer as intended.
As I said at the beginning, I'm a software guy, and the only reason for me even doing this is to write software to run on it, mostly as proof that the kids can write software to run on it next July. The camera part we already have an existence proof, their project last July. So really, all I need to do is drive the servos from Java -- well, it's a little more complicated, I also need to verify that we can drive the car using those two servos, but that's a software problem.
The LattePanda website is remarkably well done for documentation in an industry that prides itself for what I call "the video game method" for understanding how things work: "Here I am facing a threatening blue orc, how do I get past it? Try the laser defragger... nope. Maybe a photon torpedo... no again..." After testing everything in your arsenal and failing, you pause the game state and go searching the internet, which is full of comments by other people who ran up against the same problems. "Aha! It's the magic pixie dust I neglected to pick up on Level 3." Far too many modern computer systems work that way. LattePanda (LP) is not one of them. Obviously they cannot tell you everything there is to know about Win10 -- not even Microsoft can do that. But the video game method works well for Windoze, and if you had not already gone through that process for pretty much everything you need to know to do useful work on Win10, you wouldn't be using LP in the first place, because it's way more expensive than Raspberry Pi. The big thing that higher price buys you is that you don't have to use Linux. That's important and worth every bit of the price difference, at least for a one-off project that a team of high school kids must finish in four weeks. Furthermore -- and this shows the LP commitment to making their information available: it's open to the public (not encrypted). Bravo! There is no good reason to be hiding public information from the public by encryption (see: "Is This Website 'Unsafe'?").
So here I am trying to figure out how to drive hardware from software. The LattePanda website understands that's why you are using their computer, and they explain all. The pinouts are confusing, but they are documented. If you are using Windows, then obviously you want to be programming it in the Microsoft proprietary programming language, C#. Well, not really, I got burned when I tied my wagon to their previous proprietary programming language, VisualBasic, and they up and killed it with no upgrade path. I got the same shaft from Apple's HyperCard, so never again. Java is a much more public programming language, and it runs on Windows computers. But I had to install it myself. Fortunately, I already had downloaded the installer at the beginning of the year, and (unlike many other installers) it works fine without calling home. C# is Microsoft's proprietary imitation Java -- both derived from C++, but C# is not as well-done as Java. The LP website docs explain their hardware drivers in C#. It could be worse. The interface those C# commands talk to is open source (meaning: hard to read) but there, installed on the LP computer as shipped. Before we knew about LP, other vendors offered hardware access for driving servos using C#, but in some cases they refused to tell us how things worked, another was a huge box that could not fit in our model car, another required a long string of dongles. LattePanda was a breath of fresh air.
It's still a two-step process, the (soon to be) Java code sends messages out a dummy serial port to the attached (included) Arduino board, which does the hard work of driving the servos. The Arduino source code is also included in the install. It also is "open source" (meaning unreadable), but by comparing the published C# method calls from the website to the C# class they call on to send the commands to Arduino, and then seeing what the C++ code on that end does with it, I hope to understand enough to write replacement Java code to do the same thing -- at least to run the servos (we don't need all the other capabilities of the system). Maybe tomorrow I will feel less optimistic about the prospect, but today it looks reasonable.
Yes, less optimistic. It's both easier and harder than I thought. Easier because the "Firmata" package used inside the Arduino has reasonable documentation on GitHub -- it's generic, not specific to LP, but between the docs and the two source code files (plus the excellent LP website sample code) I can figure out what exactly to send over the serial port to do what I want to do. Harder because Java has no standard way to do serial ports. There used to be something in Javax, but it was never implemented on Windows, and I read somewhere that it was both erratic and now discontinued. There are several individual implementations on GitHub, but they all try to be all things to all people, with the result that they are incredibly complex to use or even to understand. I do not (yet) have a good way to see if whatever I try to do in any one of them is actually working and getting data into the Arduino; I guess I need to try and figure out how to do serial data in Arduino, and then see if I can make it send back what it got, so to see if Java can see it. sigh
I chose the Java-Simple-Serial-Connector (JSSC) implementation as being
slightly more transparent. After a hiccup or two, I was able to make my
test program blink the blue Arduino LED using essentially
the sample code provided by LP. I posted my code on the LattePanda
website forum. Their forum software made a mess of the formatting,
but any competent Java programmer can figure it out.
2017 November 6