Skip to content

Commit

Permalink
Initial commit, with a blog post
Browse files Browse the repository at this point in the history
  • Loading branch information
jwanglof committed Mar 5, 2016
1 parent 94ef006 commit 269bb58
Show file tree
Hide file tree
Showing 21 changed files with 862 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
_site
.sass-cache
.jekyll-metadata
.idea
19 changes: 19 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Welcome to Jekyll!
#
# This config file is meant for settings that affect your whole blog, values
# which you are expected to set up once and rarely need to edit after that.
# For technical reasons, this file is *NOT* reloaded automatically when you use
# 'jekyll serve'. If you change this file, please restart the server process.

# Site settings
title: Johan Wänglöf's blog
email: jwanglof@gmail.com
description: > # this means to ignore newlines until "baseurl:"
Johan Wänglöf's blog about a bunch of technical stuff that he's learning, or just wants to share
baseurl: "" # the subpath of your site, e.g. /blog
url: "https://jwanglof.github.io" # the base hostname & protocol for your site
twitter_username: jwanglof
github_username: jwanglof

# Build settings
markdown: kramdown
38 changes: 38 additions & 0 deletions _includes/footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<footer class="site-footer">

<div class="wrapper">

<h2 class="footer-heading">{{ site.title }}</h2>

<div class="footer-col-wrapper">
<div class="footer-col footer-col-1">
<ul class="contact-list">
<li>{{ site.title }}</li>
<li><a href="mailto:{{ site.email }}">{{ site.email }}</a></li>
</ul>
</div>

<div class="footer-col footer-col-2">
<ul class="social-media-list">
{% if site.github_username %}
<li>
{% include icon-github.html username=site.github_username %}
</li>
{% endif %}

{% if site.twitter_username %}
<li>
{% include icon-twitter.html username=site.twitter_username %}
</li>
{% endif %}
</ul>
</div>

<div class="footer-col footer-col-3">
<p>{{ site.description }}</p>
</div>
</div>

</div>

</footer>
12 changes: 12 additions & 0 deletions _includes/head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>{% if page.title %}{{ page.title | escape }}{% else %}{{ site.title | escape }}{% endif %}</title>
<meta name="description" content="{% if page.excerpt %}{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}{% else %}{{ site.description }}{% endif %}">

<link rel="stylesheet" href="{{ "/css/main.css" | prepend: site.baseurl }}">
<link rel="canonical" href="{{ page.url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}">
<link rel="alternate" type="application/rss+xml" title="{{ site.title }}" href="{{ "/feed.xml" | prepend: site.baseurl | prepend: site.url }}">
</head>
27 changes: 27 additions & 0 deletions _includes/header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<header class="site-header">

<div class="wrapper">

<a class="site-title" href="{{ site.baseurl }}/">{{ site.title }}</a>

<nav class="site-nav">
<a href="#" class="menu-icon">
<svg viewBox="0 0 18 15">
<path fill="#424242" d="M18,1.484c0,0.82-0.665,1.484-1.484,1.484H1.484C0.665,2.969,0,2.304,0,1.484l0,0C0,0.665,0.665,0,1.484,0 h15.031C17.335,0,18,0.665,18,1.484L18,1.484z"/>
<path fill="#424242" d="M18,7.516C18,8.335,17.335,9,16.516,9H1.484C0.665,9,0,8.335,0,7.516l0,0c0-0.82,0.665-1.484,1.484-1.484 h15.031C17.335,6.031,18,6.696,18,7.516L18,7.516z"/>
<path fill="#424242" d="M18,13.516C18,14.335,17.335,15,16.516,15H1.484C0.665,15,0,14.335,0,13.516l0,0 c0-0.82,0.665-1.484,1.484-1.484h15.031C17.335,12.031,18,12.696,18,13.516L18,13.516z"/>
</svg>
</a>

<div class="trigger">
{% for my_page in site.pages %}
{% if my_page.title %}
<a class="page-link" href="{{ my_page.url | prepend: site.baseurl }}">{{ my_page.title }}</a>
{% endif %}
{% endfor %}
</div>
</nav>

</div>

</header>
1 change: 1 addition & 0 deletions _includes/icon-github.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<a href="https://github.com/{{ include.username }}"><span class="icon icon--github">{% include icon-github.svg %}</span><span class="username">{{ include.username }}</span></a>
1 change: 1 addition & 0 deletions _includes/icon-github.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions _includes/icon-twitter.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<a href="https://twitter.com/{{ include.username }}"><span class="icon icon--twitter">{% include icon-twitter.svg %}</span><span class="username">{{ include.username }}</span></a>
1 change: 1 addition & 0 deletions _includes/icon-twitter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>

{% include head.html %}

<body>

{% include header.html %}

<div class="page-content">
<div class="wrapper">
{{ content }}
</div>
</div>

