Thursday, May 12, 2016

How to switch a custom Blogger domain from http to https

Google recently upgraded all blogspot domains to HTTPS which means that <your-blog> is now automatically redirected to https://<your-blog> This is a neat feature considering the security aspects, the only problem is that for custom domain names, this 'free upgrade' from Google is not available. More precisely, if you had bought a custom domain name and pointed that to <your-blog>, the automatic https redirect will not work.

To work around this, CloudFlare comes to the rescue. CloudFlare acts as a reverse proxy between your visitors and your website which means that an encrypted channel can now be established between the visitor and ClourFlare's servers delivering your content. The only change required to do this is to create a free account with CloudFlare and change your domain's DNS entries to point to CloudFlare nameservers.

So, in order to move your custom Blogger domain to https you will need to do the following steps:

  1. Create a new free account with CloudFlare (all free plans include SSL support)
  2. Add your domain by clicking 'Add site' and following the steps
  3. Contact your domain registrar (or use the provided admin console) to update the name servers entries for your domain. This might look like an advanced operation but is really quite simple. The purpose of this operation is to change the NS (name server) URL entries to point to CloudFlare's servers. The exact URLs for the new name servers will be shown in the CloudFlare's instructions for this step. In my case they were: and Once you do this, you can click 'Recheck nameservers' in the CloudFlare's site page and an email will be sent to you once the nameserver changes are propagated. This operation requires around 24h though in my case it took only a few hours. When everything is ready you will see that your site will be seen as 'Active'.
  4. Add rules for redirecting http requests to https. This step is only required if you want your users to be redirected automatically to the https version of your site if they requested the http one. To do this, you need to go into CloudFlare, on your domain's page, then Page Rules -> Create Page Rule. From there, enter your domain as shown in the example and make sure you add the setting for 'Always use HTTP'. Do the same if you have sub-domains active.
That's it. You are good to go. 

Wednesday, March 18, 2015

Raspberry Pi controlled RC car

This blog post will lead you through the process of building a remote controlled toy car which you will be able to operate from anywhere in the world without being restricted to being on the same wireless network as the RC car. The initial idea was to build a video spy toy car which I could operate from my phone and see where it's going but after researching the video streaming options I decided to postpone this feature at least until some improvements will be made in the WebRTC stack for the Raspberry Pi. So what this post will show you is how to control an RC car from any web browser.

What you will need for this project:

  • Raspberry Pi (I used model B+)
  • RC toy car
  • 5V battery pack (I have a 10400mAh ADATA Power Bank)
  • Pololu DRV8835 2 channel motor driver
  • 3G or WiFi dongle (installation guides for both are available online)
  • Free account on This is a backend API service which allows sending events to Internet connected devices through WebSockets. For this application it’s the essential point in making the toy car work from anywhere in the world not just the local Wifi network. will be the middleware which will send the control messages triggered by the user interface to the Raspberry Pi which in turn will control the car. 
    • After you create your account, proceed to creating a new app. What you need are the App Credentials which are shown on the right side of that page (more precisely: app_id, key and secret)
  • Free account on Google Apps. By using Google's App Engine you will be able to host the web interface that will control the car from a <your_app_name> web address. Besides that it will also allow you to authenticate the communication channel that sends the messages to the RC car.

Step 1: Wiring the toy car

This is very specific to the toy car I've used but it will give you an idea of what to look for at your toy car. Below you can see my car's controller board being powered by the RX-2B chip which is specifically designed for remote controlled car applications and quite common. Therefore, the schematics for it are available on the web.

What you need to do is to identify the exact pins and connect wires to each of the 4 directions you want to control (the interest pins are 6, 7, 10 and 11).

Notice on the backside of the board the green, yellow, white and grey wires being connected to the direction pins on the RX-2B chip. Once you have them soldered in you will need to setup the Pololu motor driver. 
 I decided to use a motor driver instead of connecting these wires directly to the GPIOs because I was afraid I was going to fry the RPi. That is because from the GPIO pins you can draw a maximum current of 16mA. Through the driver motor board the maximum current is 1.2 Amps.

The basic schematics of the Pololu DRV8835 motor driver board looks like this:

Notice the inputs on the left side (from the RPi’s GPIOs in our case) and the outputs on the right (the wires connected earlier that go to the RX-2B chip).

I used the Pololu DRV8835 Dual Motor Driver Kit for Raspberry Pi B+ which made installation a lot easier because it connects directly to the GPIO header. The board contained in the kit is laid out like this:

