Merge branch 'master' of ssh://git.n07070.xyz:1968/n07070/blog

This commit is contained in:
n07070 2022-11-09 00:14:34 +01:00
commit b27f5c92c0
13 changed files with 355 additions and 203 deletions

View File

@ -1,129 +0,0 @@
+++
date = "2018-09-29T01:08:28Z"
title = "SolarWeb"
draft = true
+++
# SolarWeb
> Make the web go down where there's a cloud.
------
# Damn clouds today !
Over the pasts years, the web has grown into a hungry monster, feeding off electricity, our social lives and our data. It grows, relentlessly, funded by venture capital and surveillance capitalism. It's supported by the states, who aim to control more and more of it. And compagnies all around the world are making good money by selling every private bit of you. A cloud has grown over our heads, shading us from the sun.
I'm going to try and not fall into the trap of 'more tech will the save us from the problems tech creates' as hard as I can. I'll fail, because I'm writing this guide today, but I'll be using what we can have or recycle today. It's easy to imagine, for me, how the web should be. You open whatever browser you have, and search for content, or look at the content you subscribed for. This content is hosted on a peer-to-peer network, running off solar power, or other renewable energy sources. It's a web made to express yourself, and make it easy for you to interact with everyone you know. Tech should stop being a pain.
I think a lot of this pain comes from the way it's designed. It's designed to make money, not to give us control. I'm not talking about the way the network works, I'm talking about the way content flows. It doesn't spread equally. People who live in rich countries will have high-speed internet, virtually unlimited storage and an nearly unrestricted access to the web. But it's worth remembering that only half of the world is not __connected__. In Africa, it's only 1/3 of the population. China is censored. But I'm not gonna make the list too long, I could write about this for days.
We need to rethink how the web works. We need to take into account the parts of the world who don't have the same wealth as us. Why ? Because we can.
I like to think of the web as a huge librairy anyone can consult when they want, whoever they are.
It's also the moment to say that a lof of people have paved the way, and I'll try to give as much linkback as possible.
I'd like to contribute my own books to human knowledge. I'm not saying it's a lot, but I'm sure that for a few people it's valuable and that's enough to me. But I'd like to make is as accessible as possible, and try to not destroy the planet at the same time.
So for that, I need to list my needs, learn how to provide for them, implement the solution and make it usable for more people. I'm not pretending I'm gonna solve the internet today, but I'd like to publish a bit of research I've done and make it live.
I'd like to try to improve upon the marvelous ideals that gave [https://solar.lowtechmagazine.com/](Solar.lowtechmagazine.com), and add a bit of decentralization to it and see how that works.
You see, one the main problems of building a solar-powered blog is that sometimes, it goes offline. That's really a bugger.
# Let's see what we need.
I'd like to adress a few things. First, accessibilty. Today, the web is getting fat. It's getting harder to reach. A typical web page is several megabytes. That's bigger than the classic __War And Peace__[^1]. It needs a lot of power and a lot of data, one is not eco-frienldy and the second costs money. Imaging browsing with 3G in India, or in a internet café in the suburbs of Bogota, ain't nobody got time for this fucking 24th pop-up for frozen fries ? I'll try my best to make the website be readble by screen readers and ledgable by people with viewing impairments.
Second, sustainability. The internet need a **LOT** of power. In 2010, over 10% of electricity in the U.S. was due to computer and IT equipment usage. At the current rate we're going, analysts and experts figure that 10% of the world's power bill will be spent on running computers. [^2] The main problem comes from the hyper centralization of data. We can share data in an acceptable way without needing a googol servers. I'm going to try and run my website from my own home with solar panels, maybe wind power and a battery. I'm going to try and salvage as much as possible, and buy new stuff only if I really can't find anything else.
Third, distribution. If I run my own server, I'm gonna need to find ways so that people actually find me, without needing Facebook. Obviously, my website is gonna be shared around the web if I'm lucky, but what happens if my server is going through a few months of cloudy weather ? You click on a link, and... nothing ? My website being simple, and low data, maybe I could find new ways to share it ? So I've been looking into a new protocol that doesn't need your computer to be up all the time. It's called Dat, it's super new and it's cool tech I want to try out, because it might work. My website will be hosted, in part, by the people who visit it. When you visit my website through dat, you'll have the option to seed it : keeping a copy on your computer and enabling others to read it even if my server is not up. Think of it a keeping a copy of a book from the librairy that your friend can reed.
Nobody provides a way to do that today. I'll make my own.
# Building the damn thing.
Now, I'm going to try to give a guide of how I did it. They might be technical terms, but I'll try to explain them the best I can, or add anotations.
On the hardware side ( the part of the computer you can hit with a hammer ):
- I'm gonna need a computer, so I'll use my **Raspberry Pi B**. It's a small computer board that runs Linux, and costs roughly 30€. The choosen model is kind of old, but the newer models draw more power, which I don't need. I've had one lying around for a while... With it,I'm gonna need to add a 16Gb microSD card. I used one salvaged from an old Android phone.
- I'm gonna need batteries. I've salvaged old "shared" bikes in a dump, which had batteries. I have 2 1100mha batteries, which is far from enough, but it's gonna be enough to shutdown the computer gracefully in case they is no more power. It's the backup power. I'll also look into using a car battery.
- I'm gonna need solar power. On the shared bikes, they also where solar panels. I'll run tests and mesure how much solar power I can get in a day.
- I'm gonna need an electric controler. I need to find a way to connect the car battery, the solar panels, the backup batteries and the computer. The voltage of each part might be different, and thus I need to adjust each current, and try to make it in the most efficient way. I'll also need a way to mesure the current charge of the batteries, and read it from the computer.
- I'm gonna need instruments to mesure the electric consumption of all of this. A standart multimeter or a multitester, also known as a VOM (volt-ohm-milliammeter), will do the trick. I also need to find a way to mesure the Pi's power consumtion.
On the software side ( the part of the computer you insult ):
- On the computer, I'll need software to host the website. For that, I'll use **lighttp**, which, you know, it's in the name.
- To actually make my website, code and all, I'll use **Hugo**. It's a static website generator. I'll talk more about how that works later on.
- When the weather is shitty, I'll distribute the website with Dat, which is a decentralized protocol to distribute websites. Think bittorrent but for websites instead of movies.
- I'd also like the website to be resistant to censorship, so maybe a way to access it by the TOR network, although it may use a lot more power.
## Testing and research
### On the hardware side
#### Solar Panels
First off, I needed to calculate to output of my solar panels. To do that, I ran several tests, in different conditions regarding ligth exposition, time of the day, and cloudiness. I also used an app on my phone to mesure the lighting level, but you can use any luxmeter.
// INSERT GRAPH WITH DATA
As you can see...
Now, I need to research the batteries.
https://learn.adafruit.com/usb-dc-and-solar-lipoly-charger/
### Converting the sun to 5V, 2Amp.
### On the software side
#### Power and Pi
I wanted to try several configurations of software to find the one that would be the most efficient, yet easy to use. The main problem with software is that complexity requires more power (duh). For example, I could do much of my maintenance via the command line, but it's not very easy. Or, I could install a content management system and it would be super duper easy, but might use way more power. Only way to find out, do tests.
#### Not everybody can read
The other side of software I wanted to experiment with was accesibility. First off, I need to think of the users that would want to visit my site, who could they be ? I could have blind people, so I need to make my content friendly to screen readers. Dislexic people, so high contrast and accessible fonts.
# Going further.
Links :
[^1] http://idlewords.com/talks/website_obesity.htm
[^2] http://large.stanford.edu/courses/2012/ph240/lee1/
-------
- https://www.w3.org/WAI/fundamentals/accessibility-intro/
- https://solar.lowtechmagazine.com/2009/06/embodied-energy-of-digital-technology.html
- https://en.wikipedia.org/wiki/Solar_panel
- https://www.jeffgeerling.com/blogs/jeff-geerling/raspberry-pi-zero-conserve-energy
- https://www.pidramble.com/wiki/benchmarks/power-consumption
- https://internetworldstats.com/stats.htm
- https://solar.lowtechmagazine.com/
- https://www.rs-online.com/designspark/solar-powering-your-raspberry-pi
- https://www.stewright.me/2017/07/a-portable-battery-powered-raspberry-pi-zero-web-server-with-solar-panel/
- http://www.reuk.co.uk/wordpress/raspberry-pi/solar-powered-raspberry-pi/
- https://www.rs-online.com/designspark/solar-powering-your-raspberry-pi
- https://hackaday.io/project/2333-my-off-grid-solar-system-monitoring
- https://hackaday.io/project/4268-raspberry-pi-solar-battery-monitoring
- https://news.nationalgeographic.com/news/energy/2012/08/120820-helix-wind-collapse/
- https://www.modmypi.com/raspberry-pi/power-1051/ups-boards-1051/ups-pico
- https://www.modmypi.com/raspberry-pi/power-1051/ups-boards-1051/pijuice-standard
- https://www.voltaicsystems.com/blog/powering-a-raspberry-pi-from-solar-power/

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

