PeaLanguage


Page Created: 6/25/2014   Last Modified: 4/30/2021   Last Generated: 5/6/2024

When something large stands in front of you, something built by mankind, something that was hard to build, took many men and many years, and many great minds, it is Great. It is inspiring. It stands as a physical symbol that challenges us to persevere and dream big things.

Every time I see old films of the Saturn V launch, I get very quiet. When I watch the opening ceremonies of the Olympics, I get very quiet. When I watch documentaries on the Normandy Invasion, I get very quiet. It takes a highly-educated civilization and careful, conscientious planning and cooperation to carry out things on such a scale.

But if you look down instead of up, you will see an equal greatness. Mankind is working on everything, in every scale. The microchip is a pea-sized city of electricity, designed by us, and used by us. We've learned that the Universe isn't just about Matter. It is about Energy and Information as well.

To me, a tiny microcontroller↗ is a Saturn V, one that I could spend the rest of my life studying and never fully understanding. Human beings only think they understand their own creations, but they are not our creations, they are the creations of Mankind, a mind that we as individuals cannot fully grasp.

When we see a chair, we don't know anything about the economic and logistical problems surmounted in creating the factory that built the woodworking tools, the skills and schools of the people that built the chair, the silviculture from which the wood was selected, the chemists that created the stain, varnish and glues, the designers reasons for creating it, the artistic language from which it was derived and into which it was integrated.

But we can sit in it.

The world, both the natural one and the one man has created, is still the world, is still bounded by the laws, energy, and entropy in the Universe. It is more than just fascinating. It is astonishing. Just look at it.

I've had an interest in microcontrollers ever since I built ThePhoneSystem and later tried to find a way to mass-produce and market it in the early 1990's, which I ultimately forwent due to the daunting task of trying to get it FCC Part 68 certified↗. I was in my twenties at the time, with little money and experience.

In 2013, I decided to make another go at it, building my mythical game and started looking at the Microchip PIC, Atmel AVR, and the TI MSP430.

But first, I'll take you through some history, then show you what I am working on today.

The 1990's

In the early 1990's, I had investigated the Motorola 68HC11 microcontroller (now made by Freescale), and experimented with a development environment for it on my Amiga 500.

Back then, I was young and naive and tried to design several devices around this that I could mass-produce and sell, but I couldn't justify the cost and risk involved, and my market was small.

I had 4 feasible ideas:

  1. Computerized PBX system
  2. Aquarium controller
  3. Model train controller
  4. Electronic board game

Computerized PBX system

My earlier phone system was really operating like a macro-sized 8-bit microcontroller, and I just needed to shrink it down and make it cheaper to mass-produce. I had programmed the CPU (6510) and interfaced two addressable peripheral interface adapter chips (6821), to provide me with something like a modern day GPIO. I was also well-aware of analog-to-digital conversion, as I had interfaced a thermister into the analog paddle port of a Commodore64 and later interfaced an 8-bit ADC chip to my Amiga's parallel port (for audio digitizing), and these are now common on modern microcontrollers. So I had all of the knowledge needed.

But the PBX system was too difficult to mass-produce and market, which I explained in more detail near the end of this page. There was a lot of cost and risk involved.

The Hobbyist Markets

The aquarium and model train controllers were devices that I could sell via mail-order to niche markets, to tropical fish and model train hobbyists. Being young, I didn't have knowledge of many industries other than the hobbies I was familiar with, so I leveraged my strengths.

But the problem with the hobbyist markets is that many hobbyists are already technically proficient and can build their own custom systems. I figured they would be unlikely to buy mine in sufficient quantities for me to make an adequate income. This was before the Internet, before the easy availability of global markets, and before e-commerce. Everything was more difficult and more expensive.

Sometimes barriers to entry are good for small business, as they prevent competitors, which was one reason I thought I could make money from my film project if I made it good enough, since the equipment and skills needed were still considered "prosumer" but as of 2013, education in film and video is ranked as the 3rd worst degree↗ for employment opportunities. The field is overpopulated since anyone in the US can shoot HD video with their cell phone and post it online in seconds, so the barrier to entry is now non-existent which has flooded the market with media at essentially no cost.

Aquarium Controller

So for my aquarium controller, I researched interfacing temperature, light, and pH sensors and a lamp and heater controller into a microcontroller for environmental control of an aquarium. I spent a lot of time reading ThomCat↗ books at the library, sourcing companies for sensors, contacting many via mail. There was nobody selling such systems at that time for consumer use. One of my key ideas was to control lighting to match the actual sunlight levels the fish would be exposed to at their latitude, changing day/night lighting conditions over a year.