You can see below the other ends of the direction wires being connected to the output pins on the motor driver. The red and black wires are VIN and GROUND which were also connected to the toy car’s board to power the motor driver’s output. Take note that the Pololu motor driver is by default in PWM mode which means that one GPIO pin dictates the speed and another direction. For my configuration, PWM was not something I wanted so I disabled it by connecting the MODE pin on the Pololu board to ground. 


Step 2: Running the software

There are three major software components involved in this project. First, there is the Python code that runs on the Raspberry Pi which converts the control messages the user sends in logical signals for the GPIO pins. Secondly, there is the JavaScript web interface hosted online which provides the user interface for controlling the car and lastly there is a Google App Engine app that authenticates the communication channel used for sending the control messages.

All the software bits can be found on the project's Github page which you will need to clone on your computer by running:

$ git clone

You can see that the repository contains two folders: pi and siteFirst, copy the pi folder on the Raspberry Pi then go to Pololu's Github page and follow the instructions for installing the motor driver dependency library.

Once you have the dependency library installed, go to the pi folder and run:

$ sudo python
This command will start the script that waits for messages from the user interface.

Next, use the site folder as your App Engine application. In order to deploy the app you need to install Google App Launcher on your computer and use the contents of the site folder as the code for your application. Using the Google App Engine Launcher go to File > Add Existing Application and select the site folder. Make sure that you change the application’s name in app.yaml under the ‘application’ section. After that, click Deploy. You should now be able to see the UI running at <your_application_name>


Finally, by dragging the black arrow you should have the RC car moving like in the video below:

Sunday, December 7, 2014

How to replace a broken screen on the Oppo Find 5

thumbI managed to drop my phone by accidentally pushing it out of my jacket's pocket and even if I had it in the 'Easy Cover' thingy from Oppo, the damn thing opened up on it's way to the ground leaving the screen completely exposed. The result can be seen on the right.

