logo Home Contact Resume Writing Technical projects Scout restoration Vintage computing

Book 3

My third book is released! Learn what you'll need to know in order to become an embedded engineer.

Book 2

Check out my second book; learn practical stuff about building robots and control systems around Linux PCs and the Atmel AVR.

Book 1

My first book gives you all the intro you need on developing 32-bit embedded systems on a hobbyist budget.

What's Lewin Working On?

For people who are interested in my out-of-hours activities, this page documents what I'm currently doing. Click any of these links to jump down to the appropriate project:

Second-Generation Vending Machine

Over the course of last year, for a client in Alabama, I developed a controller board for a candy manufacturing/vending machine. This was essentially a proof-of-concept project, and it went through several modifications to hack new functionality onto the old design without respinning the PCB. Here's a picture of the earliest prototype of that board (note that this proto has some DFM issues, such as the components buried down between the relays; I fixed those issues in the production version of the board):

First-generation vending machine controller board (prototype).

The old design was essentially a poor man's PLC - it has 16 relay outputs, 8 Darlington-drive outputs, and 20 optoisolated inputs, all controlled by a 1MHz ATmega32 micro. It has a serial port for communication with a host PC for setup and calibration. Firmware was developed in C using avrgcc. The board sequences various candy forming and vending operations after receiving a credit pulse. The final version of the firmware also performs some interesting calibrated cycle timing, using cumulative timers to estimate fill levels in parts of the machine and thereby avoid the need for expensive sensors. A small production run of these boards was made, and as a result of customer feedback my client has requested a new second-generation version of the device.

The new design is considerably enhanced over the original. It is based around a 16MHz ATmega128, and offers 32 relay channels (these can be jumper-selected as Darlington drives instead of relays, depending on what is being driven), 10 dedicated Darlington drives, 24 optoisolated input channels, 5W audio output (16kHz PWM), and a MultiMediaCard slot to store sampled audio data. Hooks are also present for implementing the Multi-Drop Bus protocol for interfacing with card and banknote readers. Various manufacturing issues are also addressed, such as switching to 0.156" AMP connectors instead of the D-subs used in the earlier version.

Layout for second-generation prototype.

This project is interesting because it combines a lot more real-time effort into the software mix; it's quite a challenge. For instance, I've never done PWM audio on the AVR series, I'm quite curious to hear the results.

Kuro Box Project

Kuro Box based vehicle system. Click the image for a much larger version

This project was actually commissioned by IBM's developerWorks web site; in a nutshell, I'm taking the ideas presented in my second book (now orderable from, by the way!) and porting them over to the PowerPC architecture. I submitted the first article for the series on 12/7/04; you can expect to see it on the developerWorks site soon. There will be approximately ten articles in the series. At a later date, after the IBM exclusive copyright period expires, I will mirror the articles here.

  • The first article is now up on developerWorks: click here to read it.
  • The second article is now up on developerWorks: click here to read it.
  • The third article is now up on developerWorks: click here to read it.
  • The fourth article is now up on developerWorks: click here to read it.
  • The fifth article is now up on developerWorks: click here to read it.
  • The sixth article is now up on developerWorks: click here to read it. Yes, I know it was delayed a long time; that was partly my fault, but also IBM was on a content hiatus while they reorganized the developerWorks site.
  • The seventh article is now up on developerWorks: click here to read it. This is the first article involving actual circuit design! We'll get the Vehicle Control Module functional and talking to the Kuro Box over a 19200bps asynchronous serial link, using a simple text protocol.
  • The eighth article is now up on developerWorks: click here to read it. This article adds I2C I/O expansion, stepper motors and a checksummed bidirectional serial protocol.
  • The ninth article is coming soon... it discusses adding some sensors to the board.

Take a look at the picture. The vertical black-and-gray box in the upper left corner is a PowerPC-based Kuro Box network appliance (available from Revolution). This product is closely based on the Buffalo Linkstation, a network storage appliance available in 160GB and 250GB versions. You can use those links to buy Linkstations if you're having trouble finding the Kuro Box. Actually, the Linkstation is probably slightly better value, since it includes a hard drive and front USB port, and it isn't amazingly more expensive than the Kuro Box

Fellow Kuro Box users, note that I've populated the front USB connector in this device. My task is to convert this box into the main processing engine for an autonomous vehicle controller. The green PCB on the desk immediately to the right of the Kuro Box is the Atmel STK500 development board, connected via ISP header to the custom interface/control board I'm building (the tan breadboard in the center of the image). The black box at the lower right contains two stepper motors used to position a combination camera + lamp + light sensor. You can't see the cable (it's tucked inside the box) but it's supposed to connect to the larger of the two blue terminal strips on the interface board. The small green board just to the left of that stepper box is a USB webcam, not currently in a housing. Finally, the big black box in the lower left corner of the image is a gel-cell that can power the entire system. (In the real project, there are twenty-six of these gel-cells providing a total of 187.2Ah @ 12V. It's inconvenient to have them all on my desk).

