Wednesday, 30 December 2020
Sunday, 27 December 2020
A rant about measuring CO2, temp and humidity with Arduino
Before Christmas, I had a look at a couple of CO2 sensors and was surprised to see how unnecessarily complex our life is made. At which point did someone decide that the best way to check the value is to do it through an app in your mobile and not through a simple screen on the device? Honestly, I was also quite surprised at the prices. 150 euros reduced from 210 euros? Electronic components are quite cheap, so either high quality sensors are very expensive or someone is making a lot of profit (or both). Maybe I could make one myself despite my very limited knowledge of electronics?
Anyway, since I already happen to have an arduino, a few Raspberry Pi´s and a Calliope Mini, I thought I may as well buy a few sensors and google my way through. The internet is full of successful examples so I thought it may be worth explaining where I struggled. Things never seem to be so straight forward for me. I remember watching one of the Star Wars films many years ago and how I smiled to myself when young Anakin built C-3PO as a pet project when he was ten years old. But then, he was a Jedi and I am not.
Jedi or not Jedi, I bought the following:
SSD1306 OLED mini screen => 6.50 euros
MQ135 gas sensor => 5 euros
DHT11 temp and humidity sensor => 4.50 euros
Except the MQ135, you can buy everything you need and a lot more for under 30 euros with a starter kit, with arduino breadboard, etc included.
I found this video, which seems to be what I wanted, except things are never so easy. After I did all the connections, installed the Arduino IDE, downloaded the Adafruit libraries mentioned in the video and typed the program I got a very blank screen. Not quite what I wanted but not totally unexpected either. Ok, so is it the sensor or the screen? Or both? The good news, time to go into a rabbit hole and learn about OLED´s, I2C addresses and more watching this great video from DroneBot Workshop.
Eventually I had a look at the webpage of the people selling the screen and noticed there was an Arduino library mentioned in the Downloads and Links section! I tried it and still got a blank screen. Looked like a dead end but I also noticed that there is a free ebook which comes with each component. I got the ebook and, surprise, surprise, they mention a different library, U8g2. Even with this one, I could not make it work with the template program provided. My screen is 128x64 but the way to instantiate the display provided in the book, U8G2_SSD1306_128X64_UNIVISION_F_HW_I2C, threw and error. However I managed to make it work using U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C (note the change from 128x64 to 128x32). That means I lose half the screen resolution, but since I only need to display three numbers, it is still ok.
At that point I could display some text, just not the values from the gas sensor. After a lot of looking around, I noticed that the connection to ground in the breadboard was in the wrong place. Once that was fixed, I got the CO2 reading! One small step in the right direction.
From the little I have learned so far, the sensor needs to be left connected for 24 hrs to burn in and then calibrated (read the actual value outside and adjust the reading to be the expected normal CO2 values of 350 to 450 ppm). The calibration can be done with quite some detail. Right now I get a reading of 250 to 300 ppm. Since the accuracy of this sensor is not that great, it is probably best to go for a traffic light rather than actual values. Good if below 400, amber if below 800 and red otherwise. Not yet implemented, but I happen to have the ideal traffic light module which came as part of this 35 in 1 kit. Otherwise, there is a great opportunity for more rabbit holes, here and here for a start.
Enough of the gas sensor, what about the temperature and humidity sensor? That should be a lot easier, plus I do know which values to expect. Well, it turns out nothing is easy and straight forward. The reading right now is that I am sitting at home at 13 °C and 146% humidity (!).
As by now was to be expected, there are differences between the connection instructions in the ebook and the datasheet, which actually mentions a pull-up resistor
Friday, 25 December 2020
Advent of Code 2020 (ii)
This year I managed to complete 43 of the 49 Advent of Code tasks (on Xmas day, i.e. today, you only get the 50th star if you have completed all previous 49 tasks). Really proud and happy that I participated every day for almost a full month because I have practised and learned a lot.
A few things that come to my mind:
- I finally felt compelled to set up WSL2 on my laptop, which involved tweaking something on the bios.
- I cloned and tweaked a framework to keep some order on the solutions.
- I used VS Code (instead of pycharm) and learned about passing arguments to the debugger.
- I published my code to github, struggling with git commands from time to time (is there anyone who doesn´t??)
- I googled my way through relative imports in python and vs code setup for projects, eventually dropping the framework in favour of a more simple solution.
- Library of the month: Collections, I made heavy use of defaultdict, used Counter a few times and thought it was a pity that deque is O(n) for searches and not O(1).
- Surprised I did not use pandas at all. Not surprised that I used networkx and numpy. I still need to get a hold on regular expressions though.
- Got reasonably good at parsing files, however a colleague has suggested that I have a look at lark parser
- Found out that sadly John Conway passed away this last April.
- Following another colleague´s advice, I borrowed Python Cookbook from our mini department library but only found time to go through first chapter.
- Chinese remainder theorem and Bézout's indentity
- Needless to say I went into several rabbit holes.
- Best rank position for Part 1: 1874 on Day 20, which ironically is one of the few days I didn´t manage to complete part 2.
- Best rank position for Part 2: 2912 on Day 21
- Quickest Part 1: 00:17:50 on Day 6 (but only rank ~6200)
- Quickest Part 2: 00:33:40 also on Day 6 (but only rank ~6000)
- Recurring issue: typing "for i in intVarName:" instead of "for i in range(intVarName)":
Friday, 11 December 2020
Advent of Code 2020
For the second year running, I am giving a try to Advent of Code. Last year I got 18 stars in the first 10 days. So far, so good as this year I am already at 22 in the first 11 days, but I assume this is where it will get more tricky and I will run out of time (and more likely brain power) to solve the daily puzzles.
This year I did not get to do much coding at work, so this is like an end of year private treat to myself. Advent of Code is a superb learning experience and even if I am far away from the real pros, I think about it in the same way I do about running from time to time.
The one other thing that dawned on me is that I probably approach reading other people´s code as other people may approach reading poetry or sheet music.
Friday, 20 November 2020
Sunday, 8 November 2020
Estar como una regadera
Yo quería hacer una foto del pajarillo que alegremente desordenaba el montoncito de hojas de nuestra terraza y, sin darme cuenta, he pillado a las regaderas dándose un beso.
Saturday, 7 November 2020
España vacía o la España vaciada
Suelo escuchar el podcast de la Cultureta, en el que suelen meterse con Sergio del Molino a cuenta de si se dice la España vacía o la España vaciada, aunque sospecho que en realidad es una forma de hacerle publicidad a su libro. En cualquier caso, entre esto y que esta semana llevo vistos tropecientos mil mapas de EEUU mientras acaban de contar los votos, he tenido la idea de hacer un mapa con las provincias de España coloreadas con su población hasta igualarlas (más o menos) con la de Madrid, que es la que tiene la mayor población de acuerdo con la Wikipedia. Hacerlo ha sido entretenido y, al revés de lo que suelo hacer, no ha requerido ni una sola línea de código. Hay veces que la opción low-tech es la mejor, por ejemplo coloreando este mapa que, eso sí, he encontrado mientras buscaba como hacer esto con python, que la cabra siempre tira al monte :-)
Sunday, 1 November 2020
Tuesday, 27 October 2020
Monday, 26 October 2020
Sunday, 25 October 2020
Saturday, 24 October 2020
Friday, 23 October 2020
Thursday, 22 October 2020
Friday, 16 October 2020
Thursday, 15 October 2020
Sunday, 20 September 2020
Desde mi jardín
Normalmente la etiqueta de cazadores cazados tiene otro significado, pero en este caso creo que es apropiado usarla.
Sunday, 9 August 2020
Saturday, 8 August 2020
Friday, 7 August 2020
WUGC Heilbronn 2000 - España
Thursday, 6 August 2020
Wednesday, 5 August 2020
World Ultimate Frisbee Championship - Heilbronn 2000 - Opening Ceremony and Team España
07. August 2000
Ultimate España
There is not a very long history of disc sports in Spain. Most Spaniards
think of a Frisbee as „that plastic thing you bring to the beach". When you
mention Ultimate as a sport, they say „Que?"
Though there are only about 70 ultimate players
currently playing in Spain, it seems that Spanish
Ultimate is finally getting off the ground. This is
the first year that a Spanish Team is competing at
a World level and players have come together
from Barcelona, Madrid, and Gran Canaria to
form the team.
The history of Spanish ultimate starts about 5
years ago when a group of people started playing
in Las Palmas de Gran Canaria, Canary Islands,
eventually taking the name of Pio Pio. Within 2
months they went to France to participate in the
European championships. But since then, only a
few players have been able to travel to tour-
naments - they are closer to Africa than they are
to mainland Spain. Still, over the years they've
continued to play with the spirit that typifies
Ultimate and have grown to approximately 15
players. They hosted their first beach hat
tournament in March 2000 which gave all the
Canary players a chance to play in a tournament
and left everybody else begging for it to be
repeated annually.
Independently, Barcelona's Patatas Bravas began
playing in the winter of 1998 when the Ultimate
gods conspired to bring several players together
who had all played in other places. After realizing
that nobody would get up before 1 pm on a week-
end, practices were moved to late afternoon and
Ultimate addicts were created. Since then,
the Patatas Bravas have participated in tour-
namets in Germany, France, Switzerland, Italy
and Portugal. The team currently has 25 players
and is comprised of "Catalan/Spanish and"
foreign players. I guess Ultimate is still a bit of a
beach thing in Spain because both Pio Pio and the
Bravas practice on the beach, bare foot, all the
time. The sun in Spain is great, but one of the
drawbacks is its effect on grass fields! The Bravas
also organize a beach hat tournament that was
first hosted in the fall of 1998 and has since
become the infamous last European Outdoor tour-
nament of the year. They're working on bringing in
more women and getting a juniors team started at
a local school to try to raise interest and ensure
that Ultimate will continue.
The internet age helped contribute to the for-
mation of Los Quijotes from Madrid. They began
playing in December of last year after several
requests came to the Bravas and Eurodisc mailing
lists requesting information about ultimate in
Madrid. With 6 names to start with, things
seemed to take off when Juan Carlos, a Madrileño
who learned to play ultimate while studying in
England, took charge of motivating and
organasing. They have not yet participated in any
tournaments and are still in the tenuous stages of
team creation since many members of the initial
group have moved out of Madrid, including Juan
Carlos. Hopefully things will keep moving and
we'll see more ultimate from them in the future.
Finally, and most recently, a team was started in
Tenerife, another of the Canary Islands. A lone
flying Italian initiated a university ultimate course
last spring in which a group of about 15 students
participated. The first real competition between
two Spanish teams has also evolved out of this
effort with the 2 Canary Island teams traveling to
play against each other a few times and a final
competition organized at the end of the course.
The University de La Laguna, where they also
have the luxury of grass fields, will offer a year-
long course again in the upcoming academic
year. It looks like a lot is happening quickly with
Ultimate in Tenerife!
The Spanish team at WUGC 2000 is comprised of
4 players from Gran Canaria, 1 player from
Madrid, and 14 players from Barcelona. With so
few players in the entire country, the selection
process essentially boiled down to those who
were interested, eligible, could afford it, and were
willing to commit to playing and having fun.
Maybe not the most stringent criteria, but hey, it's
a start! There are 3 women playing with the team
since there are not enough women (yet) to form a
mixed or women's team. Since this is the first time
Spain is participating, we really don't know what to
expect. Our main goal is to have as much fun as
possible and to play as hard as we can. Apart from
that, we want to find out what diving on the grass
is all about, see how fast we can run when not in
15 centimeters of sand, and see if it's possible to
avoid blisters with those cleats we're supposed to
wear. No matter what, we're all ready and really
excited to be here! Kaleen Moriarty, Team España
Tuesday, 4 August 2020
WUGC Heilbronn 2000 - T-shirt
Monday, 3 August 2020
World Ultimate Frisbee Championship - Heilbronn 2000 (ii)
Sunday, 2 August 2020
World Ultimate Frisbee Championship - Heilbronn 2000
Wednesday, 20 May 2020
Tuesday, 19 May 2020
Monday, 18 May 2020
Sunday, 17 May 2020
Saturday, 16 May 2020
Friday, 15 May 2020
Thursday, 14 May 2020
Wednesday, 13 May 2020
Portraits of a squirrel (iii & iv)
Tuesday, 12 May 2020
Monday, 11 May 2020
Sunday, 10 May 2020
Black cat
There was a squirrel on the tree next to our balcony and I believe this cat had something in mind. I haven´t seen the squirrel again, but as long as it stayed high up, it should be fine.
Regarding the photo, the cat was in the shade and from quite a distance, so I had to push it up a bit with my very old 400D (already antique?). I ended up with 1/100 with 176mm, f4.5 at ISO 200 to balance noise, sharpness using a hand held tele and a min amount of light which could be post processed. The result is somewhat noisy, but look at those eyes...
Saturday, 9 May 2020
Tuesday, 14 April 2020
Privacy-first explained with Calliopes
This was actually quite a bit of fun.
A few links that may be of interest:
- The comic is from Nicky Case
- DP-3T white paper and much more
- Two of the calliopes are actually on temporary loan to CoderDojo Dahlem from the great guys at Calliope Mini
- The code was done using TigerJython4Kids, check their great page!
Saturday, 11 April 2020
Serenity under the sun
We are playing a lot of badminton these days in the garden. And a lot of reading.
I didn't notice my daughter taking the photo while I was reading this book.
Sunday, 29 March 2020
#BeingPartoftheSolution 2
Additional comments after a couple weeks into remote schooling.
File sharing: I got familiar with nextcloud, which offers a great amount of functionality such as typical file sharing services like Google Drive and MS OneDrive. Whatever system you use, I would separate communication in two flows:
- One direction, from teacher to students (release tasks and announcements), i.e. a public folder, most likely with subfolders for each subject as per the picture above.
- Private comms between each student and the teacher. This requires a password protected folder for each student.
Students and parents use different email providers, a 5MB file may be a problem for some, a 10MB may be a problem for many, a 100MB video will probably not work with most. Just sync a local folder with a cloud one and store there whatever is required for the students to pick it up.
Videocommunications: In these two weeks I have tried zoom a lot, discord, Jitsi, whatsapp and heard about MS Teams and whereby.com Zoom has many pros but one big con, privacy issues.
I have the feeling that the others have shortcomings when it comes to getting other people join (think elderly people, as my parents) and whatsapp is easy but it limits participants to just 4 people, plus many teachers may not want to disclose their private phone number for obvious reasons.
I am not clear that video conferences are strictly required or that they would even work for most classrooms. To much hassle to set up and still difficult to extract value from time invested. Maybe best to record a video and follow up with one to one sessions as required?
Photo app: I know, not new item, but please, do yourself a favour and use MS Office Lens or equivalent. Why send 4 separate photos instead of a single pdf? Or spend time cropping and aligning photos?
Sunday, 15 March 2020
#BeingPartoftheSolution
https://www.linkedin.com/pulse/beingpartofthesolution-juan-carlos-cabrejas/
1-minute summary: if you are a tech savvy parent, reach out to your children´s school and enquire if they need support to work remotely. This is a great opportunity to improve the digital literacy and skills of students, teachers and parents. Things which are obvious to you may not be obvious to everyone. See below some of my ideas, which are easy to implement.
For the longer version, read on.
I am actually not sure how well prepared most schools are for remote learning. I wouldn't be surprised if some of them are lagging on this aspect relative to many companies. While a lot may depend on available infrastructure, typically people skills and attitudes have a much bigger impact. So I was thinking how I can be of help and decided to provide a few basic tips which may help smooth the next few weeks with some specific easily actionable items.
If you share this, depending on your digital skills or those of your network and the teachers in your area, you may find this article plain obvious. If that´s the case, you are a good candidate to offer help to others which need to work remotely and may need IT support.
Communication: a lot of remote communication takes place through email. My experience with schools is that typically someone takes the last message on a recent thread and replies to all with new information. If a mother (or more typically a father) is not included in the initial message, it is always difficult to bring them back into the list. Even if added, they cannot see previous conversations and others may reply to another thread starting the loop again of missed communication.
Recommendation: set up a distribution list for each class, for example with https://groups.google.com
Remote access: many teachers will have to work from home using a variety of personal computers with Windows, macOS and Linux. If something does not work out, it is typically difficult to troubleshoot remotely their issue unless you can see the screen and take control.
Recommendation: Identify a couple of tech savvy parents per class as extra IT support for teachers. Consider discussing with teachers installation of a remote desk solution, such as anydesk.com which offers a free option for private users.
Security: This is a great opportunity to discuss digital literacy with teachers, students and parents, so probably appropriate to raise awareness of some of the items discussed in https://ssd.eff.org/en in the next months.
Recommendation: As a minimum, everyone should install a password manager, such as KeePassXC which is open source, cross platform and actively being developed. Two factor authentication should be enabled in all services which allow it.
Photo app: some teachers may have printed material already available which they now need to distribute to students. Not all teachers will have scanners at home, and things like books require a long time to scan (if at all possible). Manually cropping and warping photos is time consuming. Reworking material into a digital format even more so.
Recommendation: Consider installing Microsoft Office Lens app on mobile phones. It automatically frames pages and warps resulting image to make it easier for distribution.