EI2030 / Low-power-E-Paper-OS

The Ambitious Plan to Put a Solar Panel on a Laptop by 2030
7 stars 1 forks source link

OS Options #1

Closed alistair23 closed 2 years ago

alistair23 commented 3 years ago

I wanted to point out Tock as an OS option.

It supports the Redboard Artemis, STM32 and a range of other MCUs you listed as potential options. It includes basic screen support as well (although not e-paper).

If you are running on larger hardware (with an MMU) xous is another option. They are working heavily on screen support, although again not e-paper.

If you are able to run Linux then everyone seems to use NXP chips as they have pretty good e-paper support. For example there is work to upstream the rM2 kernel and the rM1 even ran a standard distro.

hatonthecat commented 3 years ago

@alistair23 Thank you for these suggestions! Sorry I didn't see this comment earlier- I am new to Github and signed up for notifications just now but I welcome these suggestions and feel free to check out our Discord as well.

The Redboard Artemis seems a great option due to its low power- the other day I made a more in-depth video on solar powering it: https://www.youtube.com/watch?v=428cgrpPR0w Alternatively, the module or even the MCU could be sourced without the extra power consumption of the LEDs. Their A la carte design could potentially do away with the extra components that use power, such as the red power & blue activity indicator LEDs, which could use as much as 40% less of the 5mW it is said to use (features tab).

While it uses the Apollo3, it only has 384K RAM. The Apollo3 Blue Plus has 768K RAM, and Apollo4 has nearly 4MB (3.8MB counting SRAM & MRAM). While it doesn't have an MMU, it would be interesting to see what could run without external SPI RAM added. That said, there have been some attempts to run linux w/O MMU, such as the https://www.cnx-software.com/2019/12/03/western-digital-risc-v-linux-busybox-boot-sipeed-maix-go-board/ and it would be interesting to see how Tock could be used to run apps the way uclinux does in [limited ] and low power/tickless (https://www.electronicdesign.com/technologies/embedded-revolution/article/21795660/practical-advice-on-running-uclinux-on-cortexm3m4) memory, since stack overflow would be a potential issue.

Reflective displays are an alternative to e-paper that some in our EI2030 are also very interested in. They have low power (such as SHARP Memory display) consumption, and perhaps xous could be used with that since it it is not e-paper. Also, memory in pixel has some MbedOS support, which the Artemis Dev Kit is supposed to support fully.

There are some interesting Epaper software/drivers, such as PaperTTY & EPDiy, though it seems I am not sure as to the memory constraints, which is why I'd like to focus on monochrome drivers/conversion software like this GPS e-paper display

-Giovanni

hatonthecat commented 3 years ago

Also, the Apollo4 will support a 2-lane DSI output supporting 640x480.

While it may be practical to add external RAM via SPI as the Raspberry Pi Pico & Teensy 4.1 allow, the power consumption of PSRAM would be much higher than the FRAM that the gameboy used. Also, I read Apmemory : “AP Memory solutions offer low signal pin count (6 for QSPI, 11 for OPI), low power (standby from 20uA to 80uA, active from 3mA to 8mA), and high transfer rate options needed to meet the demanding power and space constraints of wearable and other battery-powered smart consumer devices.”

I’ve looked into other memory providers, such as Adesto CBRAM by Dialog Semiconductor & Cypress, which produces 1MB FRAM & low power 8MB storage. I think the need for extra RAM depends on whether RTOS & Linux developers can utilize low-memory footprint to run apps. Perhaps serially threaded apps that do not require multitasking may work better since the latter would constrain the MCU, and aren’t designed for, but are capable of multitasking.

One idea I had was to have apps stored externally on flash, and the OS reboots to load different apps, or perhaps kexec could switch kernel modules without needing to reboot, dumping the stacks/modules that aren’t needed per app.

That said, I've found some really low memory linux OS like Tiny Slitaz, which requires 4MB on x86 using a very old kernel and would be curious as to whether their ARM port could run on Artemis: https://www.cnx-software.com/2012/12/15/slitaz-armhf-46mb-linux-distribution-for-raspberry-pi/ (uses 7MB RAM after boot).

alistair23 commented 3 years ago

Thanks for getting back to me. I don't have a discord and don't want to sign up to another proprietary chat service, if you setup a Matrix room I'm happy to join though.