{% include footer.html %}

</body>

</html>
14 changes: 14 additions & 0 deletions _layouts/page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
layout: default
---
<article class="post">

<header class="post-header">
<h1 class="post-title">{{ page.title }}</h1>
</header>

<div class="post-content">
{{ content }}
</div>

</article>
15 changes: 15 additions & 0 deletions _layouts/post.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
layout: default
---
<article class="post" itemscope itemtype="http://schema.org/BlogPosting">

<header class="post-header">
<h1 class="post-title" itemprop="name headline">{{ page.title }}</h1>
<p class="post-meta"><time datetime="{{ page.date | date_to_xmlschema }}" itemprop="datePublished">{{ page.date | date: "%b %-d, %Y" }}</time>{% if page.author %} • <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">{{ page.author }}</span></span>{% endif %}</p>
</header>

<div class="post-content" itemprop="articleBody">
{{ content }}
</div>

</article>
44 changes: 44 additions & 0 deletions _posts/2016-03-05-intel-galileo.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
layout: post
title: "My initial hassle with the Intel Galileo Gen 2!"
date: 2016-03-05 18:55:00 +0100
categories: hardware galileo
---

So first things first, this Intel Galileo-board is my first experience with this kind of hardware (Arduino-like that is). I've had some courses in school where we played a bit with hardware but nothing major. That being said, I have experience with computer-hardware just not as low-level as this is.

