Managing Complexity with Open Source
A few days ago, something exciting happened: I revisited my very first embedded system - a 34 year old stepper motor controller, driving the telescope mount of the Public Observatory Rothwesten, which was built by me back when I was in class 12 in highschool. Comparing those embedded systems from back in the days with the recent industrial systems, it is impressive to see that the latter ones are not manageable any more without the use of open source software.
That's how it started
But first back to the beginning: Sometime in the early 90s the time came when a few exciting topics came up at school, and for me these were primarily electronics and astronomy AG. And so the idea quickly came up as to whether we could combine these topics.
At that time, I started with public observation evenings at Public Observarory Rothwesten, and then one day the old turntable motor was broken. So the idea came up to replace it by something modern, with a microcontroller.
Hardware
I think it was about 1990 when I sat down with a family member and started developing the stepper control system in the picture above.
- The processor is a 8035, a predecessor of the 8051, which was only able to do add and shift operations. An 8 bit device with 4 KB external ROM.
- A higher level language such as C was too resource hungry, and thus the software was written in assembly. Such an 8 bit CPU has only 256 mnemonics, so one could print that to an A4 sheet and stick it above your monitor. Then I picked up a hand copied processor manual, which explained the assembler mnemonics in more detail.
- For the external EPROM I had to add a latch, to separate the multiplexed address and data busses. This was done by the 74HCT273 latch in the picture.
- Programming EPROMs was something I could already do, as I had built an EPROM programmer from an instructional article in the 64er. For write protection, I used one of those usual 5 1/4 inch floppy disk stickers.
- It was already possible to do in-system-programming: For that purpose, I built an EPROM simulator, attached to the parallel printer port, from some instructions in one of the computer magazines (c't, MC, elrad?).
- Etching a PCB was too much effort in case of a problem. So the PCB was done with a holeboard and some manually soldered cables.
- All ICs had sockets, in order to be able to exchange the devices in case of a failure.
In addition to the CPU board there was a linear regulated power supply with a transformer, a FET H-bridge to control the motor windings, a Bopla case from Völkner (bought in the neighboring town) and a cable to the hand controller box which could be operated when looking through the eyepiece.
Software
After the hardware executed the first hello worlds in assembler, I started with the real software. Stepper motors want to see the right pattern on their windings which had to be put in tabulars, and those had to be executed in a circular way.
The timing was important: Such a telescope needs to be rotated once in a sidereal day (23 h, 56 min). There were buttons for "slower" and "faster" on the control box, resulting in different speeds. The whole thing is extremely sensitive, as the telescopes allow magnifications of a few 100, so any inaccuracy results in vibrations etc. There were adapted speed settings for observing the sun or the moon, the controller had some LEDs to get status feedback, and last but not least, I programmed logarithmic acceleration and deceleration ramps.
Complexity then and now
From today's perspective, the most fascinating thing for me is that the whole device survived for 34 years. In such an observatory dome, under direct sun exposure and really, really cold temperatures in winter, being exposed to storms and rain, on a tower on top of a volcano crater, there are extreme conditions. And the housing is only IP54, basically in the open.
Interestingly, the technology was low-tech enough to be understood by a 12th grade pupil during one summer holiday, without any internet at that time. A little bit of soldering, some cables, one sheet of assembler instructions, that was basically all that was needed to solve the business logic of the device.
And then I'm looking at today's modern processors we are using here at Pengutronix and in our industrial projects, having about 15...30.000 pages of documentation, with secure boot, Ethernet, power management and really a lot of complex software technology. With lots and lots of sophisticated features which are so special that a single developer has almost no chance to understand every corner of it, so these days we have experts for each little topic in those chips.
Compared to modern circumstances, one could wonder how it was even possible to solve the actual task with that technology :) But of course the embedded requirements for many projects have completely changed in the meantime: Many modern systems need networking, wireless, IT security etc, which immediately makes the system complexity grow massively.
However, one thing was equally important back in those days and today: Access to open documentation. It is and was possible to learn how all of that works, one could ask people who have the know-how. For today's complex systems, we have Linux and many other Open Source components which make all the base functionality work and bring up the hardware up to a state where a developer can concentrate on his application.
And back in those days as well as today, you need(ed) to know the right people who have the right expertise and could be asked. So many thanks to Ingeborg Reuter, Peter Kirchhof and Martin Dietz who provided me with that sort of know how at that time. And, of course, many thanks to my great team at Pengutronix who makes this sort of stuff possible today - for me and for all the other people out there using our Linux kernel patches and the other Open Source projects!
By the way: The quickly installed replacement system for the stepper controller was meanwhile built by an astro colleague in Rothwesten, with an ESP32 and thus again with another Open Source ecosystem, and a lot of public knowledge. But that's another story...
Further Readings
Pengutronix at FrOSCon 2024
On August 17th and 18th, 2024, it's that time again: FrOSCon will take place at the Bonn-Rhein-Sieg University of Applied Sciences in Sankt Augustin - and Pengutronix will be there again as a Partner.
umpf - Git on a New Level
Modern software development is commonly accompanied by a version control system like Git in order to have changes to the source code being documented in a traceable manner. Furthermore, any version state should be easily reproducible at any time. However, for work on complex projects such as the BSP ("Board Support Package") of an embedded system with its multiple development aspects, the simple stacking of the individual changes on top of each other does not scale.
Yes we CAN... add new features
Have you ever experienced an otherwise fine product that is missing just the one feature you need for your application?