You can run Linux without and MMU, but it's not an ideal experience. Damien is only able to run simple hello world userspace apps on the Kendryte board that you are mentioning (also all of that work is RISC-V not ARM).

Tock apps work with a embedded libc like newlib. So things like malloc() are available, but it's not POSIX compliant.

It seems like you would like to run a full POSIX compatible OS, in which case I would consider using the IMX SoCs. They can run Linux comfortably and are already used in eInk devices. Otherwise I say to avoid trying to run POSIX things on really smalled embedded chips. It seems like a large amount of work and will be very limited as you will quickly hit resource constraints.

hatonthecat commented 3 years ago

Hi, I would be happy to set up a Matrix room soon.

I did a little analysis on power consumption for an i.MX microprocessor and an Ambiq microcontroller and an estimate of the major components of a solar powered netbook form factor that functions as just a typewriter/90s flip phone using a 4.4" MIP screen and a 5.71W Anysolar solar panel with 25% efficiency. While there do not appear to be any linux ports to the Ambiq Apollo series, I am curious as to whether the XiP aperture that they indicate of 96MB on the Apollo3 Plus is usable as RAM, and whether it could run at the speeds mentioned by APMemory. I have attached an OpenCalc document (ods), which compares the lowest power i.MX processor (a single core A53) on the newest 14nm node, to the Apollo4, and found that with a 640x480 display, TX11D200VM1AAA, at 200mhz of 96MB flash/RAM, the total netbook (excluding keyboard & mouse) consumption is 161mW. Granted, I am comparing this to a $430 Freewrite and a 90s flip phone but the most expensive parts of this system would be the solar panel ($80) and display ($140+), except this would be solar powered with a lot of linux optimization. However, understanding that XIP may not be able to load an entire linux kernel, I do not know enough whether it could run an ARM port of DSL or TinyCoreLinux, which can use as little as 30MB RAM in idle (I believe it uses squashfs, so I do not know if XiP could run or if it needs AXFS or cramfs or something else). But I think if a single app could run, it could definitely be powered by a 5W solar panel producing 500mW (assuming 10% efficiency in low light) and provide 3x the power even if running at 161mW, thus enough to simultaneously charge the battery. With eMMC/SD, the Apollo4 could even support a third storage, in addition to SPI, so that other apps could be swapped out and the flash unmounted when not in use.

As for the keyboard, I think it would be too expensive to install 104 $10 energy harvesting switches on each key ($1000+), however perhaps there is a way to use a few or as little as two harvesting switches that reuse the zones of the keyboard for power even though individual keys are selected. Perhaps 104 keys could map to 13 different switches, each having 8 different possible data transfers, perhaps requiring a different amount of pressure for certain keys to differentiate the signal perhaps.

The mouse, I think could use BLE as the Apollo4 supports bluetooth, or the touchpad could be on the keyboard using some other low power interface.

alistair23 commented 3 years ago

That's great to hear about a Matrix room!

I'm not contesting that the i.MX would use more power, I do think that if you want to run Linux though it will be worth spending the extra power budget to run a Linux compatible SoC instead of trying to force Linux onto a small SoC. For example if you have to write a custom app just to get something that works, then what is the advantage of using Linux? You have lost the benefit of the user-space software ecosystem at that point.

Which is why I originally suggested Tock as a good starting point if using the Apollo MCUs.

hatonthecat commented 3 years ago

Hi Alistair, I created a Matrix room for this project: #lowpowerOS:matrix.org

I used Element app so I am still new to that- hopefully it's working right.

I believe the advantage with Linux, as has been written in their philosophy, is it's about freedom, rather than cost: https://www.gnu.org/philosophy/free-sw.en.html

The issue here isn't about software only however, but hardware. The cost of development may be high, but it becomes amortized over time, as long as the microcontroller platform (Ambiq) remains profitable.

The user-space software ecosystem has always had a memory limitation, except that feature-creep creates a dependency on a larger memory requirement, since it is not a 100% modular system. I have looked into TockOS and I do like the sandbox features- it resembles seL4 so I am willing to look more into it. I do not know what kind of user-space apps it can run, but the components, like FreeRTOS, seem very modular.

It may be possible that many apps could run without a kernel- using an abstraction language that interfaces more directly with the hardware as in exokernels, and that would appear to be a more limited use scenario- so limited that there don't appear to be any maintained OS's that use that.