I worried about liability issues if my device were to malfunction, and the pH sensors were not very robust.

Model Train Controller

The model train controller was essentially a variable speed power supply with DC pulsed current. By using the microcontroller to pulse DC current on and off, it allowed the locomotives to run very slowly and more realistic, without getting stuck, like a scale locomotive would do. There were few companies making them at that time, and none would have been as sophisticated. One of my keys ideas was to create braking and acceleration algorithms to simulate the inertial characteristics of a real locomotive's mass at scale.

I figured that my chances were pretty good breaking into a market were older men and older electronic technologies were well established, since I would be introducing a "disruptive technology" with my new microcontroller-based knowledge and computing abilities.

It was similar to how younger people today try to supplant traditional computing with smartphone apps. You're trying your best to apply what you know to disrupt the traditional paradigm to give your product a chance to sell.

Electronic Board Game

My final idea, that I haven't given up on in over 30 years was to create a microcontroller-based board game. I played a lot of handheld electronic games when I grew up in the 1970's and 1980's, and there were some very creative uses of low memory, simple lights and displays, and few buttons, but the gameplay was excellent. I was fascinated by Dark Tower, Stop Thief, and Electronic Battleship. But there were earlier games, like Laser Attack, Blip, Quiz Whiz, and Mattel's Football and Football 2 that used electronics in creative ways.

Due to the display, computational, and storage limitations, the creators augmented them with electromechanics or cardboard in creative ways.

Most people forget that computational machines do not have to be electronic, they can be mechanical. Data doesn't have to be stored in RAM, flash, or magnetic media, it can be stored on paper, like printed words or later punch-cards. Computation can be performed by gears. The word computer itself used to refer to a human being.

I used to build vending machines out of cardboard, and built a lot of my electronic circuits on wood and cardboard, since I didn't have money to buy boards or cases.

