Montag, 11. August 2014

Arduino and the Time.h library error

Hey,

so you wanna use your Arduino with the time library and get the
"error: variable ‘monthNames_P’ must be const in order to be put into read-only section by means of [...]"
message?
No problem! Open your Time-library folder ( f.e. ~/sketchbook/libraries/Time ) and edit the DateStrings.cpp - or just type in the terminal:
nano ~/sketchbook/libraries/Time/DateStrings.cpp
Replace the following lines:
41: PGM_P monthNames_P[] PROGMEM =
58: PGM_P dayNames_P[] PROGMEM =
59: char dayShortNames_P[] PROGMEM = 

with
41: PGM_P const PROGMEM monthNames_P[] =
58: PGM_P const PROGMEM dayNames_P[] =59: const char dayShortNames_P[] PROGMEM =

save, and your sketch should compile without the error above :-)

Good luck!

Freitag, 7. März 2014

Canon MP495 refill reset / Error P08

Hey guys,

let's say, you refilled your cartridge and all of a sudden, your printer doesn't want to print anymore or the pages come out absolutely white... It's time to reset the printer with the following steps (thanks to http://canonmp495error5200.blogspot.de/2012/06/question-how-to-resolve-critical-error.html):

  1. Unplug the printer from power and wait 5 sec then plug it back in.
  2. Press "Stop/Reset" button for 2 sec and hold it.
  3. Now press and hold the "Power" button also with "Stop/Reset" for 5 sec.
  4. Release only "Stop/Reset" and wait for 2 sec (still holding "Power" button)
  5. Now press and release "Stop/Reset" 5 times.
  6. After 5 sec release "Power" button also (no LCD only power light is working).
  7. Wait for a minute (counting starts after step 6).
  8. Now power off the printer by pressing "Power" button.
  9. After 30 Seconds press "Power" button again. You are ready for printing NOW :-)
Please take the timing seriously (by counting in your head)!

Good luck.

Montag, 30. September 2013

Home Controling with Ubuntu (or raspberry pi) and Arduino

Hey guys,

I just discovered the great application heimcontrol.js from http://ni-c.github.io/heimcontrol.js/
If you want to control your existing rc-switches (for example from intertechno etc.) you may follow this quick guide.

0. Install raspbian on your raspberry pi (may work with other distributions too!)

1. open a terminal and copy paste (you can c&p all the commands at once):
sudo apt-get update
sudo apt-get install git-core git scons build-essential scons libpcre++-dev xulrunner-dev libboost-dev libboost-program-options-dev libboost-thread-dev libboost-filesystem-dev

If you are running ubuntu you may receive errors (packages not found). You can remove all "not found" packages from the list and install the rest. Also you can try to install the following programs through the software center (but you may have to add some repos)

2. Install node.js
wget http://nodejs.org/dist/v0.10.18/node-v0.10.18.tar.gz
tar -zxf node-v0.10.18.tar.gz
cd node-v0.10.18
./configure
make
sudo make install

3. mongodb - on ubuntu use the software center and skip step 3 (don't forget to add an startup script!)
(3.0: If you are using a Raspberry PI with 256MB RAM, then you have to edit the file /etc/dphys-swapfile and change the value of  CONF_SWAPSIZE  from 100  to 200)
3.1: install mongodb 
cd ~
git clone git://github.com/RickP/mongopi.git
cd mongopi
scons
sudo scons --prefix=/opt/mongo install
scons -c

3.2. open '/etc/environment' ( sudo nano /etc/environment ) and add:
PATH=$PATH:/opt/mongo/bin/
export PATH

3.3. Add mongodb user, directory and upstart script:
sudo useradd mongodb

sudo mkdir /var/lib/mongodb
sudo chown mongodb:mongodb /var/lib/mongodb
sudo mkdir /etc/mongodb/
sudo sh -c 'echo "dbpath=/var/lib/mongodb" > /etc/mongodb/mongodb.conf'

cd /etc/init.d
sudo wget -O mongodb https://gist.github.com/ni-c/fd4df404bda6e87fb718/raw/36d45897cd943fbd6d071c096eb4b71b37d0fcbb/mongodb.sh
sudo chmod +x mongodb
sudo update-rc.d mongodb defaults
sudo service mongodb start

4.  install heimcontrol.js
cd ~
git clone git://github.com/ni-c/heimcontrol.js.git
cd heimcontrol.js
npm install

5.1 install duino:
npm install duino

5.2 DON'T FORGET TO INSTALL THE REQUIRED LIB ON YOUR ARDUINO!!! Compile and upload (with Arduino from the softwarecenter) the code from ~/heimcontrol.js/node_modules/duino/src/du.ino to your arduino and connect it to your new heimcontrol server.


6. MODIFY FILES (or else you will get the error: "events.js:2817: Uncaught Error: Cannot open /dev/")
nano ~/heimcontrol.js/node_modules/duino/lib/board.js

search around line 75 for 'ls /dev | grep ACM' or similar and change it to:
'ls /dev | grep -e usb -e USB -e ACM'

save and exit.

7. start heimcontrol.js:
cd ~/heimcontrol.js
node heimcontrol.js

8. open a browser and go to localhost:8080
set up as you please :-)



