Compare commits
No commits in common. "91baee38f10be307289bc9cae21f5bc5f35fd744" and "b61858e1cab2cd5c0dc68ca7be26b46009851bf6" have entirely different histories.
91baee38f1
...
b61858e1ca
129
content/Articles/Solar-D-Web/README.md
Normal file
129
content/Articles/Solar-D-Web/README.md
Normal file
@ -0,0 +1,129 @@
|
||||
+++
|
||||
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.
Before Width: | Height: | Size: 249 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.6 MiB |
@ -1,141 +1,13 @@
|
||||
---
|
||||
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"
|
||||
---
|
||||
+++
|
||||
draft = true
|
||||
categories = []
|
||||
title = ""
|
||||
displayInMenu = false
|
||||
dropCap = true
|
||||
featuredImage = ""
|
||||
description = ""
|
||||
date = "2019-01-02T22:25:20Z"
|
||||
displayInList = true
|
||||
|
||||
# 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/
|
BIN
content/Articles/littleprynter/cover.jpg
Normal file
BIN
content/Articles/littleprynter/cover.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
Binary file not shown.
Before Width: | Height: | Size: 36 KiB |
@ -1,19 +1,17 @@
|
||||
---
|
||||
categories : ["English","Hacking","Printing","Art"]
|
||||
categories : ["English"]
|
||||
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
|
||||
date : "2022-07-24"
|
||||
draft : true
|
||||
displayInList : true
|
||||
resources:
|
||||
- name: featuredImage
|
||||
src: "cover.png"
|
||||
src: "cover.jpg"
|
||||
---
|
||||
|
||||
### 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.
|
||||
@ -24,9 +22,7 @@ A more personnal quarrel I have with designers is perfectly represented in the L
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
@ -40,9 +36,7 @@ Thankfully, Adafruit has tutorial on how to build a polaroïd camera with a ther
|
||||
|
||||
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 eventually setteld 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€.
|
||||
|
||||
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.
|
||||
|
||||
@ -50,72 +44,7 @@ After a few days of hacking, I finally had a complete photomaton that could be a
|
||||
|
||||
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.
|
||||
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).
|
Binary file not shown.
Before Width: | Height: | Size: 104 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.2 MiB |
5
content/Stories/solarpunk/Solarpunk.md
Normal file
5
content/Stories/solarpunk/Solarpunk.md
Normal file
@ -0,0 +1,5 @@
|
||||
# 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.
|
@ -1,20 +1,13 @@
|
||||
---
|
||||
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"
|
||||
---
|
||||
+++
|
||||
draft = true
|
||||
categories = []
|
||||
title = ""
|
||||
displayInMenu = false
|
||||
dropCap = true
|
||||
featuredImage = ""
|
||||
description = ""
|
||||
date = "2019-01-02T22:25:20Z"
|
||||
displayInList = true
|
||||
|
||||
+++
|
||||
|
||||
# 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.
|
||||
|
Loading…
Reference in New Issue
Block a user