PPTP Linux Client Problem

Hi all,

I know this is not related to anything in this blog, but I thought it’d be important to share the information.

So I created a PPTP VPN at my home after changed my router’s firmware to dd-wrt, and it’s been working smoothly. But this tip will be useful for any kind of PPTP server and (probably) Linux clients.

After getting bored for need to connect to another VPN site to get access to Kakao’s current server, I decided to install a PPTP-Client on it and connect to my home network. It’s even better when I’m out of home that I only need to connect to one VPN instead of two.

For my surprise on Kakao server I was able to ping/connect only to my router with IP address, but nothing else! Idea was also to use same DB as new server is restoring and running on new domain (www.kakaostats.net).

Basically all howto’s I found on internet suggested to create a script adding route to VPN network like this:

route add -net dev ppp0

Where ppp0 is the virtual device connected to VPN network. But this sh*t never worked at all. First thing came to my mind was netmask which was, but this is kind of default for all kinds of VPNs. I even checked in Windows and it’s the same.

After trying traceroute to some IP address, I figured out that all traffic from VPN was going to router IP address first and not being forwarded to network. But from Windows it was the same, except it was being forwarded to network.

Then I decided to change script and wrote this way:

route add -net gw

Voilà! It worked! Now old kakao and new kakao run on same DB server thru my VPN PPTP server.

Another useful tip: in my case, ISP only provide a dynamic IP address so I’m using DynDNS. Quite often the IP address changes and VPN tunnel goes down and don’t get up automatically. The way to fix it is to change in /etc/ppp/options (may vary according to your Linux flavor) this options:

  • Uncomment persist option. This will make pptp-client try to connect again when it notice no traffic.
  • Set maxfail to 0. You may also need to uncomment this line, but this will make pptp-client try to connect forever on server.
  • Optionally uncomment and change connect-delay to something else bigger than 1000 (default value). Since it may take some time to update new IP address on DynDNS doesn’t make sense to try to connect right away. But won’t hurt to maintain default value.

That’s it! Hope this was helpful to you!


Nope! I’m not dead, dear bots!

I’m working quite hard last few months, I barely have time to my hobbies. But I’m not dead, and when I have time I work a little on it!! I got slapped in the face when the company’s IT I work for deleted all my personal files and uninstalled all programs that doesn’t belong to “company’s police” that were in the laptop I work… Bit me! So I bought a MacBook Air to do my own stuff and specially this projects!

In the go-kart area, as usual I’m facing problems with engine. For costs reason there’s a bunch guys here that uses the engine of the old Yamaha RD135, bit of smoke, lots of noise and lots of power above 7500rpm! I’ve heard some guys talking about 45hp… Sounds like too much for me compared to the original 16hp. But I wouldn’t say less then 25hp! Anyway… Here’s my last few laps last Sunday. At the time I had drove the whole day, so no more arms left!

And in the Arduino area, there’s one good news… I found a better magnetic sensor switch for the dashboard project. It’s exactly what I was looking for! Works the same way the others I already have, so no changes in the code. You can find here the link for DX. And this is what I’m talking about:

Hall effect sensor


Only exception is that the wires doesn’t seem so resistant. The idea is that it’s fixed, with almost no moves, except in the steering wheel, but I’ll mange to find a way keep it safe! 🙂


Testing TM1638 + Go-Kart dashboard project

Hello world!

Well… Since my go-kart engine still in maintenance, I found another way to play with TM1638 display that I bought here: http://dx.com/p/8x-digital-tube-8x-key-8x-double-color-led-module-81873

Basically it read the values from the potentiometer and maps to 1 to 10000, more or less the rpm of the engine, and shows at display. Also turns on the leds mapping the value of the potentiometer from 1 to 16.

The small piece of code I wrote to do it is here:

#include <TM1638.h>

TM1638 module(8, 9, 7);
int potpin = 0;
int val;
int val2;
void setup(){}

void loop()
val = analogRead(potpin);
val2 = map(val, 0, 1023, 1, 16);
val = map(val, 0, 1023, 0, 10000);