I didn't put a lot of effort into my game over the years, because every time I worked on it, I felt it was a trivial project. I wanted to create something useful for society, some kind of machine that improved people's lives (I'm still working on that).

The AVR

In 2013, I ultimately chose to focus on the AVR, due to good open-source tools, low cost and low power, and the popularity of the Arduino meant that there is a lot of good information available on the Internet from people willing to share their stories of their successes and failures.

I decided I would skip the Arduino platform completely and focus on the 8-bit ATTiny1634. This is my first Harvard architecture device (the 6510 was von Neumann architecture).

The ATTiny1634 is also the first surface-mount device I have worked with. I looked at some of the more powerful Mega and XMega devices but they were too expensive for my designs.

This device gives me only 16K flash to work with, but that is the same amount of memory as my first computer (TI-99/4A), on which I programmed quite a few games back in the day. The Atari 2600 had even less, and had some very good games...

What really impresses me about modern microcontrollers is their extremely low power usage, if you get ones designed for this. If you are creative in using their low-power modes, and especially interrupt-driven programming, they can draw current measured in microamperes and even nanoamperes (billionths of an amp). This is phenomenal.

Information processing uses energy, not just from the standpoint of the efficiency of our current technology, but the Universe itself has limits. Thinking really does use energy in the same way as physical labor.

And thermodynamic entropy, that most of us associate with the word "entropy", may actually be information entropy↗. In other words, information itself may not reside within the physical universe, but the physical universe may reside in an informational one. A lot of scientists hypothesize that this is the case.

The low-power usage makes me ponder just how much energy our mental tasks consume. As our chips get more and more efficient, they slowly get closer to the Landauer Limit↗. There are lots of limits to computation in the universe, including those in time and space. But the Landauer Limit is about energy consumption.

In 2012, scientists experimentally verified that this limit is real↗.

Have you ever thought about "alien technology"? What kinds of advanced computers would a more advanced extraterrestrial have at their disposal?

Well, we do know that their computers won't be any more efficient than the Landauer Limit. We also know that for a given size, they can't contain more information than the Bekenstein Bound↗.

It is interesting isn't it? Your brain (at least as far as we know today) has been bounded. Your thoughts are bounded.

There is an interesting thing about information, though. We know that there are limits to how much and how fast we can think, but "what" we decide to think about is almost infinite. The collection of previously random bits that we call information comes from a much, much larger pool.

A piece of paper, for example, can only have a certain amount of information in it. Four letters can only spell a certain amount of words. But depending on your language, those words can mean anything the universe has to offer. That is the beauty of information. It is a fractal, both bounded and boundless.

Aliens may indeed be more advanced than us, but it will not be because of their technologies, it will be because of their language.

My favorite science fiction show, by far, is Farscape, and one of the best episodes is "A Constellation of Doubt", written by David Kemper, where Crichton, a US astronaut who had traveled for years with various alien races, watches a television documentary made on earth that discusses mankind's first contact with alien life, who now happen to be Crichton's friends.

It showed how our ignorance, though not intentional, is still ignorance. It is not what we do not know that limits us as much as what we think we already know.

Construction Obstacles

I decided to throw out most of the fabrication techniques from my old PC board/solder days and see if there were any high-tech or nanomaterials that I could use in new ways. On my quest, I began encountering a lot of the obstacles that many makers and inventors of today encounter.

When I was a child, I lived in a valley at the corner of 3 roads that mostly went uphill. The neighborhood kids, my brother and I built several motorless go-carts from scratch to ride down those roads and I learned a lot about steering, friction, drag, wheels, axels, and brakes.

I remember calling the local department stores to ask them how much the "axels" cost. They had no idea what I was talking about. Axels were common parts on all kinds of machines, so how did they not have them or know what I was talking about? Then one lady I talked to was insightful enough to direct me to their steel rods, of which they had plenty. This blew my mind.

What I had confronted, but did not realize at the time, was that I was seeing the complex stratification of the primary, secondary, and tertiary geographic and economic sectors.

A steel rod is something produced and sold by a primary industry. A secondary industry takes that rod and turns it into an axel for a wagon and sells the wagon to a consumer. But if you need an axel for your particular wagon, you would need a tertiary (service) industry to make a custom axel for you.

This stratification is a fairly rigid structure, which cannot be easily changed by a single individual. It is the optimized path of an evolutionary mechanism, like how water carves river beds into the rocks. A single person can't move a river bed once formed, but they can change the course of the tiny stream at the top of the mountain, and in time, the river will move.

Today, when I go to stores, I don't ask for axels anymore :)

As an individual in the United States, other than used goods, the most cost-effective option for small amounts of materials is to purchase the materials in their "secondary" state and then deconstruct them as needed to obtain the desired element.

But not only do most stores not help you with this, many will refuse to help, or even try to prevent you from succeeding. It is no wonder why "brick and mortar" stores are disappearing these days, as most are actively trying to limit individual creativity or consumer choice.

You don't just see this behavior in stores, though, you will see it in any group of people that have established ways of doing things, a guild or league, a club, a licensed profession, inspectors and regulators, etc. On a larger scale, you see it in both big business and academia, in the politicians and the scientists.

The tertiary and quaternary sectors of the economy evolved from the lower levels, so these groups continue to repeat the same patterns.

So, to be an inventor, you kind of have to be a life hacker↗ as well, whether you like it or not.

Life hacking is applying science "inward" to study human creations, not "outward" to study natural phenomena. You have to treat human machines and materials as black boxes, and perform experiments on them to determine their properties.

This is a sad commentary on our society, though. One of the reasons humans were able to advance is because we developed a language and wrote things down in books, and preserved our knowledge for others to use.

Today, information is more expensive, and like the Landauer Limit, there is a cost. Engineering data, schematics, ingredients, plant numbers, countries of origin, and revision information may not be available, either due to economics or to maintain control over these objects. The open-source hardware movement came about because of this very problem.

Information is even being mathematically locked↗. It is not just happening in secret, it is right out in front of us.

When we put "most" of the mechanisms in the software instead of the machine during the microcomputer revolution in the 1980's, that was a big change.

But today, in some areas, we have put "all" mechanisms in software. Think of a smartphone transaction. A person touches a piece of glass, the computer senses the capacitance of the finger, and the software processes a monetary transaction. In many cases, people buy digital media or software, and this is transmitted to their device. There was no mechanical work or moving parts involved.

What is actually happening is that the information (once held in the brains of a skilled labor force) has moved into the software.

But the problem is that when society offloaded its knowledge to computers, it did just that--offloaded knowledge. We no longer have a populace that is as skilled or knowledgeable. We've increased the capacity of our thinking machines at the expense of our own thinking machine.

From a biological perspective, it is the pattern of an organism becoming more specialized, like how the cells of the human body began to specialize during development. Perhaps our actions are written in our libraries, like the language Mendel found inside the peas. We are no longer the young "stem cells" that we use to be. We are more efficient, but the organism as a whole cannot adapt as quickly if the environment changes.

But the human body has shown us that it maintains a repository of stem cells. Similarly, our society maintains individuals that still have great capabilities, but they are fewer in relation to our size.

Then at the turn of the millennium, the whole Internet-fueled "gamer" movement formed, and people were spending their lives playing videogames, purchasing virtual products and content. This wasn't just a rehash of the 1980's videogame boom, these people were serious into lifestyle changes, a new subculture.

Again, from a biological perspective, it appears to be a type of human evolution. It, like smartphones and soon VR, is changing the human brain physically. There seems to be a good chunk of our population that wants to go virtual, that spends a great deal of income in virtual worlds already. I enjoy certain MMORPGs myself, but even with all the benefits of gaming↗, there is something very wrong when you replace your external reality that is not under the control of mankind with an artificial one that certain individuals have control over.

Today, people and companies are trying to move to full immersion technologies, like VR headsets. But the trend has been ongoing for years. Radio became hi-fi and surround, television became hi-def and 3D, our world is now full of sensors, we carry sensors around us, there is augmented reality, etc.

You could say that we are moving deeper into the fractal and bounding ourselves in one way, but seeing new shapes as we move inward. Even if that were so, I don't like it.

If I am a single neuron, then I am firing a warning signal to others. And I've been trying to reverse that pattern in my own designs.

De-immersion

When you de-immerse your medium, it creates separation between you and the subject and allows you to think about what you are seeing. Then your mind is free to decide if it wants to engage in the subject or not.

This is the appeal of B&W films, AM radio, reading technical literature. There is a visceral coldness to it, like taking a walk at higher latitudes, but the briskness also brings reflection and intellectual thought.

You discover that the stimulus of an event is not as important as the event's construction and meaning, the complexities of thought, questions of our existence and reality. When you focus on a microcosm of our world, rather than live through your senses within it, you can appreciate the complexities of its entirety.

Most people try to find that beautiful red, ripe apple on the tree, pick it, and eat it to enjoy the sensory experience. To many, this makes them feel closer to reality.

But contrast that with a monochrome etching of a leaf of that tree, with simple cross-hatching for shading, like you might see in an old scientific illustration.

Even though the print is simple, it shows you the structure of the whole tree. To me, that brings me clarity. The senses, however wonderful they are, are flooding us with wonderful illusions, cheap entertainment, but the intellect must filter this. A non-filtered sensory experience is like going to a theme park. After the novelty wears off, it it is trivial, empty, stagnant. The intellect looks for more behind the facade and finds nothing.

In my reality, I must bring the intellect to the event. This only comes through deep thought, epiphanies, and attempts to assimilate complexity.

The Circuit

Like many others, I have begun experimenting with solder paste, conductive glues, ink, tapes, foils and flexible circuits for electronics. The older rules governing electronic circuit board construction no longer apply today. Things are smaller, they don't need to be mechanically bonded as strongly, they don't need to pass large amounts of current, they are smarter and require less external parts. We're not just using simple transducers anymore, but there are tiny sensors for just about any physical property you can think of.

I built a resistive soldering unit out of an old PC power supply and attempted to pass current through the leads of the AVR to melt solder paste (since I didn't want to use heat), and it was too difficult to create good connections quickly. I'm sure it can be done if I built some sort of robot, but the time it would take me to develop a reliable process is too great, so I tried other technologies.

I tried conductive glues and metal foils to create the circuit via an additive process (instead of subtractive like copper etching), and this works to some extent.

I purchased the reactive-ink-based CircuitScribe↗ created by UIUC scientists as soon as they started shipping, and used it in conjunction with 3M's Z-axis tape. This is some cool stuff. These are amazing technologies and work well for quick prototyping, but the circuits I've built so far are not as durable as conventional wire/solder.

We're actually in a transitional period, at the time of this writing in 2015, where conductive ink jet printing and 3D printing with conductive materials is still in its early stages. In the future, if these technologies are not monopolized or patent-encumbered, individual consumers will be able to "print" electromechanical devices.

I eventually designed a circuit exposing the 6 ISP pins so the chip could be programmed in place.

The Inputs

To create buttons, I decided not to use Atmel's capacitive touch technology due to the need for external capacitors, their closed-source library, and the power consumption. It's not too difficult to use my own code (as it is really just a type of RC charge circuit like I built for the OswaldLaser), but capacitive touch can't trigger an interrupt while in its deepest sleep mode, so interrupt-driven programming is limited.

I designed switches around optical sensors, hall effect sensors, etc, but in the end, I kept returning to the simple mechanical switch. It is old, but very efficient. I experimented with several types of switches, including creating my own rubber dome switches out of silicone.

Communication

At first, I decided to buy a cheap RaspberryPi "usbasp" clone programmer. I created my own interface to the board.

To get output from my program for debugging purposes, I simply used UART1 which is conveniently exposed on 2 of the same pins as the ISP. I then connected the TX/RX lines to their complimentary lines on the Raspberry Pi, since the Raspberry PI contains a 3.3 volt UART which matches the ATTiny1634. I then used Arch Linux and minicom to receive text from the AVR at 9600 baud.

Since the AVR has hardware UART, it doesn't waste much memory to send a byte to the serial port, so I didn't have to waste space by including a function such as "printf" and this kept the memory footprint low.

Later, I used a momentary DPDT switch between the programmer and the Raspberry Pi GPIO to prevent them from interfering with each other. Its default state is the serial port. To program the chip, I would just hold down the switch when using avrdude, since it only takes a few seconds.

However, I had to push that button so many times as I tested the code that I was a slave to the device, sitting upright in a chair, hour after hour, like poor Desmond from the TV series Lost.

This prompted me to interface a transistor and DPDT relay to allow the Raspberry Pi to perform the circuit switching, so that I could finally lie down in another room and remotely instruct the Raspberry Pi to auto-switch the circuits during programming (via SSH or XMPP commands). My interface started to get unwieldy as shown below:

I later decided to streamline this and just have the Raspberry Pi do the whole thing (compile, program, and switch the GPIO functions), eliminating the need for the usbasp programmer completely. Avrdude, the Linux AVR programming software, can be recompiled to include a GPIO "bitbang" mode, allowing the Pi to program the ATTiny1634 directly, using the Pi's 3.3 volt logic.

Programming

You generally cannot use an interpreted language on an ATTiny so this forced me to revisit C language, my old friend, and I am really glad I did.

Working within fixed hardware constraints can be a wonderful feeling, reminiscent of the old 8-bit days of the Commodore 64. These constraints force you to perform early optimization, something modern programming dogma says not to do. The more you can cram into the device, the more efficient the device becomes, which is actually the inverse of what happens in normal programming.

This is known today as minimalistic computing↗, and it is an important exercise one should periodically do to maintain perspective. It teaches you that the layers of abstraction you see in high-level languages, especially object-oriented ones, can be very inefficient for many tasks. Many design patterns expressed in high-level languages can also be expressed easily in low-level.

Human logic, for example, is something integrated into the English language, but we don't need the full English language to express this. Low-level languages can be even more expressive in this regard.

Moving around in space, memorizing locations of objects, etc, do not require a full object model. Even certain aspects of the human experience are very low-level concepts, as they are the result of emergent and swarm behavior.

So working on a tiny AVR can be more rewarding than building giant, high-level systems. I've applied this philosophy of minimalist computing to other areas in recent years (Raspberry Pi, Arch and Void Linux, RogueLike, InteractiveFiction, RobotDesigns and OswaldCluster ).

In many ways, high-level object languages are an attempt by programmers to "force" a false world from the top-down, an upside-down Tower of Babel, when it should naturally evolve, collectively, from the bottom up.

My HyperSystemizing mind led me to create systems at an early age, but what I learned when I got older was that any system you create is flawed by design, just like any machine you engineer is inherently flawed.

If you subjugate people into such a system, you are, in essence, the king of a corrupt, impoverished country of your own design.

The key to avoid systemic corruption and corruption of those within appears to be to keep the structure simple, with simple rules, and open it up to outside influence, similar to the Unix philosophy↗.

In May 2015, I created a working, solar-powered game that I presented at the first US International Roguelike Developers Conference (IRDC) at the Georgia Tech campus in Atlanta. The project page is called TinyRoomTinyWorld, and there I outlined the game and some of the technical challenges that had to be overcome. It was only an example, and I have many other designs and prototypes that are different, but it made me tremendously happy to finally, after over two decades, have something real to show for my years of research on microcontrollers, however small. Atmel first released the ATtiny1634 only two years prior (2012), and I was pleased to be able to adapt my (by then) 20-year-old ideas to new technologies. These fascinating, sufficiently advanced, pea-sized devices really seem to be, in the words of Arthur C. Clarke, "indistinguishable from magic".

In 2016, however, inspired by Red-Winged Blackbirds and Clarke's fictional and non-fictional concepts, I tried to create some of that magic by building my most complex and difficult project to date, incorporating 4 CPUs, a Raspberry Pi Zero W, ESP8266, two ATtiny 1634s, and electronics and 3D-printed robotics. I called it TrillSat and created the first prototype TRILLSAT-1 in 2018.

While building TrillSat, however, a new, more powerful and less expensive microcontroller called the ATtiny 3216 was released, and is now my pea-sized chip of choice. I ordered a few of them to explore its possibilities. These are wonderful times to work in low-cost electronics.

As excited as I get working with new technologies, though, I am reminded that there is a tradeoff, and the old ways are soon forgotten, and we never truly realize what we have lost until it is gone.

Comments