write two articles about cost of hardware for Gopher - tgtimes - The Gopher Times HTML git clone git://bitreich.org/tgtimes git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/tgtimes DIR Log DIR Files DIR Refs DIR Tags DIR README --- DIR commit 812f6bfe1baa59beec1220bf4e8a4e4db3385c61 DIR parent d9486721b97cbded94d8f48e118f9fce9493f77b HTML Author: Josuah Demangeon <me@josuah.net> Date: Sun, 29 Jan 2023 01:52:48 +0100 write two articles about cost of hardware for Gopher Diffstat: M opus | 2 +- M opus7/article-athas-shell-redirect… | 2 +- D opus7/article-tgtimes-most-minimal… | 1 - A opus7/article-tgtimes-most-minimal… | 88 +++++++++++++++++++++++++++++++ A opus7/article-tgtimes-most-minimal… | 62 +++++++++++++++++++++++++++++++ A opus7/article-tgtimes-panopticon-e… | 0 A opus7/article-tgtimes-peering-cake… | 0 A opus7/footer.mw | 24 ++++++++++++++++++++++++ A opus7/tgtimes7.mw | 14 ++++++++++++++ A opus7/tgtimes7.pdf | 0 A opus7/tgtimes7.txt | 100 +++++++++++++++++++++++++++++++ 11 files changed, 290 insertions(+), 3 deletions(-) --- DIR diff --git a/opus b/opus @@ -1 +1 @@ -v=6 +v=7 DIR diff --git a/opus7/article-athas-shell-redirections.mw b/opus7/article-athas-shell-redirections.mw @@ -1,6 +1,6 @@ .SH athas Shell Redirections -.2C 60 +.2C 30 . .PP Newcomers to the Unix shell quickly encounter handy tools such as DIR diff --git a/opus7/article-tgtimes-most-minimal-gopher-client-hardware.mw b/opus7/article-tgtimes-most-minimal-gopher-client-hardware.mw @@ -1 +0,0 @@ -https://github.com/ptrks/AVR-ENC28J60-Examples DIR diff --git a/opus7/article-tgtimes-most-minimal-gopher-client.mw b/opus7/article-tgtimes-most-minimal-gopher-client.mw @@ -0,0 +1,88 @@ +.SH athas +Most minimal gopher client +.2C 30 +. +.PP +Gopher is a protocol allowing browsing text, images interactively, +reach telnet interfaces, and download any file, or open any URL, +for custom action to be chosen by the user. +. +.IP "Network" +One reliable way to fetch the content from internet would be Ethernet, +but convenience and price would push toward using radio transmission +such as WiFi. +.FS +Ethernet would require an extra transceiver chip, while wifi takes mostly +just a wire acting as antenna, which partly explains its low cost. +.FE +. +.IP "Processing" +One inexpensive family of processors featuring a high cost-to-performance +ratio, which also features WiFi, is the ESP32. The C3 iteration even uses +the open-source architecture RISC-V. The speed is decent enough for +decoding JPEG an PNG, or support TLS as used in gophers://. +. +.IP "Display" +The cost of displays have dropped considerably as they invaded the market. +Economy of scale made small color displays even cheaper than +character-based displays. +. +.IP "Input" +Browsing content is a lot about scrolling. Since we do custom hardware, +capacitive touch buttons can be used for little to no extra cost. +This could permit a smooth scrolling through the content. +.FS +Once again, mostly requiring wires, this cuts the price and explain +their popularity. +.FE +. +.IP "Text" +Text is compact and efficient, and bitmap font requires a bit of storage +for all the common non-ASCII characters, but ESP32 have 16MB of flash +storage enough for the entire uncompressed Unifont: +.LK http://unifoundry.com/unifont/ +. +.IP "Audio" +Producing sound does not cost much more than a small audio amplifier, +software for decoding MP3, and a 3.5mm Jack connector. +Very small cost added. +. +.IP "Extension" +an USB interface would allow plugging the device to a computer for +either automation or using a full keybaord. +. +.IP "Power" +A small dedicated battery could be included increasing the cost, +but getting all power from USB would also preserve the choice to +the user, free to chose a wall charger or portable power bank. +. +.IP "Enclosure" +A custom 3D printed case would allow keeping the cost very low +even at small volume production. +. +.PP +There exist boards around 5 USD which would provide all of the above +except audio and a few wires, typically the size of an MP3 player. +The grand total bill of material could realistically approach 10 USD. +An actual product could eventually reach as low as 15 USD if keeping +only a small margin for the seller, and eventually lower if produced +on a larger scale. +. +.PP +Writing the software for such a product from the ground up could take +typically an entire week, including JPEG and PNG decoding libraries, +image and font rendering, writing driver for all the parts involved, +integrating the TCP/IP stack and TLS stack. +. +.PP +While an XML parser able to fetch content over HTTP would be relatively +as difficult to build, this would not permit the same level of user +experience as the Gopher-based project: CSS and JavaScript are becoming +an increasingly frequent requirement to access the Web, and reimplementing +a new compatible rendering engine is not feasible to a single person. +. +.PP +This requirement would in turn affect the minimal performance of the +processing unit used: a processor in the GHz range with RAM in the +GB range, in particular if anticipating future needs of the Web +software system. DIR diff --git a/opus7/article-tgtimes-most-minimal-gopher-server.mw b/opus7/article-tgtimes-most-minimal-gopher-server.mw @@ -0,0 +1,62 @@ +.SH tgtimes +Most minimal Gopher server +. +.PP +Gopher is a protocol providing a gateway to a document system, allowing +to serve an organized hierarchy of files over the network. Dynamically +generating the content as per user requests is also possible. The client +side is in charge of rendering the content as it sees fit. +. +.PP +Generating Gopher indexes and transmitting file contents or generated +contents is low in software compmlexity, and in turn allows less expensive +hardware to be run than complex web stacks. +. +.PP +Which cost would we end-up for building a minimal piece of hardware able +to host the Gopher protocol acheiving all of the above? +The Gopher Times investigates. +. +.IP "Communication" +While WiFi is inexpensive and fits moving device gracefully, the +reliability of Ethernet is indicated for a server. Ethernet adds +1 USD of cost for the transceiver handling the electricial characteristics +of Ethernet. These typically expose an RGMII interface. +. +.IP "Processing" +A microcontroller featuring an Ethernet peripheral (with an RGMII +interface) could be the popular STM32F103, or an alternative +compatible part. Enough processing power would be present for an +embedded TCP/IP and a TLS stack. +. +.IP "Automation" +In addition, most microcontrollers feature a large range of +built-in peripheral such as timers and communication or analog +interfaces, enabling automation of devices such as lighting, +heating, laundry, motors, or an entire car, through external +modules. This would come for no extra cost. +. +.IP "Storage" +A slot for a MicroSD card would allow storing and updating +the static content to serve, and storing network configuration. +. +.IP "Scripting" +There exist project to fit programming languages onto microcontrollers. +Separate projects for supporting a subset of each of Python, Ruby, +Javscript, Go, Rust, Lua, Forth and more. +. +.IP "Power" +By letting power supply happen through the USB port, a large range +of power source can be used, such as battery, solar panels, wind +turbine, hydropower, or power outlet. +. +.PP +The bill of materials for such a design would approximate 5 USD. +A marketed device with a small margin for the seller could reach +as low as 10 USD. +. +.PP +Interestingly, such a device would also be able to provide an +equivalent Web service able to work with all Web client, but +not running the existing popular Web server software stacks +known as "Web Frameworks". DIR diff --git a/opus7/article-tgtimes-panopticon-effect.mw b/opus7/article-tgtimes-panopticon-effect.mw DIR diff --git a/opus7/article-tgtimes-peering-cake.mw b/opus7/article-tgtimes-peering-cake.mw DIR diff --git a/opus7/footer.mw b/opus7/footer.mw @@ -0,0 +1,24 @@ +.SH you +Publishing in The Gopher Times +.2C 10v +. +.PP +Want your article published? +Want to announce something to the Gopher world? +. +.PP +Directly related to Gopher or not, +reach us on IRC with an article in any format, +we will handle the rest. +. +.DS +ircs://irc.bitreich.org/#bitreich-en +gopher://bitreich.org/1/tgtimes/ +git://bitreich.org/tgtimes/ +.DE +. +.PP +Did you notice the new layout? +We now can jump between single and double column as it is more fit: +Some large code chunks will not fit in a two-column layout, +but text is more pleasant to read on two columns. DIR diff --git a/opus7/tgtimes7.mw b/opus7/tgtimes7.mw @@ -0,0 +1,14 @@ +.TL +The Gopher Times +.AB +Opus 7 - Gopher news and more - Jan. 2023 +.AE +. +.so opus7/article-athas-shell-redirections.mw +.so opus7/article-tgtimes-10-cent-risc-v-mcu.mw +.so opus7/article-tgtimes-a-billion-gopher.mw +.so opus7/article-tgtimes-most-minimal-gopher-client-hardware.mw +.so opus7/article-tgtimes-panopticon-effect.mw +.so opus7/article-tgtimes-peering-cake.mw +. +.so opus6/footer.mw DIR diff --git a/opus7/tgtimes7.pdf b/opus7/tgtimes7.pdf Binary files differ. DIR diff --git a/opus7/tgtimes7.txt b/opus7/tgtimes7.txt @@ -0,0 +1,100 @@ + + + + The Gopher Times + +____________________________________________________________ + + Opus 7 - Gopher news and more - Jan. 2023 +____________________________________________________________ + + + + + Shell Redirections athas +____________________________________________________________ + + Newcomers to the Unix shell quickly encounter handy + tools such as sed(1) and sort(1). This command prints + the lines of the given file to stdout, in sorted or- + der: + + $ sort numbers + + Soon after, newcomers will also encounter shell redi- + rection, by which the output of these tools can conve- + niently be read from or stored in files: + + $ sort < numbers > numbers_sorted + + Our new user, fascinated by the modularity of the Unix + shell, may then try the rather obvious possibility of + having the input and output file be the same: + + $ sort < numbers > numbers + + But disaster strikes: the file is empty! The user has + lost their precious collection of numbers - let's hope + they had a backup. Losing data this way is almost a + rite of passage for Unix users, but let us spell out + the reason for those who have yet to hurt themselves + this way. + + When the Unix shell evaluates a command, it starts by + processing the redirection operators - that's the '>' + and '<' above. While '<' just opens the file, '>' + *truncates* the file in-place as it is opened for + reading! This means that the 'sort' process will du- + tifully read an empty file, sort its non-existent + lines, and correctly produce empty output. + + Some programs can be asked to write their output di- + rectly to files instead of using shell redirection + (sed(1) has '-i', and for sort(1) we can use '-o'), + but this is not a general solution, and does not work + for pipelines. Another solution is to use the + sponge(1) tool from the "moreutils" project, which + stores its standard input in memory before finally + writing it to a file: + + $ sort < numbers | sponge numbers + + The most interesting solution is to take advantage of + subshells, the shell evaluation order, and Unix file + systems semantics. When we delete a file in Unix, it + is removed from the file system, but any file descrip- + tors referencing the file remain valid. We can ex- + ploit this behaviour to delete the input file *after* + directing the input, but *before* redirecting the out- + put: + + $ (rm numbers && sort > numbers) < numbers + + This approach requires no dependencies and will work + in any Unix shell. https://github.com/ptrks/AVR- + ENC28J60-Examples + + + + Publishing in The Gopher Times you +____________________________________________________________ + + Want your article published? Want to announce some- + thing to the Gopher world? + + Directly related to Gopher or not, reach us on IRC + with an article in any format, we will handle the + rest. + + ircs://irc.bitreich.org/#bitreich-en + gopher://bitreich.org/1/tgtimes/ + git://bitreich.org/tgtimes/ + + Did you notice the new layout? We now can jump be- + tween single and double column as it is more fit: Some + large code chunks will not fit in a two-column layout, + but text is more pleasant to read on two columns. + + + +