switch (val2) {
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
case 16:

More detailed information about how to use the TM1638 you can find here:


Also from this link above comes my inspiration to the dashboard I’m planning to do for my go-kart, this video:

More information about this project you can find here:


That’s why I bought magnetic switches… The idea is that one of this goes to rear axle, and each time ir switch from 0 to 1, Arduino reads it, calculate the time needed to turn one time and convert to km/h, according to the tire circumference.

Same for the RPM, each turn of the engine is has X milliseconds, based on that it’s possible to calculate how much rotations per minute it represents.

On both cases it’ll be used Arduino’s millis() function. Maybe for RPM I’ll need micros() instead, but I’m not sure yet. According to my calculations, millis() could not be so precise for this case… But I’ll need to test, and for sure I’ll post it here.

Have fun!

Temperature Sensor

Hello again, world!

Temperature is also important for my go-kart project (later I’ll write about the project itself). It’s pretty important to know how to change the fuel mixture to avoid doing a hole in the piston and screwing up the spark.

Considering that I bought a temperature sensor in DX and here it is:


I put my finger close to it, so you can see how small it is. It uses the LM35 sensor, and here you can find its data sheet.

It works more or less like a potentiometer. You put on it 5v (or 3.3v, but you should change the code), and the output is mV, so we need analog pin. This sensor has a precision of 10mV/C, so for each Celsius degree output increase/decrease 10mV. And for each mV… you can do the math, right? 🙂

Arduino ADC has a precision of 10 bits or 5v / 1024 or ~0.0049. If we read the pin, we’ll have the value in volts, to convert it to millivolts we must multiply by 1000 and how the sensor precision is 10mV/C we must divide by 10… in other words “pin * 0.0049 * 1000 / 100”. Or being less stupid “pin * 0.49” and to convert to Fahrenheit multiply by 1.8 and then sum 32.

The left pin has a “-” close to it, what makes me know it’s the ground pin, the right one has a S close to it and I guess it is the output pin (if someone knows what “S” means, please let me know). The pin in the middle could only be VCC. Well… Now it’s easy to wire it… Left pin to Arduino ground pin, middle pin to Arduino 5v pin and right pin to Arduino A0 pin.

I wrote a small code to read the temperature:

int analogPin = 0;
int readValue = 0;
float temperature = 0;

void setup() {

void loop() {
readValue = analogRead(analogPin);
temperature = (readValue * 0.49);
Serial.print(“Temperature: “);
Serial.print(” C “);
Serial.print((temperature * 1.8) + 32);
Serial.println(” F”);

The output is:

Output from Temperature sensor

The value grows when you put the finger in the sensor, as you may notice in the picture above.

Have fun!!

Magnetic Detection Sensor Module

Hello world!

Some words about my tests with sensors I bought to go-kart project…

All of them work basically in the same way, you must connect VCC pin to Arduino 5v pin, G pin (or ground, or “-“) to Arduino groud pin and Out pin (or whatever its named) to some digital pin, in this example I used pin 2. When it detects a magnetic field (like a magnet) they change the status from 0 to 1, or from open to closed, or from LOW to HIGH… Whatever you need! Using digitalRead() function in Arduino is pretty easy to use them.

There’s one and a half exception only: The real exception is the last one (right side) in the picture below changes from 1 to 0 instead. For sure this is not a problem, you must just remember it when you’re writing your code. The “half” exception is the first one (left side) that looks to have also an analog output, I didn’t even tested it or Googled to know how it works… And I’m not planning to do it so soon…


By now I tested them with a pretty small rare-earth magnet I found at home. The better one in my opinion is the red one in the right. It detected the magnet more or less from 1,5 cm and the others about 1 cm. I hoping to have better values with bigger magnet, otherwise I’m in a bad shape for what I’m planning to do.

To test it I wrote this small code that turns on the led at port 13. (or turn it of, in the case of right one).

int magnet = 2;
int led = 13;

void setup() {
pinMode(led, OUTPUT);
pinMode(magnet, INPUT);
digitalWrite(led, LOW);

void loop() {
int magnetState = digitalRead(magnet);
if (magnetState) {
digitalWrite(led, HIGH);
else {
digitalWrite(led, LOW);

Easy, isn’t it? You can replace digitalWrite(led, HIGH) or digitalWrite(led, LOW) for whatever you want to do when it detects the magnetic field.

DX links to the magnetic sensors (in the order of the picture):

Btw… I also tested a Funduino Uno that I bought, since DX is not selling Arduino (I know it was fake) anymore. So far now it seems to work as an Arduino Uno!

Houston we have a problem!!

Well… I’m pretty sure that no one will read this, but let’s keep it just for record…

Two weeks ago the engine of my go-kart opened a hole at the piston and cut the “head” of the spark because of too poor mixture. I must say that it’s not funny when this happen at 100 km/h in a small piece of metal (the go-kart :)), the engine got stuck and you start spinning around… Some pictures of what happened inside:

983860_456821574410488_1856808364_n  Spark

I needed one whole sunday to open the engine (thanks God it’s a simple 2 stroke) and fix the damages, but was ok…

So last saturday I went to track again to test and have fun… And this happened ok the whole day… In the end of the day my brother in law was driving when the gearbox broke. It is not his fault, the gearbox was “telling” us that this was going to happen soon. At leas happened in the end of the day!

I was planning to start doing some stuffs with the hall effect and temperature sensors I bought for telemetry, but now I need to spend next days fixing the gearbox. I’m a little bit sad that I need to postpone Arduino stuff, but pretty excited to open the gear box and see what’s going on inside.

I did some tests with sensors today, just to learn… I’ll write about it later!

And to finalize a video made from a friend of mine driving my go-kart! Just for the record… I’m about 10 seconds faster than him… He doesn’t know how to shift gears well yet…

The beggining

Hello all!

The main purpose of this blog is to share with the world my experience in projects I’m doing. By now I have 2 projects, first one is some kind of telemetry system for my go-kart and the second one is an airplane model I’m building slowly (made of plastic bottles, I show some pictures later!).

Both projects are going to be done using Arduino, but I’m not planning to share my whole codes and I tell you why: you’ll lose all the fun and the knowledge if you easily copy and paste the source codes and use the same schematic that I’m using. Am I right? Of course I’ll share some tricks or how to solve some problems that I’ll have, that’s the purpose of internet, right?

Some words about me? Well… I’m a Brazilian guy (sorry about my bad English btw) graduated in computer network that works for an automation company. As a hobby I like to race go-karts and this year I was introduced to Arduino world then I decided to do by myself an airplane model and this telemetry for my go-kart. And no, I don’t have big knowledge with electronic stuff and/or Arduino. All that I know I found at Google or some friend helped me.

Hope you like it!