IoT is obviously an emerging market that probably has or will represent a larger fraction of consumer/user devices in terms of having a larger market share of number of ipv6 based addresses (including those w/o ip addresses). While that isn't exactly relevant, there are a lot of electronic devices that require user-space interaction, but do not require a major suite of apps. The first organizations to adopt high-tech, expensive renewable technologies are municipalities and industries, such as shelf-labels using e-paper displays, bus stations that use epaper to refresh their estimated arrivals using lower power, and solar powered lights on the interstate and parking lots.

But I consider a lot of these technologies rarely advertised to the consumer, in ways that industrialized world does not need because there is a stable access to infrastructure (running power & water), with some exceptions during natural disasters. It is very likely that climate change can affect this access and alternative technologies should be researched more so that there is a technology that is efficient if there became a need for a reliable, basic telecommunications infrastructure. There are many excellent and brilliant technologies that have already achieved energy efficiency such as Solar LEDs, that they can be used without requiring access to kerosene or a utility provider. In a way, it liberates those living in poverty by having one less cycle or subscription to pay into (much like a proprietary Discord server, as opposed to something like Matrix). The NYT had an article around 2009 or 2011 about solar lights, but here is a much more recent article on it: https://medium.com/power-africa/how-solar-lanterns-are-transforming-the-african-continent-ce46f99accfc

Light is more essential than a cell phone in many ways. But the technology in 2021 is ready for solar powered "walkie talkies" & SMS devices. While I am suggesting a linux OS, what I am trying to suggest is an OS that can import any app from an external storage medium or network protocol so that it operates in a serially threaded manner, rather than designing it like three people walking through a door at the same time, if they will not fit. The human limits for multi-tasking are limited, and therefore it is not obligatory to design operating system ecosystem that depends on pre-loading three apps when they can be serially loaded by rebooting the OS or by removing the kernel modules in realtime using kexec:

"https://linuxgazette.net/issue01to08/linuxita_mar96.html

"How small can a useful Linux system get? Linuxita fits on 4.7M of disk space, works well in 3MB of RAM on a 386sx, and the compressed tar file fits on a single 1.44M floppy."

"I have had many communications since with people seeking to set up Linux systems in 3M of RAM or less, and in most cases the mistake they have been making has been using the slackware boot kernels. Those will take up at least 1.5M of RAM with all the compiled-in drivers, often leaving too little to boot init and the standard getty's and daemons, plus a shell. Monica's kernel takes up 1068K (and loads extra kernel modules when needed)."

"On the other hand, I had to keep, or perhaps include as extras, if one wishes to look at it that way, utilities to insert and remove dynamic kernel modules (insmod, rmmod, modprobe, depmod). These come in the modules-1.2.8 package on most archive sites. I use the kernel daemon (same package) to take some of the strain away. It unloads modules from RAM when they are not used for 30 seconds (by default), which is valuable."

