It has long been regarded that the UNIX-like OS NetBSD is portable to every type of machine except perhaps your kitchen toaster. Technologic Systems, however, has conquered this last frontier. Using therugged, embedded TS-7200 single board computer housed inside the empty space of a standard two slice toaster, Technologic Systems has designed a functional NetBSD controlled toaster.
The toaster, which was on display in the NetBSD booth at the LinuxWorld Expo in San Francisco, is as high-tech as they come. This toaster features a 4 line LCD, USB keyboard, 10/100 ethernet port and a RS232 serial port for the external console. The toaster’s internal circuit boards have been bypassed and routed through the CPU board allowing NetBSD complete control over the toaster’s features. A keyboard connects through a USB port on the side of the toaster and the 4×40 LCD displays a NetBSD/toaster login prompt. The burner element is also controlled by the TS-7200 via an internal relay. Unlike previous NetBSD toasters which were nothing more than a glorified PC case-mod, this toaster can actually toast bread!
NetBSD was ported to the toaster by Jesse Off, an engineer at Technologic Systems. When asked details about the week-long effort, he replied:
NetBSD is well laid out for this type of embedded application development. I was most worried about physical things such as fitting the hardware inside the case and the board being able to survive 60 seconds at a time a half centimeter away from an 800 watt burner element. A regular PC can’t even survive room temperature without heatsinks and fans, and the TS-7200 has neither.
The end-design has no thermal issues and will not let the user toast if things start getting close to the temperature margins of the internal components measured by the onboard temperature sensor.
When asked what he thinks of the NetBSD operating system, Off replied:
Well, I’m skewed. I have been a small-time NetBSD developer on and off the last four years. NetBSD’s single, no-frills, high quality source tree is a great starting point for bringing up an embedded application. The API’s have a great power-to-complexity ratio and are coded with great wisdom as well as great intellect. For NetBSD though, being wiser is definitely the greater virtue.
When asked what the point of this exercise was, company president Bob Miller chuckled and had this to say:
We’re definitely not planning on going into full production with this! The idea was to follow through on a process most of our customers are using everyday in their own embedded designs using our boards. Though customers are not likely using toasters in their designs, they are likely encountering many of of the same issues such as GPIO control of hardware, custom software design/modification and dealing with tight spaces and high temperatures.
So what exactly is inside this toaster for a computer to read/control? For one, there is a small magnetic latch that holds your toast down against the spring action after you press down. To engage that latch, one needs to know when the user is pressing the bread into the toaster, which the TS-7200 reads with another sensor. There is a browning level knob (a potentiometer), which is read with an analog converter input. The front panel also contains four bright red LEDs and five push-buttons which appear to the system as a 5-key keyboard. The NetBSD LCD driver presents a standard VT100 text mode console that both the USB keyboard and 5-key front-panel are connected.
All peripherals had NetBSD drivers written that allow their manipulation and readback. The interface to toaster hardware uses the sysctl API. sysctl allowed for the easy coding of the toasting finite state machine as a simple shell script. The four LED’s are configured as PWM style outputs to vary brightness/blink-rate. Temperature is tracked using the TS-7200 onboard TMP124 sensor. This temperature sensor has .0625 Â°C precision and the kernel driver takes multiple measurements averaged over time to interpolate even higher precision (the sysctl returns millionths of a Â°C). The browning level knob is a potentiometer connected to channel 0 of the 12-bit MAX197 ADC which returns a number 0 to 4096 to the system also via sysctl. The five buttons are simple switches that are polled at 64 Hz by NetBSD’s matrix keypad driver. This driver allows for attachment into the system as a standard keyboard using NetBSD’s wskbd API. The 4×40 text mode LCD is a raw HD44780 based LCD available at allelectronics.com. This devices uses the bit-banged hd44780 kernel driver which allows attachment into the system as a standard NetBSD wsdisplay. The wsdisplayand wskbddrivers coalesce in the wscons framework to appear to the system as a regular VT100 system console.
A full NetBSD installation is on the 512 MB compact flash attached to the TS-7200. This includes self-hosted compilers, FTP/telnet server, ssh client/server, crypto libraries, kernel/user-level debuggers, and standard UNIX utilities. Apache with PHP is also installed on the TS-7200 and presents some CGI programs to control the LEDs, play music, etc. Since the 4×40 LCD is attached as a generic console, manipulating text files is also reasonably possible using installed text editors, though admittedly using vi on a four row text display is not particularly productive.
The toaster itself uses a single TS-7200 plus TS-DIO24 daughterboard for toaster control. Two 48 mA output pins on the TS-DIO24 directly drive two 5 V relays with 250V/8A contacts. One relay is used to switch 110 V to the burner element and one relay is used to switch 25 VDC to the magnetic latch. 25 VDC is acquired by tapping off some traces on the stock toaster circuit board after the power supply. All traces from the power supply portion of the PCB to the LEDs and buttons were cut and instead attached to the TS-DIO24 and TS-7200 GPIO pins via small jumper wires soldered directly to the components. A separate, small 5 V switching power supply is also placed inside the toaster shell to power the TS-7200, TS-DIO24, and LCD off the same 110 V line that comes in through the toaster shell. The TS-7200’s USB port, DB9 serial console, and ethernet jack are brought out on jacks on the backside of the toaster. The USB port is then used to connect a small PC keyboard to the system which combines with the five key wskbd to control the 4×40 LCD display console. USB speakers are attached through the built-in USB hub on the keyboard to allow playing of MP3’s while toasting occurs.