View File

@ -1,13 +1,141 @@
+++
draft = true
categories = []
title = ""
displayInMenu = false
dropCap = true
featuredImage = ""
description = ""
date = "2019-01-02T22:25:20Z"
displayInList = true
---
draft : true
categories : ["English","Solar"]
title : "Solar Web"
displayInMenu : false
dropCap : true
description : "Making the web go down when there's a cloud : Exploring the self-hosting of a website on solar energy"
date : "2022-11-01T13:37:00Z"
displayInList: true
resources:
- name: featuredImage
src: "cover.gif"
---
+++
# Damn clouds today !
Over the pasts years, the web has grown into a hungry monster, feeding off electricity, our social lives and our data. It grows, relentlessly, funded by venture capital and surveillance capitalism. It's supported by the states, who aim to control more and more of it. And compagnies all around the world are making good money by selling every private bit of you. A cloud has grown over our heads, shading us from the sun.
I'm going to try and not fall into the trap of 'more tech will the save us from the problems tech creates' as hard as I can. I'll fail, because I'm writing this guide today, but I'll be using what we can have or recycle today. It's easy to imagine, for me, how the web should be. You open whatever browser you have, and search for content, or look at the content you subscribed for. This content is hosted on a peer-to-peer network, running off solar power, or other renewable energy sources. It's a web made to express yourself, and makes it easy for you to interact with everyone you know. Tech should stop being a pain.
I think a lot of this pain comes from the way it's designed. It's designed to make money, not to give us control. I'm not talking about the way the network works, I'm talking about the way content flows. It doesn't spread equally. People who live in rich countries will have high-speed internet, virtually unlimited storage and an nearly unrestricted access to the web. But it's worth remembering that __only half of the world is connected__. In many countries of Africa, it's only 1/3 of the population. China is censored. But I'm not gonna make the list too long, I could write about this for days.
We need to rethink how the web works. We need to take into account the parts of the world who don't have the same wealth as us. Why ? Because we can.
I like to think of the web as a huge librairy anyone can consult when they want, whoever they are.
It's also the moment to say that a lof of people have paved the way, and I'll try to give as much linkback as possible.
I'd like to contribute my own books to human knowledge. I'm not saying it's a lot, but I'm sure that for a few people it's valuable and that's enough to me. But I'd like to make is as accessible as possible, and try to not destroy the planet at the same time.
So for that, I need to list my needs, learn how to provide for them, implement the solution and make it usable for more people. I'm not pretending I'm gonna solve the internet today, but I'd like to publish a bit of research I've done and make it live.
I'd like to try to improve upon the marvelous ideals that gave birth to [solar.lowtechmagazine.com](https://solar.lowtechmagazine.com/), add a bit of decentralization to it and see how that works.
You see, one the main problems of building a solar-powered blog is that sometimes, it goes offline. That's really a bugger.
# Let's see what we need.
I'd like to adress a few things. First, accessibilty. Today, the web is getting fat. It's getting harder to reach. A typical web page is several megabytes. That's bigger than the classic __War And Peace__ [^1]. It needs a lot of power and a lot of data, one is not eco-frienldy and the second costs money. Imaging browsing with 3G in India, or in a internet café in the suburbs of Bogota, ain't nobody got time for this fucking 24th pop-up for frozen fries ? I'll try my best to make the website be readble by screen readers and ledgable by people with viewing impairments.
Second, sustainability. The internet need a **LOT** of power. In 2010, over 10% of electricity in the U.S. was due to computer and IT equipment usage. At the current rate we're going, analysts and experts figure that 10% of the world's power bill will be spent on running computers. [^2] The main problem comes from the hyper centralization of data. We can share data in an acceptable way without needing a googol servers. I'm going to try and run my website from my own home with solar panels, maybe wind power and a battery. I'm going to try and salvage as much as possible, and buy new stuff only if I really can't find anything else.
Third, distribution. If I run my own server, I'm gonna need to find ways so that people actually find me, without needing Facebook. Obviously, my website is gonna be shared around the web if I'm lucky, but what happens if my server is going through a few months of cloudy weather ? You click on a link, and... nothing ? My website being simple, and low data, maybe I could find new ways to share it ? So I've been looking into a new protocol that doesn't need your computer to be up all the time. It's called Dat, it's super new and it's cool tech I want to try out, because it might work. My website will be hosted, in part, by the people who visit it. When you visit my website through dat, you'll have the option to seed it : keeping a copy on your computer and enabling others to read it even if my server is not up. Think of it a keeping a copy of a book from the librairy that your friend can reed.
Nobody provides a way to do that today. I'll make my own.
# Building the damn thing.
Now, I'm going to try to give a guide of how I did it. They might be technical terms, but I'll try to explain them the best I can, or add anotations.
On the hardware side ( the part of the computer you can hit with a hammer ):
- I'm gonna need a computer, so I'll use my **Raspberry Pi B**. It's a small computer board that runs Linux, and costs roughly 30€. The choosen model is kind of old, but the newer models draw more power, which I don't need. I've had one lying around for a while... With it,I'm gonna need to add a 16Gb microSD card. I used one salvaged from an old Android phone.
- I'm gonna need batteries. I've salvaged old "shared" bikes in a dump, which had batteries. I have 2 1100mha batteries, which is far from enough, but it's gonna be enough to shutdown the computer gracefully in case they is no more power. It's the backup power. I'll also look into using a car battery.
- I'm gonna need solar power. On the shared bikes, they also where solar panels. I'll run tests and mesure how much solar power I can get in a day.
- I'm gonna need an electric controler. For that, the Mo Pi 2 project is perfect, as it ties everything together and can be controlled directly from the raspberry pi. It cost less than 40€.
- I'm gonna need instruments to mesure the electric consumption of all of this. A standart multimeter or a multitester, also known as a VOM (volt-ohm-milliammeter), will do the trick.
On the software side ( the part of the computer you insult ):
- On the computer, I'll need software to host the website. For that, I'll use **ngix**. It's standard, and doesn't use much power when idle.
- To actually make my website, code and all, I'll use **Hugo**. It's a static website generator. I'll talk more about how that works later on.
- When the weather is shitty, I'll distribute the website with Dat, which is a decentralized protocol to distribute websites. Think bittorrent but for websites instead of movies.
- I'd also like the website to be resistant to censorship, so maybe a way to access it by the TOR network, although it may use a lot more power.
- I've found a project called [Scaphandre](https://github.com/hubblo-org/scaphandre) which makes it easy to mesure how much electricity you're using. I will help me make graphs and mesure which service is using the most power. Eventually, I'll make as the Rapsberry Pi to turn off some services if it's running low on power.
## Testing and research
### On the hardware side
#### Solar Panels
First off, I needed to calculate to output of my solar panels. To do that, I ran several tests, in different conditions regarding ligth exposition, time of the day, and cloudiness. I also used an app on my phone to mesure the lighting level, but you can use any luxmeter.
// INSERT GRAPH WITH DATA
As you can see...
In full sun, the solar panels output anywher between 12 volts and 14 volts.
Now, I need to research the batteries.
### Converting the sun to 5V, 2Amp.
As I've said before, the MoPi 2 is a fantastic HAT ( extension board ) for the Raspberry Pi that takes in two power sources, and regulates it. In this case, it's the solar panel array, and the battery pack.
### Connection diagram
![](connections_in_grass.jpg)
### On the software side
#### Power and Pi
I wanted to try several configurations of software to find the one that would be the most efficient, yet easy to use. The main problem with software is that complexity requires more power (duh). For example, I could do much of my maintenance via the command line, but it's not very easy. Or, I could install a content management system and it would be super duper easy, but might use way more power. Only way to find out, do tests.
From what I've learned, I can use an automation system called Ansible. I've wrote the software to manage the server on my Git server.
When I run the Ansible playbook, it will connect to the solar server, and do a repetitive and predicatble set of actions ; update the pi, update the website, etc...
#### Not everybody can read
The other side of software I wanted to experiment with was accesibility. First off, I need to think of the users that would want to visit my site, who could they be ? I could have blind people, so I need to make my content friendly to screen readers. Dislexic people, so high contrast and accessible fonts.
# Going further.
Links :
- https://www.w3.org/WAI/fundamentals/accessibility-intro/
- https://solar.lowtechmagazine.com/2009/06/embodied-energy-of-digital-technology.html
- https://en.wikipedia.org/wiki/Solar_panel
- https://www.jeffgeerling.com/blogs/jeff-geerling/raspberry-pi-zero-conserve-energy
- https://www.pidramble.com/wiki/benchmarks/power-consumption
- https://internetworldstats.com/stats.htm
- https://solar.lowtechmagazine.com/
- https://www.rs-online.com/designspark/solar-powering-your-raspberry-pi
- https://www.stewright.me/2017/07/a-portable-battery-powered-raspberry-pi-zero-web-server-with-solar-panel/
- http://www.reuk.co.uk/wordpress/raspberry-pi/solar-powered-raspberry-pi/
- https://www.rs-online.com/designspark/solar-powering-your-raspberry-pi
- https://hackaday.io/project/2333-my-off-grid-solar-system-monitoring
- https://hackaday.io/project/4268-raspberry-pi-solar-battery-monitoring
- https://news.nationalgeographic.com/news/energy/2012/08/120820-helix-wind-collapse/
- https://www.modmypi.com/raspberry-pi/power-1051/ups-boards-1051/ups-pico
- https://www.modmypi.com/raspberry-pi/power-1051/ups-boards-1051/pijuice-standard
- https://www.voltaicsystems.com/blog/powering-a-raspberry-pi-from-solar-power/
[^1]: http://idlewords.com/talks/website_obesity.htm
[^2]: http://large.stanford.edu/courses/2012/ph240/lee1/

