Google App Engine – running on a remote linux box (VPS)

So, you’ve been working on a Google App Engine project on your VPS and for some reason, when you type the following command:

dev_appserver.py <projectfolder>

it works, but when you try to access it in your browser from the client machine (your personal PC or laptop from where you’ve ssh’d into), it doesn’t work or gives you a “Connection Timed Out” error.

There are 2 things you need to check when this happens:

  1. IPTables – check whether you’ve opened up the port on which the local app server is working on
  2. App Server host name and port settings

For IPTables, you just need to make sure the correct rules are set. Since my app server will be running on port 8080, I had to check to see if that port was open or not. The ports can be checked with the following command:

 sudo iptables -nvL –line-numbers

If you don’t see port 8080 opened on the INPUT list, you’ll need to open it.

IPTables works from top to bottom. So, usually, the last entry is to reject everything that doesn’t fit. So, you might need to add the rule in between and for this we use the -I argument. For example, if I want to make this rule the 4th entry in my INPUT list (I have 5 rules), this can be done with the following command:

sudo iptables -I INPUT 4 -p tcp –dport 8080 -j ACCEPT

This should fix the iptables part of things.

Next, we need to fix the app server host and port values. By default app engine server runs on localhost and port 8080. Let’s change that to work with the external IP address of the Linux box and fix it to port 8080:

dev_appserver.py <projectfolder> –host myserver.com –port 8080

And now, if you visit myserver.com, it should work!

KiCAD – Creating a custom component with the same name as an existing component

Short Answer – change the name to be unique!

Long Answer – I was creating my own version of the 74HC595 shift register in KiCad and named it exactly that. When adding it to my own library, and using it in my schema, it kept showing me the stock version. So the fix to this was to right-click on the name in the component editor and change it to something else – “MY74HC595” and save. Hey presto! Problem solved :)

AVR Programmer pin configuration and AVRDude and Atmel Studio

Programmer Pin Diagram and Configuration

This post is more for me to remember and access easily in the future since I’ve spent a considerable amount of time doing this (for the second time!).

I have 2 AVR programmers and after a lot of trial and error, I realised that the pinout is different for each of them. Also, the datasheets for both the programmers are hopelessly unclear and show the pinout for the pins on the programmer. When you plug in a ribbon cable and turn it around to face you, the pin configuration becomes a mirror image and it’s quite taxing on the brain to correlate the pin config from the board to the cable. Hence the images below for reference!

Continue reading

OpenVPN on OpenVZ on a VPS – Internet routing

I wanted to route my internet through the VPS using my Windows 7 laptop. It took me more than a day to get this set up. So putting it down here as a reference for the future. My guess is that this is probably something that only a first-time user of VPS will encounter. The other times, you would have been forced to learn it and you don’t have to go through the difficulty again. Once you know how to do it, it will probably take you 20mins end to end.

But anyways, long story short, this is what you need to know:

  • OpenVPN configuration – I am not kidding, definitely go through this page. It will take around 20-30 mins, but that’s the best way to do it. Otherwise you’ll keep wondering whether the issue lies with OpenVPN or with something else
  • IPTables configuration – A good tutorial that will really get you started on the hows and whats. Read it carefully, you’ll need it.

Here’s how I did it. I’m setting up VPN to route my Internet traffic through the VPS server. We’ll break it down step by step.

Continue reading

Part 4 – Getting started with a 128×64 Graphics LCD Display – Pin configuration

In the previous part, we saw how to instruction set works and how the different pins fit together to make the GLCD work. In this part, we’ll pick a particular microcontroller and try to work out how to configure the pins.

The JHD12864E works in a parallel mode. By parallel, I mean that the data is passed in one shot which is by the data pins D0-D7 on the display. There are other GLCDs which pass data in serial i.e. one instruction at a time. In this case, we don’t need so many pins but there will be other considerations that we will need to … uh … consider.

Continue reading

Part 7 – Getting started with a 128×64 Graphics LCD Display – Porting an image to a 128×64 monochrome display

Now that you’ve got the GLCD up and running and probably tried a few things, you’d like to put a picture of your cat on the display and see if he/she can recognise it right? It’s okay, you can admit it, I’m not judging.

This can be broken down into 2 steps:

1. Convert an existing image into a 1-bit black or white bitmap (BMP) image

2. Convert the bitmap from the previous step into an array for use with your microcontroller

Step 1 – Convert an existing image into a 1-bit black or white bitmap (BMP) image

Continue reading

Part 3 – Getting started with a 128×64 Graphics LCD Display – Passing instructions

This part explains how to pass instructions/commands to the GLCD. On a high level, these are the steps:

  1. Select the GLCD half-section
  2. Put the Enable Pin LOW
  3. Put RS, RW and Data pins HIGH or LOW based on your command
  4. Put the Enable Pin HIGH
  5. Wait 2 milliseconds
  6. Put the Enable Pin LOW
  7. Wait 2 milliseconds
  8. GLCD responds

And you’re done! Easy-peasy!

Well, not quite. Let’s look into each of these steps in a little more detail. Here’s an image from the last part for quick reference:

Continue reading