The reason I got it is because I was chosen in a competition from SweClockers ([Bygg Galileo – tävla och vinn Intels stora prispaket på Dustin Expo 2016][swec-competition], it's in Swedish). The price was an Intel Galileo Gen 2 and the [Grove starter kit plus – Intel IoT Edition for Intel Galileo Gen 2 and Edison][seed-starter] from SeeedStudio. The competition was to explain what I would build if I got an "Intel Galileo Grove Starter Kit Plus", and this is what I sent to them:

> Jag skulle bygga ett automatiskt bevattningssystem som jag kan ha i ett växthus, oavsett storlek. Bevattningssystemet skulle ha integrerade sensorer som kollar olika data (jordfuktighet, temperatur i växthuset kontra tempteraturen i växten etc) från de olika växterna mot en databas för att veta hur växten ska bevattnas för optimal växt. Databasen skulle innehålla olika växter med växternas optimala data. M.h.a sensorerna och databasen skulle varje planta ha en egen bevattningsslang som sätts på och knäpps av automatiskt av en Intel Galileo Grove. Detta system skulle även spara den datan den får från växterna så man kan plotta ut grafer för att se hur växterna mår, detta för att uppnå optimal växtlighet.
In english:

> I would build an irrigation system that I can have in a greenhouse, regardless of size. The irrigation system should have integrated sensors which check various data (soil moisture, temperature in the greenhouse versus the plants temperature, etc.) from different plants against a database to know how the plant should be watered for optimal growth. The database would contain different plants with the plants' optimum data. With the help of the sensors sensors and the database, each plant would having its own irrigation hose that is turned on and closes automatically by an Intel Galileo Grove. This system would also save the data it receives from the plants so you can plot the graphs to see how the plants are doing, in order to achieve optimal plant growth.
This blog-post will show the issues I've had so far with the board, and my solutions. I've had a really hard time finding a good "how-to" guide for the Intel Galileo Gen 2 board and I thought that I would try to tackle this. Intel's "Getting Started"-guide is fairly good but I got stuck on the first (!!) step when trying to create a bootable SD-card so I could use NodeJS on the board (which is awesome, btw!). The first instruction is to download the OS for the board which links to this page: [Intel® Galileo Board Downloads page][intel-galileo-download]. I followed the steps but when I tried to write the image to my SD-card I got some corrupted folder-structure on it which couldn't be read when I mounted it. The board booted, but when connected to the board with the FTDI-cable that is included in the starter kit I could partially see the boot-sequence, and partially just gibberish as you can see in the image: [boot-gibberish]

I struggled with this about a day, or two, before I got it working. I don't remember exactly what I did to get it working, and didn't write it down either because I was so pissed at that time. But instead of using Intel's link to the SD-image I used the link from [this][build-electronic-circuits] instead. This didn't work the first couple of times either though, but when I formatted the SD-card enough times (or whatever happened) it worked =P

To write the direct-image to the SD-card I used the same command as Intel's using: `sudo dd if=/path/to/iot-devkit-latest-mmcblkp0.direct of=/dev/mmcblk0 bs=3M conv=fsync`

So fiiiiiiinally I have the board up and running, playing around a bit in Intel XDK IoT Edition IDE and the samples they provide. Everything works as a charm, and now I feel pumped to get started to writing my automated irrigation system. I will build the system in NodeJS because I love it. I also wants to use ES6, and learning more about it since I haven't used all the new functionality yet. So I'm starting to write some code that will fetch the temperature since I can check on Intel's example for it ([Creating a temperature monitoring app using Intel® XDK IoT Edition][intel-galileo-temperature-example]) for help. When I uploaded the first lines of code I immediately hit a wall: The OS the board is using comes with Node version 0.10.38 which didn't seem to support ES6 instructions, even with the `--harmony`-flag...

So I decided to upgrade Node, which should be really easy since the Linux distribution comes with a package handler ([opkg][opkg]) but I tried to find how to find a repository that have different Node versions but couldn't find anything except this page from an [Intel Galileo book][intel-galileo-book], which has three options but as I stated before I couldn't find an updated Node in an existing repository so I went with option #2. This didn't go as smooth as it could either, of course..

My initial try with option #2 was to follow the steps in the book: Get the `tar.gz`-file, unpack it, and build it. My first try was to fetch the file to /tmp and unpack it there, but there wasn't enough room on the filesystem since the image-file created two partitions which was just the size it needed to be. So I decided I would add another partition on the SD-card where I could put large files if I needed to. I tried to do this directly on the board (with `fdisk` and `mkfs.ext3`) but it didn't take for some reason. Didn't try to solve it, but instead I just turned off the board, inserted the SD-card into my computer and ran GParted to create an additional partition that was the rest of the SD-card's space. After that I unmounted the SD-card from my computer, inserted it into the board and booted it, when the boot sequence was done I just mounted the new partition to `/mnt/storage`. Now I though I would just re-do the steps from the [guide][intel-galileo-book], so I fetched the `tar.gz`-file again and tried to unpack it but I got the same error as before. Instead of trying to find a solution I just re-did the last SD-card-procedure: removed it, inserted it into my computer, unpacked the `tar.gz`-file, unmounted, inserted and booted the board and voila, I had the unpacked Node on the board.

Now the only thing left to do was to build the damn thing, and let me tell you that it takes a long time to build Node on a single-core that runs at 400MHz... A bit of advice: run the commands with a one-liner: `./configure; make; make install`, then you can just leave it over night and hopefully it will be done in the morning..


<!-- Links -->
[build-electronic-circuits]: http://www.build-electronic-circuits.com/intel-galileo-boot-sd-card/
[intel-galileo-book]: https://books.google.se/books?id=xVAnCgAAQBAJ&pg=PA466&lpg=PA466&dq=yocto+opkg+nodejs&source=bl&ots=bdk3McXNvU&sig=fE9tPVVQYMiUOQiSLFtPEiRaSWI&hl=en&sa=X&ved=0ahUKEwiw6v7E-anLAhVtSZoKHeeWB8cQ6AEINjAD#v=onepage&q=yocto%20opkg%20nodejs&f=false
[intel-galileo-download]: https://software.intel.com/en-us/iot/hardware/galileo/downloads
[intel-galileo-temperature-example]: https://software.intel.com/en-us/creating-a-temperature-monitoring-app-using-intel-xdk-iot-edition
[opkg]: http://git.yoctoproject.org/cgit/cgit.cgi/opkg/
[seed-starter]: http://www.seeedstudio.com/depot/Grove-starter-kit-plus-Intel-IoT-Edition-for-Intel-Galileo-Gen-2-and-Edison-p-1978.html
[swec-competition]: http://www.sweclockers.com/artikel/21803-bygg-galileo-tavla-och-vinn-intels-stora-prispaket-pa-dustin-expo-2016

<!-- Images -->
[boot-gibberish]: boot-gibberish.png
{: height="50px" width="50px"}
25 changes: 25 additions & 0 deletions _posts/2016-03-05-welcome-to-jekyll.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
layout: post
title: "Welcome to Jekyll!"
date: 2016-03-05 18:44:14 +0100
categories: jekyll update
---
You’ll find this post in your `_posts` directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run `jekyll serve`, which launches a web server and auto-regenerates your site when a file is updated.

To add new posts, simply add a file in the `_posts` directory that follows the convention `YYYY-MM-DD-name-of-post.ext` and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works.

Jekyll also offers powerful support for code snippets:

{% highlight ruby %}
def print_hi(name)
puts "Hi, #{name}"
end
print_hi('Tom')
#=> prints 'Hi, Tom' to STDOUT.
{% endhighlight %}

Check out the [Jekyll docs][jekyll-docs] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll’s GitHub repo][jekyll-gh]. If you have questions, you can ask them on [Jekyll Talk][jekyll-talk].

[jekyll-docs]: http://jekyllrb.com/docs/home
[jekyll-gh]: https://github.com/jekyll/jekyll
[jekyll-talk]: https://talk.jekyllrb.com/
Loading

0 comments on commit 269bb58

Please sign in to comment.