Binary file not shown.

After

Width:  |  Height:  |  Size: 942 KiB

View File

@ -0,0 +1,77 @@
---
draft : false
categories : ["Blog","Français"]
title : "Collection de cartes et de plans "
displayInMenu : false
dropCap : true
description : "Ce mois-ci, c'est cartographie."
date : "2022-07-27T13:37:00Z"
displayInList : true
resources:
- name: featuredImage
src: "cover.jpg"
---
## [Bassins versans du monde entier](https://river-runner-global.samlearner.com/)
Cette carte vous permet de suivre le voyage de toute goutte d'eau vers l'océan ; cliquez sur n'importe où et vous verrez où donc va toute cette eau. Vous aurez même droit à un petit voyage sur une carte en 3D.
## [Carte des hammeaux légers de France](https://hameaux-legers.org/habitat-reversible/carte_aux_tresors)
Une véritable carte aux trésors pour qui veut déserter les villes et le capitalisme industriel urbain. Géré par l'association des hammeaux légers, vous y retrouverez les communes favorables, les hammeaux légers, des gens intéressés, des collectifs, des lieux ressources, etc... Et le design du site est très joli, à mon avis.
## [Carte des chantiers en cours à Paris](https://opendata.paris.fr/explore/dataset/chantiers-a-paris/map/)
Que vous ayez besoin de savoir si tel ou tel rue est en travaux, voir où sont les grues, ou pour toute autre raison. Le site d'Open Data de Paris est très complet, et vous pourrez y trouver plus que juste les chantiers en cours.
## [Carte des Échanges Internets](https://www.internetexchangemap.com/)
Lieu d'interconnexion des fournisseurs d'accès à Internet, les échanges internets sont des infrastructures stratégiques du réseau internet. Avec adresse et responsables, au besoin.
## [Carte des risques liés à l'eau](https://waterriskfilter.org/explore/map)
Réalisé par le WWF, cette carte vous permet d'explorer les risques liés à l'eau ( inondation, pollution de l'eau, sécheresse... ). Elle n'est pas très précise, mais elle expose de nombreux facteurs sur différents fond de carte.
## [Carte des sous terrains](https://indoorequal.org/)
Basé sur Open Street Maps, voici une carte des lieux souterrain. Par exemple ; les gares, les centres commerciaux, et passages sous terrain... Non, c'est pas une carte des catacombes de Paris.
## [Humanitarian Open Street Maps](https://www.hotosm.org/what-we-do)
En cas de catastrophe naturelle, la topographie des lieux peut changer radicalement. Si un tremblement de terre coupe des routes, détruit des batîments, il est crucial pour les gens et les secours de savoir par où passer, où aller pour se réfugier. HOTosm se charge de coordonner des bénévoles du monde entier à partir d'images satellites, de données du terrain, pour mettre à jour aussi rapidement de possible des cartes Open Street Maps.
## [Carte ADS ; des avions dans le ciel ](https://globe.adsbexchange.com/)
Suivre un vol en cours, connaître la position d'un avion, voici une carte pour le faire. Vous avez accès à la hauteur des avions, leurs numéros de vol, leurs destinations...
## [Serveurs Mastodon régionaux d'Allemagne](https://mastodon.xyz/@lightone/105759733156499126)
Une carte datant de 2021 des serveurs Mastodon en Allemagne par région.
## [Carte des routes des villes](https://anvaka.github.io/city-roads/?q=Paris&areaId=3600007444)
Choissiez n'importe quelle ville du monde, et vous aurez une représentation artistique des routes qui la compose.
## [Moniteur des centrales nucléaires](https://nuclear-monitor.fr/#/plant/BELLEVILLE)
Carte des réacteurs nucléaires français avec leur activité, production, état des réacteurs...
## [Carte des trains de France](https://carto.graou.info/)
Comme pour les avions, mais pour les trains Français. Tout les trains n'y sont pas forcément, mais y'a aussi une cartographie du réseau férré français avec les points kilométriques, les points radio...
## [Édition en temps réel sur OSM](https://osmlab.github.io/show-me-the-way/)
Tout les changements fait dernièrement sur Open Steet Maps.
## [Carte des câbles fibre sous-marin](https://www.submarinecablemap.com/)
Saviez-vous que nos fonds marins sont couvert de câbles depuis la fin du 19ème siècle ? Et si oui, saviez-vous à quoi ça ressemble aujourd'hui ?
---
Si vous avez des cartes que vous aimeriez m'envoyer pour que je les rajoutes à cette liste, n'hésitez pas ! Voir la page [À propos](/about-me/)
_Illustration de couverture par [adampadam](https://wordpress.org/openverse/image/2b1a8f75-2f06-45f4-bd2d-8ff481387ce4)_

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@ -0,0 +1,121 @@
---
categories : ["English","Hacking","Printing","Art"]
title : "Little Prynter"
displayInMenu : false
dropCap : false
description : "I've reinvented the fax : why, how, and why you could do it yourself too."
date : "2022-10-27"
draft : false
displayInList : true
resources:
- name: featuredImage
src: "cover.png"
---
### The backstory
A few years ago, a friend of mine showed me the [Little Printer](https://www.theverge.com/2013/1/29/3927228/little-printer-review), created by Berg Inc. I loved the ideal of having what was more a less a fax machine, that I could use to print out anything for very very cheap. It's based on a thermal printer, so it doesn't use any ink, and the paper is the same you would use to print out receipts. The issue was that it cost nearly 300€ (!), and that was way too much money for something that was a gimmic.
Moreover, it was pretty limited : it was tied to a proprieatry cloud system, and what I feard back then became true. Berg stopped supporting the Little Printer, and the whole ecosystem was now ready to become trash.
Thankfully, the [Nord Projects design studio hacked it back to life](https://nordprojects.co/projects/littleprinters/), and wrote a new app ecosystem for it. But it's cumbersome to setup, and getting your hands on the original Little Printer isn't easy.
A more personnal quarrel I have with designers is perfectly represented in the Little Printer project : It's a very beautiful object, but it's severly limited by it's design. You are expected to use it as a Little Printer, even after it's death. Using it in another setting is difficult because it's fragile. You can't really sell it or repurpose it once you've grown board with it. You would need to explain how to set it up, bring the little IoT box with it, etc...
I still liked the idea.
### Hacking in it, to try it out.
Another friend, whom I was visiting, had a thermal printer in his box of _things-that-gather-dust_ and was happy to lend it to me so I could try it out. I started to build my own Little Printer.
I wanted to build something KISS ( Keep It Super Simple ), easy to replicate, and that I could eventually build on over the years. Using existing components and combining them together in a way that was easy to reverse was also a priority. I had a Raspberry Pi, a computer running Linux, a USB webcam, and a Adafruit Thermal Printer.
The first thing was to learn how to use the thermal printer.
Thankfully, Adafruit has tutorial on how to build a polaroïd camera with a thermal printer, which I followed and built a first version of the little printer. It was nice, but had a few issues :
- The printer was super cheap, and wasn't very reliable. It often printed gibberish, and needed to be restarted.
- It only had a serial connection, and it wasn't possible to know when the paper ran out.
- The library I was using hadn't been updated in ages, and needed a CUPS driver dowloaded from a random chinese website. I tried using newer forks, but they didn't seem to fix the problems mentionned above.
Even with theses issues, I knew that thermal printing was a cool tech, and I could use it for a lot of my other printing and propaganda projects. So I started looking for another thermal printer.
### Making it serious
I eventually settled on an EPSON TM20-III, which is around 250€. Nearly the same prince as a LittlePrinter, but it has Ethernet, a standard-ish protocol, USB, two sizes of paper, a cutting blade, 300 dpi resolution, and prints so fast that when you fuck up the orientation of the print, before you can stop it, it already printed 3 meters of paper. In a word, it's perfect. I then bought 4 _kilometers_ of paper for around 50€. Also keep in mind that these printers are used around the world in industrial settings, and if you know how I'm sure you could find one for very cheap or second-hand.
I wanted to write the software in Python, because I found a very nice library for ESC/POS, the standard used by the EPSON printers. I also had built software with Flask, a python web framework, and I loved the design style and the ease it gave to build APIs.
After a few days of hacking, I finally had a complete photomaton that could be accessed from anywhere, printed anything for dirt cheap, and that I could easly extend.
There was Little Prynter.
### How the code works
The program starts thanks to a bash script, `run.sh`, that starts a Python virtual environnement, install the dependencies and runs the server with the good environnement variables.
It will in turn, call the flask command, that will launch a developpement server with the `main.py` file as it's starting point.
This file will define the routes that will be accessible on the server.
The `main.py` file will start by loading the configuration file, and then try to connect to the printer via the `Printer` class.
```python
configuration_file = toml.load("configuration/config.toml")
```
The tricky thing about connecting via USB is that you need the USB vendor and device ID loaded, but they are encoded in hexadecimal. So we pass thoses options to the Printer class, that will initiate a new global connection to the Printer.
It's faster this way, but we could open a new connection each time instead, in the `Web` class for example. The continus connexion sometimes hangs up, making it necessary to restart the software. On the other hand, we might get a concurent connection to the printer if two people try to print at the same time. Implementing a queue could solve this.
```python
# Printer connection
# Uses the class defined in the printer.py file
printer = Printer(app,0x04b8, 0x0e28)
printer.init_printer()
```
This class will mainly load the `escpos` library that does all the heavy lifting will connecting to the printer. It also defines to methods to print texte and an image. To note, the library, at time of writing, did not have the exact printer I have in it's database, but instead a close relative of it, which works _well enough_.
The web interface part is handled just after, in a `Web` class that makes heavy use of Flask, a Python framework for easily bulding web servers. I've learned how to write it thanks to [Miguel Grinberg's Flask Mega Tutorial](https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world), it's great and you should read it if you plan on writing anything based in Flask.
The web class handles calling the printing of the images via the `Printer` class I mentionned earlier. It's also goint to call the `User` class to manage the login and logout of users, if needed.
```python
def print_sms(self, texte, sign: str):
self.app.logger.debug("Printing : " + str(texte) + " from " + str(sign))
if not os.getenv('LIPY_DEBUG'):
time.sleep(1)
return self.printer.print_sms(texte, sign)
```
Finally, the `Main` class defines the routes that are callable, such as the main page ;
```python
@app.route('/')
@limiter.limit("1/second", override_defaults=False)
def index():
app.logger.debug("Loading index")
return render_template('index.html')
```
You can see that we are rate limiting each route thanks to the `limiter` package, that extends Flask itself. We are also using Jinja2 to manage the rendering of the web pages, which use normal HTML and CSS, altought we use BootStrap 3 for the user interface.
The Jinja 2 templates ( or HTML pages ) can be found in the `template/` folder. Some are partials, mening that they are reused in other templates.
A few pictures to show it off ;
![A picture of rubber duck on a thermal printer](result.jpg)
> A picture of rubber duck on a thermal printer
![A picture of the web interface](photomaton.png)
> A picture of the web interface
I also paid attention to the git repository I was writing this code to, and I provide instructions on how to set it up if you want to. You can find it all here : [Little Prynter @ git.n07070.xyz](https://git.n07070.xyz/n07070/littleprynter).
### In the future
I would very much like to make it portable, and maybe add some flash device to it, so it can be used in dark settings. Maybe keeping the image in cache, dithering it and offering a downloaded version would be nice too. Maybe offering a reprint so every one can have one, printing them by bunch of 4 like a real photomaton might do the trick.

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

View File

@ -1,5 +0,0 @@
# Solarpunk
I just got off my boat in this beginning of summer, 2034. The sweet coast of France, whased upon by a hot wind, where small trees now grow everywhere, replacing the old farms have brought a very peacefull atmosphere. I always loved arriving back home, the _depaysagement_ I felt in Greece was starting to get heavy on me. You would think that one of the biggest harbors in the region would be huge, all made of glass, steel and concret. But this one in constrat was the nicest I knew of. And I think that the light that fell from the glass roof, passing in the flowers that grew on the roof, all made of tiles of hexagonal wood pains, brought something to it. As I walked off the boat on a small deck I could only stop for a second and take a deep breath, pausing for a second and look at the harbord. The gardens that surrounded it, nowhere on earth where they so pretty. Now that all public space where made common, people had started to care about the places they lived in and made every parking spot into a garden, every mall into a community center and every townhall into a maternety, they was so many more place for beauty to arise from.
I need to get to my friend's house before noon but so much had changed in the past two years. Before, when you arrived here, you needed to take a bus or a cab to move around. It cost money, took time and it really wasn't enjoyable. Now, the tram made it possible for everyone to move around really fast. Being free and automated, they where trains every few minutes. I got on the one of 12:14, but I could of took the one before. I just needed a second to smoke a small joint I had left in the back of my pocket.

View File

@ -1,13 +1,20 @@
+++
draft = true
categories = []
title = ""
displayInMenu = false
dropCap = true
featuredImage = ""
description = ""
date = "2019-01-02T22:25:20Z"
displayInList = true
---
title: "Across Town"
date: 2022-10-03T13:37:07Z
description : ""
categories : ["English","Story","Solarpunk"]
dropCap: true
displayInMenu: false
displayInList: true
draft: true
resources:
- name: featuredImage
src: "cover.jpg"
---
+++
# Solarpunk
I just got off my boat in this beginning of summer, 2034. The sweet coast of France, whased upon by hot winds. Small trees now grow everywhere, replacing the old farms. They make for a very peacefull atmosphere. I always loved coming back home, the _depaysagement_ I felt in Greece was starting to get heavy on me. You would think that one of the biggest harbors in the region would be huge, all made of glass, steel and concret. But this one in constrat was the nicest I knew of. And I think that the light that fell from the glass roof, passing in the flowers that grew on the roof, made of tiles of hexagonal wood pains, brought something to it. As I walked off the boat on a small deck I could only stop for a second and take a deep breath, pausing for a second and look at the harbord. The gardens that surrounded it, nowhere on earth where they so pretty. Now that all public space where made common, people had started to care about the places they lived in and made every parking spot into a garden, every mall into a community center and every townhall into a maternety. There was so much more place for beauty to arise from.
I need to get to my friend's house before noon but so much had changed in the past two years. Before, when you arrived here, you needed to take a bus or a cab to move around. It cost money, took time and it really wasn't enjoyable. Now, the tram made it possible for everyone to move around really fast. Being free and automated, they where trains every few minutes. I got on the one of 12:14, but I could of took the one before.

View File

@ -1,47 +0,0 @@
#!/usr/bin/env bash
# This script will publish the compiled output of the blog
# as it is now in this directory.
# It could be futher improved by taking this version,
# making a git branch at this point, or a git tag
# to enable rollbacks.
# Make errors be fatal
set -e
WEBSITE_URL="https://n07070.xyz"
echo ">> Update the remotes..."
# Last blog version
git pull origin master
# Get last theme version
git submodule foreach git pull origin main
# Dither images present in the blog, moving the existing images to filename_original.jpg
# Commented, because colors is nice, and dithering actually brings more issues than it solves:
# Images size tends to be bigger, relative to quality,
# It's not easy for some people to see the image that way,
# It's more trouble than it's worth.
# echo ">> Dithering the images..."
# ## Travel down the directory content/
# find "./content" \ # Find from the content directory
# -maxdepth 4 \ # Maximum depth of 4 dirs
# -type f \ # Find only files
# -name "*.jpg" \ # Find only JPEG files
# -exec \ # Execute next lines
# cp {} {}.original && \ # Copy file and add .original to it's filename
# convert {} -colorspace GRAY -o ordered-dither o2x2 {} &&\ # Dither image
# jpegoptim {} -S 80 -t ; # Optimize the jpeg file
# Generate the openring ( https://git.sr.ht/~sircmpwn/openring )
echo ">> Generating the openring..."
openring -s https://www.laquadrature.net/feed -s https://blog.mondediplo.net/rss/ -s https://solar.lowtechmagazine.com/feeds/all-en.rss.xml < themes/blogotheme/layouts/partials/openring-in.html > themes/blogotheme/layouts/partials/openring-out.html
echo ">> Building the website..."
hugo --themesDir themes --theme blogotheme --baseURL="https://n07070.xyz" --enableGitInfo --minify --templateMetrics
echo ">> All done !"