Sakulstra https://sakulstra.github.io/ cutting the edge en-us Mon, 01 Jun 2015 00:00:00 +0200 https://sakulstra.github.io/2015/06/01/google_fotos.html https://sakulstra.github.io/2015/06/01/google_fotos.html <![CDATA[google fotos face search]]> google fotos face search

Googles new fotos app seems to be pretty awesome, but if you are looking for the “find by person/face” tab like shown in the preview u’ll recognice that there is no person field in your listing.

This is most likely caused by country legislations: Face search is only allowed in a few countrys - in germany for example you wount be able to search for persons.

]]>
Mon, 01 Jun 2015 00:00:00 +0200
https://sakulstra.github.io/2015/05/20/code_composer_studio_mint_17_1_17_2_64bit.html https://sakulstra.github.io/2015/05/20/code_composer_studio_mint_17_1_17_2_64bit.html <![CDATA[code composer studio mint 17.1, 17.2 64bit]]> code composer studio mint 17.1, 17.2 64bit

Code composer studio can be downloaded directly from ti. When u extract the zipped file u will get a readme and a *.bin file which u have to make executable.

sudo chmod +x ./*.bin #with a terminal session in the extracted folder

Once the file is executable u can run:

./filename.bin

, or double click one the binary.

Usually the installer should complain about missing libraries. To obtain these u can simply type

sudo apt-get install libgnomevfs2-0:i386 liborbit-2.0:i386 libusb-0.1:i386

So after installing the drivers and code composer studio itself the linux drivers are still missing. The driver installation has to be performed via terminal so u have to navigate to the ti folder u specified in the installation and execute the driver installation as root.

cd /home/username/ti/ccsv6/install_scripts
sudo ./install_drivers.sh

Regards,

Lukas

]]>
Wed, 20 May 2015 00:00:00 +0200
https://sakulstra.github.io/2015/05/19/pi_ssh_slow.html https://sakulstra.github.io/2015/05/19/pi_ssh_slow.html <![CDATA[pi ssh slow]]> pi ssh slow

In recent days I connected a rs485 chip to the raspberry pi and programmed it via biicode and ssh(tutorial will follow). The great advantage with biicode is, that u don’t have to set up cross-compiling and stuff like than on your self because biicode manages this with some simple commands. Another important advantage is, that u can easily use the wiringpi library with a simple #include.

The problem was, that I had huge delay problems with rpi:send and spi:ssh (also with the usual ssh). The ssh connection was freakin slow and it needed seconds till the “enter password” prompt showed up.

A simple solution for this problem is, to edit the /etc/ssh/sshd_config on the raspberry-pi. Add the line:

UseDNS no

and everything should work as expected.

Regards,

Lukas

]]>
Tue, 19 May 2015 00:00:00 +0200
https://sakulstra.github.io/2015/04/27/arduino_bluetooth_logging.html https://sakulstra.github.io/2015/04/27/arduino_bluetooth_logging.html <![CDATA[arduino bluetooth logging]]> arduino bluetooth logging

In recent days I worked on a android graph tool called BlueGraph which allows to monitor real time data of sensors. Therefore I used a ZS-040 sending data from an msp430 with a baud rate of 9600. The mobile phone receives this data and displays a nice graph containing the data ;)

The app expects the data to be in the following format:

(+|-)(d*)(delimiter)(+|-)(d*)...(\n)

Features

  • plotting up to x graphs simultaneously
  • change the window Size
  • auto scale/static scale for y-axis
  • configure the delimiter between the data entries

Till now the feature list is pretty sparse - if u have some ideas please let me know in the comments.

Regards, Lukas

]]>
Mon, 27 Apr 2015 00:00:00 +0200
https://sakulstra.github.io/2015/04/23/android_studio_on_ubuntu_14_10_15_04.html https://sakulstra.github.io/2015/04/23/android_studio_on_ubuntu_14_10_15_04.html <![CDATA[android studio on ubuntu 14.10, 15.04]]> android studio on ubuntu 14.10, 15.04

Since the newer ubuntu versions u can simply install android studio via ubuntu-developer-tools-center.

sudo apt-get install ubuntu-developer-tools-center
udtc android

Can u? I got an error caused by a bug in the python script as reported on launchpad.

The fix is listed in one of the comments below but i’ll post it here, so u don’t have to dig for it. Open the python file with admin rights:

sudo nano /usr/lib/python3/dist-packages/udtc/frameworks/android.py

and change the following lines(57,58,87)

#replace 1st with 2nd
p = re.search(r'href="(.*)">', line)
p = re.search(r'href="(.*)"', line)

p = re.search(r'<td>(\w+)</td>', line)
p = re.search(r'<td>([0-9a-f]+)</td>', line)

return self.category.parse_download_link('id="linux-studio"', line, in_download)
return self.category.parse_download_link('id="linux-bundle"', line, in_download)
]]>
Thu, 23 Apr 2015 00:00:00 +0200
https://sakulstra.github.io/2015/04/22/arduino_permission_denied.html https://sakulstra.github.io/2015/04/22/arduino_permission_denied.html <![CDATA[arduino permission denied]]> arduino permission denied

When using windows programs on linux there are always permission problems... and most often they are really simple to fix :)

When getting a:

Method name - openPort(); Exception type - Permission denied.

error while trying to upload programs the simple fix is to add the user to the dialout group like that:

sudo adduser username dialout

important:

After doing this you have to logout and login again to take effect of the changes!!!

hint:

I read about people still having problems with some ports. An ugly fix for that would be the editing of file-permission rights.

sudo chmod a+rw theport         #sth. like /dev/ttyACM0
]]>
Wed, 22 Apr 2015 00:00:00 +0200
https://sakulstra.github.io/2015/04/22/fatal_error_python_h.html https://sakulstra.github.io/2015/04/22/fatal_error_python_h.html <![CDATA[fatal error: Python.h]]> fatal error: Python.h

Did u ever get a not found the error for Python.h while installing packages?

#include "Python.h"
                    ^
compilation terminated.

in most cases the reason is a missing package.

sudo apt-get install python2.7-dev libyaml-dev

should be the solution.

]]>
Wed, 22 Apr 2015 00:00:00 +0200
https://sakulstra.github.io/2015/04/19/low_budget_humidity_sensing.html https://sakulstra.github.io/2015/04/19/low_budget_humidity_sensing.html <![CDATA[low budget humidity sensing]]> low budget humidity sensing

I tend to forget watering my plants, so I decided to create a own watering reminder. I thought it would be fun so simply turn on a led, when the ground is too dry. There are quite different soil meters which differ mostly in accuracy and current consumption. For simplicity I’ll stick with the one proposed by tiago as you can get it for around 1$ at aliexpress (in germany you wouldn’t even get the wires for this price).

Sadly I could not find any English datasheet and as my Chinese is pretty bad, but the setup i really straight forward. There is a VCC and GND pin which have to be connected as always. Additionally there is a A0 pin for analog output, and D0 for digital output. For plotting graphs and stuff we need the analog output, but as I only want to turn on a light the D0 is enough. D0 turns HIGH as soon as a threshold is exceeded.

So what i actually did is powering the sensor via a lithium-polymer battery with 3.7V, soldering a 1k resistor between D0 and the LED’s +. With this setup the light turns on when the threshold is exceeded. The threshold can be configured by rotating the blue screw.

led resistor full setup ]]>
Sun, 19 Apr 2015 00:00:00 +0200
https://sakulstra.github.io/2015/04/18/asset_compression_in_tinkerer_and_sphinx.html https://sakulstra.github.io/2015/04/18/asset_compression_in_tinkerer_and_sphinx.html <![CDATA[asset compression in tinkerer and sphinx]]> asset compression in tinkerer and sphinx

Asset compression is a major concern for nearly every complex web framework. Interestingly most static page frameworks don’t care about this, cause server response rates are blazing fast so asset compression for css, js and image resources is not worth the effort.

This may be right in most cases, but especially in bad internet countries and even in suburban regions where the internet speed is reduced to dsl 1k and less it’s important to keep package size to a minimum.

In order to reduce server response time and package size i created a simple tinkerer extension, which can also be used for sphinx with slight adjustments. Is simply takes the generated resources and overwrites them with their minified versions

#Author: Lukas Strassel
#Extension for asset compression in tinkerer
#The proposed solution is based on http://swiftbend.com/blog/?page_id=79#.VTJTKOT7vtQ
from slimit import minify
from rcssmin import cssmin

import glob
import os


destPath = os.getcwd()+"/blog/html/_static"     #get path to static files(may be wrong for sphinx)
jsFiles = []            #container for js resources
cssFiles = []           #container for css resources

def minifyCSSProc(srcText):
    return cssmin(srcText, keep_bang_comments=True)

def minifyJSProc(srcText):
    return minify(srcText, mangle=True, mangle_toplevel=True)

def processFiles(minifyProc, sourcePaths):
    for srcFile in sourcePaths:
        with open(srcFile,'r+') as inputFile:           #open file
                srcText = inputFile.read()              #read file
                minText = minifyProc(srcText)           #minimize resources
                inputFile.close()                       #close file
                os.remove(destPath+"/"+srcFile)         #remove file

                file = open(destPath+"/"+srcFile, 'w+') #create new file
                file.write(minText)                     #write minimized content
                file.close()                            #close file

def jsMinification(files):
    return processFiles(minifyJSProc, files)

def cssMinification(files):
    return processFiles(minifyCSSProc, files)

def setup(app):
        app.connect("build-finished", asset_compression)#inject after build-finished to modify the generated(not original) resources

def asset_compression(app, exception):
        os.chdir(destPath)                              #change working directory
        jsFiles = glob.glob("*.js")                     #find all js files
        jsFiles.remove("disqus.js")                     #disqus wont't work minimized, cause the function names are used in the layout
        cssFiles = glob.glob("*.css")                   #find all css files
        jsMinification(jsFiles)                         #minify js
        cssMinification(cssFiles)                       #minify css
]]>
Sat, 18 Apr 2015 00:00:00 +0200
https://sakulstra.github.io/2014/11/19/gesture_recognition_with_arduino.html https://sakulstra.github.io/2014/11/19/gesture_recognition_with_arduino.html <![CDATA[Gesture recognition with Arduino]]> Gesture recognition with Arduino

There’s a (not so)new star out in the endless wideness of open source software. GRT by Nick Gillian is a gesture recognition library with a rich collection of pre and post processing filter besides a huge variety of build in gesture recognition algorithms.

The GRT library itself is currently published on biicode, but the GRT-GUI isn’t cause it’s highly dependent on qt. So what we want to do now is creating a pipeline from Arduino to GRT-GUI.

The GRT-GUI was designed to communicate via OSC, but we usually use serial communication at arduino/hardware-side. This forces us to read from serial and forward via OSC to GRT.

The following program consists of 3 parts:
  1. establishing a serial connection to your arduino
  2. Continuously read data from serial
  3. use GRT-GUI to read and process the data
#include <string>
#include <iostream>
#include <stdlib.h>
#include "david/serial_cpp/serial.h"
#include "Maria/oscpack/osc/OscOutboundPacketStream.h"
#include "Maria/oscpack/ip/UdpSocket.h"

#define ADDRESS "127.0.0.1"
#define PORT 5000
#define OUTPUT_BUFFER_SIZE 1024
#define COMPORT "/dev/ttyUSB0"
#define BAUDRATE 115200

using namespace std;

int main()
{
  //open udp socket for osc
  UdpTransmitSocket transmitSocket( IpEndpointName( ADDRESS, PORT ) );
  //open serialport for arduino communication
  //expects arduino messages in following form: $value1\tvalue2\tvalue2\n
  serial serialport('$', '\n', COMPORT, BAUDRATE);
  string input = "";
  while(1){
    input = serialport.read(); //read a message
    if (input != ""){
      //begin OSC message
      char buffer[OUTPUT_BUFFER_SIZE];
      osc::OutboundPacketStream p( buffer, OUTPUT_BUFFER_SIZE );
      p << osc::BeginBundleImmediate << osc::BeginMessage( "/Data" );


      char seps[] = "\t";
      char *token;
      //token points to &input
      token = strtok( &input[0], seps );
      while( token != NULL )
      {
        //add value inside token to osc message
        p << atof(token);
        //token points to next occurence
        token = strtok( NULL, seps );
      }
      //end osc message
      p << osc::EndMessage << osc::EndBundle;
      //send message via udp
      transmitSocket.Send( p.Data(), p.Size() );
    }
  }
  return 0;
}

Biicode leverages this process by reducing the pain of downloading and compiling external dependencies. With a simple:

bii find      #downloads dependencies
bii cpp:build #builds the project

we can start our program and you will hopefully see the data-stream in GRT-GUI.

Here’s a simple example video, where I used a boarduino with an mpu6050 which constantly streams the quaternion rotation data and the 3-axis acceleration data via serial to the pc.