FYI: If you are using intertechno codes, you have to change the last 4 bits of the hardcoded transmission code!!! Further informations can be found on http://www.fhemwiki.de/wiki/Intertechno_Code_Berechnung
nano ~/heimcontrol.js/plugins/arduino/index.js

Edit the codes:
// Send RC code
        if (item.value) {
          return that.pins[item.pin].triState(item.code + "0FFF");
        } else {
          return that.pins[item.pin].triState(item.code + "0FF0");
        }
 

Save and exit. Restart heimcontrol.js


Freitag, 19. Juli 2013

Ubuntu fingerprint & Vaio VPC-Z1

Here we go again.
After years of having a non-functioning fingerprinter in my notebook, I decided a few minutes ago to change that.
So if you run ubuntu first check out your fingerprinter device to make shure the following steps work.

  1. Open a terminal (Strg+Alt+t) and type in:

    lsusb

    All your devices should be listed in the terminal now. Search for your fingerprinter entry. In my case it is: Bus 001 Device 003: ID 147e:1001 Upek TCS5B Fingerprint sensor
  2. Go to https://launchpad.net/~fingerprint and check out, if they support your device. Fortunately the Vaio VPC-Z1 fingerprinter 147e:1001 is supported :-)
  3. If you find your device, add their repo with the command:

    sudo apt-add-repository ppa:fingerprint/fingerprint-gui

    Update your repos:

    sudo apt-get update
  4. Install fingerprint and fingerprint-gui

    sudo apt-get install libbsapi policykit-1-fingerprint-gui fingerprint-gui

    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    NOTE: If you read your terminaloutput carefully you will notice the line:
    Die folgenden Pakete werden ENTFERNT:
      policykit-1-gnome


    Therefore, if you want to remove fingerprint you HAVE TO install MANUALLY policykit-1-gnome !!! Otherwise your system will break!!!
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  5. Now open fingerprint-gui and save your fingerprints.

Known problems:
Only if you have a encrypted homedirectory the INITAL login won't work with fingerprint. With initial login I mean the first login after cold boot. You can only login by typing in your password. For all other logins (screensaver, standby, sudo etc.) you can use fingerprint.
The only way (I know) to login with fingerprint in an encrypted system is to make use of the "password" tab in fingerprint-gui and store your password (encrypted) on a removable device. But be aware of the fact that you never should keep the removable device near your notebook, 'cause the encryption of the stored password is very weak! Also remove the removable device as soon as possible after login in, otherwise an attacker could encrypt the stored password remotely (as I mentioned before...its not very save!).



Good Luck! :-)

Mittwoch, 3. Juli 2013

android studio IDE unter ubuntu

Ciao,

want to check out the new IDE for android from google called "android studio" on ubuntu but it won't start because of the OpenJDK?

No problem!

Check this out:

1. Download the latest Oracle Java Platform (JDK) tar.gz (in my case 7u25) from http://www.oracle.com/technetwork/java/javase/downloads/index.html for your system (in my case Linux x64).

2. Unpack the archive
3. Open a terminal (Strg+Alt+t) and type in:
sudo mv jdk1.7.0_25/ /usr/lib/jvm/
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_25/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_25/bin/javac 1
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.7.0_25/bin/javaws 1
sudo update-alternatives --config java
Choose the Oracle JDK
sudo update-alternatives --config javaws
 Choose the Oracle JDK

4. Check with
java -version
in a terminal, if all went well.


PS: If you have problems with ADB, try to install the following:
sudo apt-get install lib32ncurses5 ia32-libs

Dienstag, 14. Mai 2013

Switch speaker left/right (Lautsprecher links/rechts vertauschen) on Ubuntu

So you have changed the order of your speakers and recognize, left and right speakers are switched? No problem!

open a terminal (Strg+Alt+t) and type in:

sudo gedit /etc/pulse/default.pa

Now, add the following lines to the bottom of the file:

load-module module-remap-sink sink_name=reverse-stereo master=0 channels=2 master_channel_map=front-right,front-left channel_map=front-left,front-right
set-default-sink reverse-stereo

save and restart pulse:

pulseaudio --kill
pulseaudio --start

thats it! :-)


---

Du hast deine Lautsprecher neu angeordnet und links mit rechts vertauscht? Kein Problem! Öffne das Terminal (Strg+Alt+t) und gib folgendes ein:

sudo gedit /etc/pulse/default.pa

Füge in der letzten Zeile nachfolgenden Eintrag hinzu:


load-module module-remap-sink sink_name=reverse-stereo master=0 channels=2 master_channel_map=front-right,front-left channel_map=front-left,front-right
set-default-sink reverse-stereo

Speichere und starte pulse neu:

pulseaudio --kill
pulseaudio --start

Das wars! :-)

Freitag, 3. Mai 2013

Print black/white (monochrome) with Canon under Ubuntu

Hey guys,

if you want to print monochrome with your Canon printer (in my case the mp495), you can do the following:

  1. Open Printer
  2. Select your printer, right click and choose properties
  3. Go to job options
  4. On the bottom there is a field where you type in "CNGrayscale" and hit add.
  5. Now type behind your new entry CNGrayscale "TRUE" and click on apply.
That's it. If you want to print in color again, just change this entry to FALSE.