I did some research on the Oppo forums and here are the options for getting the phone fixed:

  1. Send it to OppoStyle (if you bought the phone from them) and have the screen replaced for 160EUR. This means you will need to send it by courier and wait for about a month to get it back.
  2. A better option involving OppoStyle is to ask for a buy-back which means you can trade your phone plus a cash difference for a new Oppo Find 7 or similiar (Find5's are not produced anymore so you cannot get a new one this way). At the time of this article, OppoStyle had the following deal: the broken phone + 160EUR (the repair) + 199EUR (cash difference) for a new Oppo Find 7 which costs around 480EUR. This means your broken phone would be worth around 120EUR. (Note: You can get the same deal for a Find 7a by paying a 99EUR cash difference)
  3. Buy the screen online and replace it yourself. There are lots of replacement screens available on ebay, all coming from China, but beware that the quality may vary dramatically - some screens are 1024x600 resolution which is far from the original 1920x1080, so make sure you ask the seller what resolution is the screen before buying. I bought mine from here and even though the seller was top notch, the screen is far from perfect. I'll show you why later on.

If you decide to replace the screen yourself, I highly recommend checking this video:

Before starting this operation, have the right tools for the job. I got mine with the replacement screen but not all sellers send them out.

Also, make sure you stick enough double sided tape in the lower part of the screen because I didn't and it kinda sticks out just a little as you can see from this picture.

As I mentioned earlier in this article, the screen is far from perfect, more precisely it has dead-like pixels in a matrix formation on the whole surface of the screen.  I had to modify the brightness and contract of the image in order to make them stand out, but you get the idea. They are quite unnoticeable on white backgrounds and in colored ones you cannot spot them at all. I cannot say they are dead pixels because as I remember that those stick out with any color on the screen. Well, I guess there is a small price to pay for getting the job done with only 40 EUR.

If you have any question, feel free to drop them in the comments below.

Saturday, October 25, 2014

Ladyfingers cake

My fitness version of the Ladyfingers cake. Replaced the mascarpone with Greek yogurt, decreased the sugary stuff and replaced it with honey.
Below you can find the original version of this recipe:

Sunday, March 23, 2014

How to change the brake pads on a Mazda MX5 (NC)

Though it might sound dramatic, changing the brake pads by yourself is quite easy and risk free. As long as you tighten back the screws you untightened and don't end up with 'spare' parts, you are good to go. There is only one trick at the rear brake pads but if you read this blog post you shouldn't have any issues.


Front brake pad

Changing the front brake pads is straightforward. 

Remove the two screws on the exterior side of the caliper - the screw heads are facing the engine and you might need to use a second wrench to hold the pin from rotating while you are unscrewing the bolt.

If you cannot figure out which screws to undo, maybe you should let a professional handle this operation.

Pull out the caliper - after removing the screws, you should be able to pull out the caliper with your hands. If you cannot do that, use a screwdriver to force it out. Pay attention not to yank the brake hoses after you set if free - place the caliper somewhere safe so it will not hang. After pulling it out, you will see that besides the brake pads, there are also two shims - don't throw those away as they are not usually supplied with the replacement kit.

The two brake pads and shims are identical so you don't need to worry from which side you pulled them from. I noticed though, that the left inside pad had a clip on the upper side, probably the ware indicator - I made sure I put the clip back on the new pad and in the same position.

Put the new brake pads in and the caliper - put back the brake pads and shims making sure you do not grease any of them (you can apply some copper grease on the brake piston where it touches the shim). As the new brake pads are considerably thicker that the old ones, the caliper will not fit that is why you will need to use a C clamp to push it back a few mm. While doing this, you should also remove the master cylinder cap in case the brake fluid level will rise.


Rear brake pads
The only difference in the rear is that the brake piston will not move when you try to use the C clamp on it. That is because of the mechanics of the emergency brake. 

Rear brake caliper piston

In order to push the piston in, you need to screw it using the cross it has engraved on it. If you don't have the special tool for this, you could try using a normal screwdriver on it's side or better still, I used the tire and jack lever which comes with the car. If you get creative, you will see that the sharp end of the lever can be used very efficiently to rotate the piston (again, on it's side, not perpendicular on the piston). After you rotated the piston enough, the caliper should fit back in and you can put everything back together. Pay attention to align the cross on the piston with the notch on the brake pad shim. 

That is all. Don't forget to take the car on a test around the block and make sure everything is good to go and road safe. The brake pads require break-in so they will not feel very strong initially. 

Good luck!

How to add MP3 support to your Mazda MX5

It's quite strange how Mazda finds it appropriate to equip it's MX5 models with 7-speaker sound systems that can only play the radio. My unit's fascia features the MP3 logo but to my disappointment I found out that the logo is present on all models even though the unit doesn't support MP3 - it's put there just to save you the trouble of buying a new fascia in case you would upgrade the unit and wanted to reflect the change.

MP3 logo but no MP3 support
As I mentioned, there are OEM head units that you can buy to handle MP3 discs and also there is the option for the CD changer you can put in the trunk - if this were 2004 then all these would have been viable options. Fast forward 10 years and you would want to connect your iPod or USB drive to your sound system. For this, I found a pretty nice device that connects to your CD-changer interface connector and acts as one but instead of playing from the CDs, it plays from you iPod or USB drive. The device I am talking about is the Audio-Link for iPod and if you don't have an iDevice then you can buy the Audio-Link with USB and Line-in

The installation of this device is a little complicated as you need to reach the back of the head unit to plug the device into the CD-changer connector. There are two ways to do that. I, for instance, managed to cram myself with my head on the pedals and squeezed my hand through the spider net of cables behind the dashboard and reached that connector - it was painful but it's doable. If you can't do that, then you will need to remove the head unit and the plastics around it. The process is explained in detail here.

I placed my device in the glove box because I sometimes have to pull the USB drive out to update my tunes, but if you use the iPod version, then you can hide the device somewhere under the dash and let only the iPod wire out. Mine looks like this:

The best part of having such a device is that you can control it from the steering wheel controls as it acts exactly like the CD-changer so it feels integrated with the car. Needless to say, the quality of the audio is crystal clear.

Saturday, March 22, 2014

DSC light always on after battery was removed

Some time ago the battery on my 06' Mazda MX5 died and I had to replace it. After I installed the new one, I noticed that the light for the DSC was always on and I became a little worried as from what I remembered it could have indicated a failure in the braking system. I searched the Internet long and hard and the solution came from a "no-name" forum on a far away page of a Google search.
The ESP light was ON even when the engine was running
It seems that when you take the power down, the computer needs to recalibrate the DSC and signals this by leaving the light always on. To calibrate it you need to do the following: while the engine is running and the car is stationary, do a full steering wheel turn to the right and then to the left. After you stop the car and start it back up again, the DSC light should disappear.

As I don't use my car in the winter time and I remove the battery throughout the winter, I am faced with this issue each year and it always works, so if it doesn't for you, then maybe it's better you see a professional.

I hope this blog post saves you the trouble I went through when I first had this issue.

P.S. It might be the case that the DSC OFF light stays on also. In this case you will need to put in reverse and restart.