Week01. Principles and Practices, Project Management

I have two tasks this week:
1. build a website, on which I can record my journey. (Yes, this is the one you are reading now.)
2. sketch a potential final project

Website

FabAcademy faculty had already initialized the website git repository and the CI/CD configuration file for me, so I only need to setup the development environment on my laptop.

Git clone the repository, modify something, commit the change and push back to server. This will trigger the CI/CD process, and my website will get updated. I guess using gitlab’s Web IDE also works, but it’s too inconvenient. I decided to use WSL and VSCode on my Windows Surface Pro laptop.

1. Install WSL.

Follow these stpes to install WSL(Windows Subsystem for Linux). I choose Ubuntu distribution.

WSL and Windows can visit each other’s file system.
I created a shortcut for the WSL folder and put it on desktop.

I use the command to add shorlink of my Windows’ fablab folder as well, so I can use it in WSL easily:
ln -s /mnt/c/Users/Elfe1/Documents/FABAcademy /home/elfe/fab

2. Setup SSH-KEY for Gitlab

The instructions are very clear and the steps seemed to be very easy:

  1. generate the key using: ssh-keygen -t ed25519 -C "email@example.com"
  2. Copy the content in generated .pub key file to gitlab settings
  3. test ssh using: ssh -T git@gitlab.fabcloud.org
  4. git clone my repository: git clone git@gitlab.fabcloud.org:academany/fabacademy/2020/labs/oshanghai/students/yanfei-xu.git

However, it took me quite a while to make the ssh key work for gitlab. A few tips below:

Problem1: cannot access the generated key
Seems there is something wrong with the built-in .ssh folder. SSH-GEN tells the key was generated, but there is no way to access the file, either by WSL or Windows FileExploere. Someone reported the similar issue on StackOverflow.
Solution: Delete the .ssh folder and create manually again.

Problem2: ssh “permissions are too open” error
I got a permission error in stpe 3.

Solution: I followed this post, use “chmod 700” to change the key’s permission.

Problem3: another permission denied error
Then I got a new permission error in step 3:

Solution: It turned out that the key’s filename must be id_rsa or id_ed25519. After changing filename back to id_ed25519, everything works fine, and finally I got the welcome message:

Problem4: need to enter passphrase all the time
I’m asked to enter the passphrase every time when I do git push/pull. I tried edit the .ssh config file, but it does not help. Then I tried eval $(ssh-agent -s) and ssd-add the key. It works fine for the terminal session, but once I closed the terminal, next time I need to input the passphrase again.

Solution: Since this is only a static website with low impact, I run ssh-keygen -p to remove the passphrase. Now everything works fine.

update VSCode

I have VSCode installed on my laptop before. When I started it, it reminds me to install a WSL extension. I installed it, and then started a remote window by WSL. (Click 1 then click 2 as the image show below:)

Now I’m running VSCode in WSL-Ubuntu, so it’s integrated with git already. The changes are highlighted and I can stage/commit/push them easily.

Modify the theme

We are using MkDocs for the website. I found some themes, but seems only the Material Theme is friendly to mobile devices. So I use this theme, changed the color, added some extension feature such as search and disqus. However, I’m unable to use disqus.

Seems it’s because corss domain issues. Not sure if Fab Academy can allow us to add the disqus domain into trusted domain list.

Sketch of my final project

I would like to build a PUT-OFF-YOUR-PHONE lamp. I’m still thinking for a better name.

Lots of people are addicted to smartphone nowadays. They might go to sleep at 11pm, keep swiping the phone for hours and just cann’t put it down until 2am. The lamp is designed to save them.

The key function of the lamp is:
1. 23pm, the alarm clock reminds you it’s time for bed. It keeps ringing until you put your phone into the slot.
2. As soon as you put your phone into the slot, the alarm stops, the lights turns off slowly, and it plays a soft music to help you fall asleep.
3. DUring the night, if you take your phone out of the slot, the buzzer will scream and the lamp will be turnned on again, with red alarm color. It won’t be a happy experience, so you will avoid to take your phone.
4. In the morning, 6am for example, the alarm clock will wake you up. Your phone is fully charged, and you can take it out of the slot safely.

The technical detail is not decided yet. I might use a lever as the switch, but a spring might also work.
I had thought of making a Rube Goldberg Machine, which changes the switches’s positions, hence there will be different effects when taking off the phone in midnight or in the morning. But machine might be too complex, so I might use programming for this feature.

My daughter helped me design the lamp:

The lamp looks like a stage. In the daytime there is a sun, and in the night a motor will change the scene by a moon.
There are two buildings and between them is the slot for smartphone.
The light gets out from the windows. It would be warm yellow before 11pm, but it will be as red as a fire alarm in midnight, if you take off the phone.
If you take off the phone, the dianosour will roar angrily, and the red ribbon in its mouth will flutter like a fire.

Well, this is my daughter’s vivid imagination. Hope I can make it.

A rough plan for the final project

I checked the schedule, and categorized them into 3 categories:
Yellow: software related
Green: hardware/electronics related
* Blue: outlook and mechanical related

I’m good at the yellow part. The 2019-nCord disease might cause us unable to go to lab and practice the blue part. So I will start from the green part.

There are three key questions about the green part:
1. how to create my own board to control light/fan/motor/buzzer rather than using a *-ino board?
2. how to make a electronic timer?
3. how to make a phone battery charger, which can tell if it is charging or not? (The charger should be very stable as I don’t want to ruin my phone).

After figure out these questions, I will do the detail outlook and mechanical design.

The timeline will be:
Green part: by end of March.
Blue part: by mid of May.
* Yellow part: by early of June.

Come on! A-ZA-A-ZA fighting…