Custom Made Dakboard Alternative for Raspberry Pi — Part 1
Part 1 — Dropbox App Setup for Image Hosting
Part 2 — Dropbox HTTP Requests with Golang
Part 3 — Serving an Image Slideshow Web Page Using Go Templates
Part 4 — Custom Calendar for Custom Dakboard (coming soon)
So I’ve had a Raspberry Pi laying around for awhile that I wanted to put to some good use. I’ve seen various projects to utilize it for. But nothing seemed quite useful for my needs, except Dakboard. For those not familiar with Dakboard, it is
a gorgeous web interface that displays photographs, weather and other information (such as events from your calendar or Wunderlist to‑do list).
There were a few drawbacks to Dakboard however that I didn’t like. There is a free to use version, but to get all the features I would want, you have to pay — boo. I wanted to be able to swipe from screen to screen, but this isn’t possible since touchscreens aren’t supported. And finally, you can only customize it to those things that Dakboard supports. I wanted to be able to add something like a “bills tracker” to show what bills are due, what has been paid, monthly budgeting, etc etc. I even wanted to add voice capability utilizing the Alexa SDK. That way, I could simply speak to it in order to add items to my calendar, shopping list, to-do list, etc. So, when what you want isn’t available…build it yourself.
I’m choosing to build it initially using Golang. Since storage is an issue with the Raspberry pi, as well as compute power, I didn’t want to use something with a lot of bloat and overhead like Python. There is also going to be a lot of things happening in the back end that I want to be as efficient as possible. Since concurrency is a first class citizen in Golang, it is a compiled language, and, I want to utilize it in a large scale project since I've just started learning it, Golang seemed like the best choice.
First thing we need to tackle are the images. Since the raspberry pi uses micro SD, storing GBs of anything on it isn’t ideal. A work around for this is utilizing an image hosting site to store the images. From there, we can simply render them on a custom webpage using urls given by the hosting site. This way, no images are stored directly on the Pi, saving precious storage space.
My wife already stores our images on Dropbox, so I did a little research into using that as a hosting site. Fortunately Dropbox does have an API in place to interact with it programmatically. Unfortunately, there weren’t any good offical Golang SDKs. There was very good documentation however for making HTTP requests. But there are a few steps that must be done in order to utilize this.
The first thing we need to do is visit Dropbox’s developer site and register an app (This is under the assumption you have already created a Dropbox account)
Once there, we should see a create app button that we can select to begin
On the screen that follows, we are going to want to select “Dropbox API” since this app is just for our personal use. I then gave the App only “App folder” access. You can give your app “Full Dropbox” access if you so choose, but since I’m using it to simply host images and request image links, I don’t need my app to have CRUD capabilities. Finally, name your app and click “create app”.
In the screen that follows, you can add whatever meta information you want, but there is only one important thing we need.
Towards the bottom of the page, you will see a section that says “Generated access token”. Select the “Generate” button. This will create a token that we will need to create HTTP requests programatically using Golang. Save this token somewhere for later. We have now registered an app. There’s just one more thing we need to do.
Navigate to your Dropbox profile (main dropbox, not dropbox developer) and go to “my files”. You should now see a folder added called “Apps”.
Inside this folder you will see another folder named after your app you just created. Inside this folder, create another folder called “images”. This is where we will store all of our images we want our custom Dakboard to render.
That’s it! we have registered an app with Dropbox that we can now use to make HTTP requests. Start moving your images into this folder. Up next, we will see how we can render images on a custom webpage using Golang and Dropbox as an image hosting site.