To me it seems that programmers in the 1990s had to be more creative because of the limitations of memory at the time, yet were able to run complex applications at the time. Windows 3.1 ran on 1MB of RAM, and Windows 95 ran on 4MB. yet these were pre-loaded with tens of applications allowing an extraordinary amount of userspace freedom in terms of [windows, icon](https://en.wikipedia.org/wiki/WIMP_(computing), mouse, pointer.

Freedom because a mouse operates on an x,y,z axis. Mobile computing has largely removed these freedoms and introduced less-precise ways of interacting with a GUI while at the same time creating a monolithic (wall-of-text like) memory requirement that prohibits solar powerability. My point is userspace is based on a false expectation of a "sky's the limit" approach to a one-size-fits-all kernel.

The consumer has adopted a mainstream OS for the convenience of having access to a large suite of Apps (e.g. Windows/OsX/iOS/Android). But in choosing to adopt this platform, they have traded away their ability operate a device for basic communication in the pre-technological convergent era, before multimedia apps became standard on computers.

Viewed another way, if the purpose of creating a product is provide more consumer options in the free market, then energy independence from batteries and USB charging is a positive addition to that consumer market. A hypothetical solar mobile phone/tablet/laptop wouldn't be designed to replace the productivity machine, but supplement it in situations where it is impractical to use an all-purpose phone/device. Industrialized society already owns multiple TVs, laptops, and cars, but with all new technologies, like electric cars, there is "range anxiety."

I may be sounding a bit hypocritical to suggest that people should own two phones, and claiming it is more environmental, to use one more efficiently, but the point is no one else is even trying to make it more efficient, because phones/mobile devices are both important apps and for leisurely apps. I can also imagine special use cases where making phone calls and sending essential ones in case of emergency if the battery goes out, and one for running Youtube, but the problem is that phones require a minimum amount of power for their operating system to run, and it's due to the fact that it is designed so the kernel is for an all-purpose multimedia one.

If I was an emergency responder, or a wildfire dispatcher, I wouldn't want my phone to run out of battery because Google Sheets is updating or patching my gmail app. I would want it to ping the nearest 2G or 4G tower with a minimum bit rate capable of reaching a destination using as little power as possible.

The barrier to this, I believe, since I do not know of anyone else trying to develop this, is affluence. "Necessity is the mother of invention." I don't need a solar powered cell phone, but I can empathize with someone who would need it, because they do not need access to a village has electricity. My understanding is that suggesting this kind of technology would be both transformative and disruptive, but so were many other technologies that are used today (such as this computer and screen), as opposed to sending letters by sea-faring. :)

I do suggest many concepts here. I am first making power the first priority of the system- low enough so that it can cut the USB cord.

Second, I am suggesting the operating system essentially re-install the kernel every time a different app is loaded, since it could run entirely in SRAM and not require additional external RAM (XiP, etc)

I read that MicroMagic has developed a RISC-V processor that can operate at the near-threshold voltage. This kind of technology was researched by Intel as early as 2011- the solar powered Claremont That technology made its way into the Quark series processors:

http://linuxgizmos.com/who-killed-the-quark/

"The Quark X1000 also felt pressure from Intel’s own Atom family of SoCs, which these days are more often tagged with the Celeron and Pentium brands. Atom SoCs have gradually improved power efficiency while also boosting performance, especially in graphics.

"Perhaps Intel’s largest impediment was itself. It could never quite decide what the Quark was for and was never able to capture the developer market. The Curie was especially notorious for spotty public documentation and the requirement for signing NDAs to get the full specs.

The low-end chip market is tough going and marked by low margins. Intel had the market clout to succeed, but it was earning such high profits from its popular Xeon and Core chips, the Quark was quickly neglected. To a lesser degree, its Atom line has suffered from the same dynamics."

I believe the issue here is profitability and consumer interests have two very different objectives.

http://rhombus-tech.net/whitepapers/ecocomputing_07sep2015/

"What is "good enough" computing? Somewhere around 2009 the phrase "good enough computing" was used to refer to computers that, whilst not sufficiently powerful to fulfil the absolute latest and greatest specialist tasks, nor satisfy the craving and hunger of those who live at the edge of technology's fast lane, would basically "do the job", for the majority of tasks that the average person would ever need. They could buy a computer now, in other words, and, as long as they didn't need to do anything else, they could keep reading email, browse the internet, write documents and print them, watch films, listen to music, and chances are that the same computer would be there, on the same desk, gathering dust behind its cables, in three possibly even five years time.

It's worth pointing out that such people are a manufacturer's nightmare...

Now, in 2015, "good enough computing" has been cross-examined, and found wanting - perhaps not for the right reasons though. The key problem of having a three to five year old computer is not so much that it can't do the job it was designed to do: if the computer was not connected to the Internet it could continue to be used for its designated tasks until it suffered major component failure (possibly in 8 to even 15 years time).

The problem is that the kinds of web sites that most people visit and want to use are being designed with modern computers in mind. Even some recent smartphones are more powerful than high-end desktop computers of a decade ago. The latest version of Google Maps, for example, when using the "Street View", overwhelms a recent version of Firefox running on a computer with 8 Gigabytes of memory and a Dual-Core Dual-Hyper-threaded 2.4 Ghz processor, causing it to reach 100% CPU and lock up the entire machine.

But that's not so much the real problem: the real problem is the inter-dependent nature of Software Development. Upgrading even just one application often brings in a set of dependencies that can result in the entire operating system needing an upgrade. And the longer the duration since a software upgrade, the less likely it is that one single application may be upgraded without huge impact and inconvenience. With no knowledge (or convenience) on how to upgrade software or hardware, most people pick the simplest solution...

Sadly, for most people, the solution to "upgrading" is to throw away a perfectly good computer."

This is my introduction to recyclable mobile platforms. By choosing a microcontroller and an operating system that is modular from the kernel up, it doesn't require discarding the entire laptop or phone. Therefore, an energy efficient microcontroller represents a building block of a larger platform- not one that uses multiple microcontrollers or OSes necessarily, but rather, a building block that can be repurposed or temporally unmounted (as in an uSD) that does not need to be powered after booting an app into RAM. Theoretically this would require maximum development time to tailor the many apps that are already out there for such an OS, but that does not appear to be required. What does appear to be beneficial, is a port for a OS that can run a bootloader designed to flash firmware rather than using an external flasher.

When I asked a friend who knows a little more about the subject, he offered a few interesting suggestions:

"If the goal is just low level linux than an embedded linux setup might be easier. If you have non-volatile memory, I guess theoretically you could flash a microcontroller with new binaries on-demand. But to do that I think you'd need some kind of bootloader controller that flashes the firmware, which might add complexity to the design. You'd need some input that would signal to the loader to flash the device with a given binary. Which means you also need a memory system to store the binary. And then flashing would have to happen in whatever communication protocol the microcontroller expects. On the Arduino/teensy it is often done over USB, though there are other external programmers like UPDI. Unfortunately most of the programmers require a computer to load the binary onto the microcontroller afaik. Maybe there are hardware bootloaders out there? I found this project on Github, it is pretty new.

The other solution is...maybe not try to do on-demand binary loading and instead take a low power microcontroller and just give it more program memory (one big binary) and then try to optimize it for low cycles and low power consumption. Perhaps there is a way to combine multiple binaries into one big binary and the microcontroller could switch gears while running."

"I found an old thread discussing the idea of loading different binaries to an Arduino from an SD breakout board. So it seems plausible, but also seems like it adds complexity and maybe cuts into available program memory.

https://hackaday.com/2012/02/21/flash-an-arduino-from-an-sd-card/ https://baldwisdom.com/bootdrive/

This project seems to be able to load bootloaders off of SD: http://belogic.com/uzebox/index.asp Gameloader: 4K Bootloader that loads and flash games stored on SD cards!

Also apparently you can use one Arduino to program another Arduino...so that would solve the problem except it instantly doubles the amount of hardware needed:

https://www.arduino.cc/en/Tutorial/BuiltInExamples/ArduinoISP

This kind of setup seems very useful if you need to program thousands of Arduino's with the same binary and want to side step having to use a computer."

I haven't looked into all those bootloaders very well, and it is not my specialty nor do I feel capable of understanding it, but I think that all the innovations in operating systems should be viewed as a tool for future development- even if a software became useless in the 1980s or 1990s, I think there is a gold mine of software/tools/tricks that became abandoned ever since the onset of larger memory making efficiency less important, since it is relying on Moores law for improvements in speed, rather than in software.

This last thing I wanted to write about in this reply is more of a personal reason, and I will admit that my interest in developing a solar powered laptop/phone is more to emphasize the progress of power efficiency and computing/technology rather than having an immediate need in an industrialized nation (which isn't in contradiction of what I wrote about earlier- that it will be useful in times of natural disasters and climate change or where access to electricity is unreliable), but in 1976, the first solar powered calculator was released. There were fake ones too: https://tedium.co/2017/08/09/calculators-fake-solar-charging/ When I was a kid, my Ti-30xa Solar was and is a real tool. I imagine that 45 years since the first calculator, that someone would be interested in surfing on the wealth that Moores Law provided and making a device that can solar power a digital typewriter, like the Pomera DM-30, or the Astrohaus Freewrite? The Pomera is a much more utilitarian device. The Freewrite, in my opinion, is an admirable love letter to writers. It's a gorgeous contraption, but for the sake of efficiency, it could run on an Apollo4 without any additional RAM, and could be powered on a low power epaper or memory in pixel screen. It would probably cost more than most would want to pay for it, and it wouldn't be a product that would last more than 50 years most likely, so posterity is not really a feasible thing. It kind of represents an existential nod to https://en.wikipedia.org/wiki/Clock_of_the_Long_Now by Brian Eno- in that technology is often forgotten about, and there isn't a way to really keep track of what's important. At the same time, selecting carefully procuring technologies and eco-conscious philosophies- that is, both software and hardware that isn't going to end up in a landfill in 5 years may give more time for the world to adjust to climate change. This isn't a criticism towards anyone including you in particular, but at the cultural habits at large. I hope that can help clarify the interests of my philosophy.

Thanks for reading -G