The interface board connects to the Kuro Box over a serial interface. Since the Kuro doesn't have a readily usable serial port, I am feeding the signal through a Keyspan USA-19W serial to USB adapter, which you can see slightly behind and to the right of the Kuro Box. I'm still developing the circuit and firmware in this, but currently it is based around an Atmel ATmega32L, with two DS1620 temperature sensor ICs (one for internal, one for ambient temperature sensing), and control outputs for two 4-phase unipolar stepper motors driven through a vanilla ULN2803 octal Darlington driver IC. The motors I'm using were salvaged from Visioneer PaperPort page-fed scanners; they're very convenient in size and torque, and the form factor seems to be very common because I've seen it in many other appliances. There are also analog sense channels for battery and charge input voltages. To-do items yet to be added are the light sensor input (standard CdS cell), a reversible H-bridge motor controller, and an infra-red receiver on one of the capture/compare pins. The I2C-compatible and SPI-compatible interfaces on the AVR are left spare for future I/O expansion (I envisage that it will be necessary for me to move to I2C parallel I/O expanders very soon for low-bandwidth items like the stepper motors).

Mac Mini Linux Project

Now, this one's truly interesting :) For hacking purposes, I just bought a Mac mini (available from Amazon at this link). I've installed Yellow Dog Linux (equivalent to Fedora Core) and I'm documenting the process of turning the Mac mini into a Linux-based embedded appliance. The end goal is to build a standalone, open-source multimedia appliance with network connectivity. There's no special reason for choosing the Mac mini as the hardware platform, except that it's cheap and readily available (it's about 1/3rd the price of a similarly-configured PPC evaluation board, and it includes everything you need to get up and running).

This project "sort of" follows on from the appliances I designed during my previous job at Digi-Frame Inc. By this I mean that I'm not using any of the original code or design ideas from the DF-1710 or its ancestors. There were many things I didn't like about the DF-1710; some of them were differences of opinion with management about how the appliances ought to operate, some of them were simply design deficiencies that I never had time or funding to correct while Digi-Frame was going Chapter 11. The PowerPC-based product I'm building here is not a commercializable design. It is an open-source project which interested parties can duplicate at home (the price is actually about half the cost of the old Digi-Frame). You can extend it if you wish; if you do so I'd appreciate hearing about it.

The final project will be scriptable, and will be capable of playing several audio and video formats directly, as well as various still image formats, and it will be controllable via a web interface. A future update may include the ability to control it directly as well, using some kind of proprietary hardware interface (probably a hacked-up USB keyboard).

  • The first article is now up on developerWorks: click here to read it.
  • The second article is now up on developerWorks: click here to read it.
  • The third article is coming soon... sorry! I've been devoting a lot of time to the Kuro Box project.

Note that the Mac mini purchase link I gave above is for the low-end 1.25GHz/40Gb version of the machine. Since IBM is funding the enterprise, I actually bought the high-end machine (here's an Amazon link to the minimum-configuration 1.42GHz/80Gb high-end machine). I also added the optional SuperDrive (DVD+/-RW), Bluetooth, and AirPort Extreme. My choice was to avoid Apple displays and keyboards; they're amazingly expensive (staggering might be a better word). Instead I bought a sub-$200 17" monitor with integral speakers from MacMall. I also got a cordless keyboard/mouse combo from MacMall for $19.99 vs. the $58 Apple wanted.

Public Technical Documents

What's new?

2005-09-17 - Added disassembly guide for Averatec AV3715-EH1 subnotebook.
2005-01-16 - Added Portable Terminal Project page.
2005-01-16 - Added Kuro Box Serial essay on hacking a PalmConnect USB-serial adapter to talk to the Kuro Box debug port.
2004-12-07 - Added What's Lewin Working On? page.
2004-12-05 - Added Wiping Off Microsoft. A short rant about Microsoft's so-called embedded products.
2004-12-05 - LCD datasheets updated. Added Sharp LQ050Q5DR01, Toshiba LTM10C209A, LTM10C209H, LTM10C348U, Samsung LTM170E4-L01, LTN104S2-L01, LTS350Q1-PD1, Prime View P50AN4, V26L8060AA, P64AN2AP04, LG Philips LP064V1, LP150X1-C2QT, LP157E1-A2TS, LB121S1-A2.
2004-10-09 - Linux-centric review of the ECS A535 notebook, sold by Wal-Mart as "Balance".
2003-11-16 - The beginning of a collection of LCD datasheets.
2003-09-11 - Updated information on using Linux on Geode-based computers.

This section of is the top level of all that miscellaneous information I've collected in my years as an embedded engineer. Subject to time constraints, I am trying to expand this area into a reference I and others can use. There are both time and copyright restrictions on this effort; I refuse to publish tables of links (since it also means checking and maintaining those links), so I'm limited here to content that I have either written myself, or that I am legally able to mirror locally. (I don't know about you, but I'd much rather read an old version of a document than click an off-site link that 404s. How many times have you read a precis that seems to be exactly the information you want, only to find that the full document is off-line? Infuriating, isn't it?).

Note that this section does not include completed, published electronic or software projects. For those items, please visit the "products" page of (The simple rule of thumb is this: If I could sell it, it lives on If it's personal, uncopyrightable, not original work or otherwise unsaleable, it lives here on and all original content herein is © Copyright 2001 by Lewin A.R.W. Edwards. "" is a trademark protected under U.S. and international law. Infringement or attempted dilution of the intellectual property rights held by Lewin A.R.W. Edwards will be prosecuted to the fullest possible extent.