Troubleshooting Using Bias Voltage

ICP Sensors are nice!

The last two days I was frustrated with an ICP (Integrated CircuitPiezoelectric) vibration sensor not working.

There were glimpses of uptime but it was just that. Glimpses…

The sensor is driven by a dead simple circuit:

As you see:

  • A current limiting diode (surprisingly expensive)
  • A polarised capacitor (Tip: Use a tantalum capacitor for lower noise levels)
  • A 470K resistor

The circuit has worked before and even if it is difficult to mess, I checked more than 10 times the polarity and the continuity of the circuit.

As you can see in the picture, there is one thing there called DC Bias. Just keep it on your mind.

Brief (fun?) theory

As I mentioned we are using an ICP sensor. These sensors are powered with a constant current DC source. The power supply is typically 18–30 Volts DCcurrent limited via a constant current diode between 2 and 20 mA. Typical battery operated supplies offer 2 mA of constant current to extend battery life while continuous monitoring systems offer more current in order to drive longer cables.

The signal output of an ICP sensor is a low impedance voltage signal proportional to the dynamic measurement such as force, pressure, or vibration. This voltage signal is carried on a DC bias voltage. The AC dynamic signal is superimposed on the DC bias voltage and is allowed to swing between the supply voltage and ground. Unlike an Operational Amplifier (Op Amp) that requires a plus and minus supply and allows the signal to “ride” on ground and “swing” between the plus and minus “rails,” the ICP sensor requires the output signal to be DC biased.

Let’s get troubleshooting!

So, how do you check the sensor?

As you see I cannot break through it to see if I’ve fried it (these are pretty sturdy and frying them is harder than it sounds). I am also pretty sure that my circuit is good as it have worked perfectly before.

The DC Bias of the sensor can quickly and reliably show us if the sensor is working and if we have connected it correctly.

Below there is a table with common DC Bias voltages and their meaning:

Three scenarios are possible:

  1. Generally, if you get around half your supply voltage you are good to go.
  2. If you get 0 Volts you have probably shorten out something. Woops!
  3. In my case, I got my supply voltage which means the connection to the sensor is faulty resulting to an open circuit. Check your cable!


As you see the DC Bias on these sensors is very useful for troubleshooting. So next time you bump on a wall like that you know what to do!

My edX Wishlist

Due to a violent occupation of the ECE Department of the University of Patras from students that has led to the semester’s loss, me and my friends are gonna end up with some extra free time.
We may study the next subjects by our selves or we can have some top notch professors and universities to teach us.

Here is my (long and very unreal) edX whishlist:

Robot Mechanics and Control, Part I

I am actually doing this one now. It is very comprehensive and teaches the basics of kinematic chains and degrees of freedom. It is pretty fundamental stuff explained in the best way possible.

Electronic Interfaces: Bridging the Physical and Digital Worlds

Basic circuits and micro controller introduction. As internet of things and wearables are considered the great thing for the next couple of years this is a must to grasp the basics

Innovation and Commercialization

How innovative products are made. Not a must but it is interesting.

Economics of Cybersecurity

With 2 major breaches in the last six months cyber security is a hot topic alright. Impacts on the economy are starting to show, so if you care about that stuff this seems good.

Mastering Quantum Mechanics

Always wanted to be able to say the above. A dream coming true!

Signals and Systems, Part 2 

No introductions here. You can skip part one if you’re already familiar with the basics.

Circuits and Electronics

Refresh your circuits skills and knowledge. Basic stuff again.

Introduction to Aeronautical Engineering

Aeronautical Engineering was my second choice but I find it very interesting.

Introduction to Solid State Chemistry

Great innovations happen in that sector. As graphene enters our lives a we should refresh organic chemistry at least.

Underactuated Robotics

Walking and swimming robots. Nothing to say here.

Introduction to Computational Thinking and Data Science

Learn to break problems to smaller problems. This is the first step to problem-solving, for this is actually what we do.

The Science of Happiness

Don’t worry be happy!

Εntrepreneurship 101: Who is your customer?

One of the main entrepreneurial problems.

Building Mobile Experiences

Mobile is everywhere now and as a result implementations of mobile experiences interest us.

Discrete-Time Signal Processing

Aka. DSP.

This list is a completely personal collection choices resulting from a 5 minutes scrolling research. You can surely find something that interest you out there.

Other sites that provide courses are:

Hope I helped.

An easy Media Server and Time Machine

I hate mess… So I like remote solutions!

One thing that bothers me is the USB cable that I always have connected on my computer.
On it’s other end, lies a 1TB Hard Drive that stores my Time Machine backup.

From time to time I stream movies via Plex from the same hard disk.
That’s because I don’t want to store movies on my low capacity Macbook Air.

Since I got my Chromecast, Plex has gone to the top of my “Useful Software” list as it supports Chromecast and I can stream the Movies without connecting a HDMI cable.

So what I need? A HDD in my network that hosts my media and my backups.

Nice, but not so cheap.

Using a spare very low powered netbook and the Time Machine HDD, I managed to put away these 2 functions from my laptop.

I could also get torrents directly on my netbook. Life would be easier…

Let’s do it!


What we will need

  • We need something debian-based. Preferably use your old computer or netbook but not your Rasperry Pi as Plex does not support it officialy yet (I think). You can check your chances with RasPlex if you feel like it.
    • I used Ubuntu Server 14.04 LTS 32bit on an old Lenovo ideapad.
  • A large enough Hard Drive. TB has gone pretty cheap lately.
  • An afternoon.

Format the Hard Drive

Put the HDD on OS X and create a big partition for the Time Machine using Disk Utility.

Leave the rest Unallocated.

Remeber not to have spaces on the disk labels. I used timemachineand diskspace

Next holding option click partition from the sidebar and Disable Journaling.
We do this to ensure compatibility on case of restore.

Then on linux format the rest as ext2ext3 or ext4.

You can use parted for that.

Setup system

Use blkid to check your Partiotions UUIDs and note them.
The sdb ones are the ones we care about.

sudo blkid
/dev/sda1: UUID="dadbbcb0-0680-4633-b6a5-ebea09359478" TYPE="ext2"
/dev/sda5: UUID="PnN6eH-eipf-Rq1w-ddfi-FCf3-w23k-5NDAcE" TYPE="LVM2_member"
/dev/mapper/ideapad--vg-root: UUID="ab0966d5-eba5-4ca2-aeca-62234b4ce71f" TYPE="ext4"
/dev/mapper/ideapad--vg-swap_1: UUID="54745ca7-cb41-432f-aa3e-92ec708248e6" TYPE="swap"
/dev/sdb1: UUID="e14664bf-85bb-4265-99e3-787e454da730" TYPE="ext2"
/dev/sdb3: UUID="744f07e4-2075-34f5-811f-df6b37e2d2a7" LABEL="timemachine" TYPE="hfsplus"

Now create the mount points and give them the right permissions.

sudo mkdir /media/timemachine /media/tm_backup
sudo mkdir /media/diskspace /media/diskspace/transmission /media/diskspace/completed
sudo mkdir /media/diskspace/incomplete /media/diskspace/torrents
sudo chown -R tsagi:tsagi /media/diskspace/
sudo chown -R tsagi:tsagi /media/timemachine/

Add the settings to the end /etc/fstab so they mount on startup.

UUID=e14664bf-85bb-4265-99e3-787e454da730 /media/diskspace ext2 defaults 0 0
UUID=744f07e4-2075-34f5-811f-df6b37e2d2a7 /media/timemachine hfsplus force,rw 0 0

Then reboot.

Time Machine

Linux Server

First install Netatalk:

sudo apt-get install netatalk

Edit /etc/netatalk/afpd.conf with your favorite editor and add the following line at the end (comment out every other line that might be active):

- -tcp -noddp -uamlist, -nosavepassword

This will define the afpd server (Netatalk).

Next make sure your /etc/default/netatalk file shows CNID_METAD_RUN=yes.
This will ensure that all the metadata that is needed by OS X is handled and saved by an extra daemon on the side, too.

Now add the following to /etc/netatalk/AppleVolumes.default:

/media/timemachine/tm_backup "Time Machine" allow:username cnidscheme:dbd volsizelimit:650000 options:usedots,upriv,tm

Adjust the location of the directory and the username to your needs. The example above also limits the size shown to OS X as 650 GB (the number is given in MiB, so it’s 650.000 times 1024 in the real world). Also note that the tm option is only option separating a Time Machine capable directory from a regular afp share.

You should also edit the :DEFAULT property on/etc/netatalk/AppleVolumes.default file to match this:

:DEFAULT: cnidscheme:dbd options:upriv,usedots

Restart the Netatalk daemon to make sure it uses the newly adjusted configurations:

sudo service netatalk restart

We are now done configuring the server.

OS X Client

Open up Finder and press Command + K to bring up the “Connect to Server” dialog.

Connect to server dialog

Enter afp://ip_address_of_your_server, press Enter and select the according share from the list.
Fill in username and password from the user on the server (not the one on the Mac) and see if you have access to the share.
If everything works well, continue with the Time Machine preferences.

In the system preferences on your Mac, select Time Machine and click on “Select Disk…”

Select your share from the list, edit the other options like excluded directories and automatic backups to your liking and enjoy this cheap and reliable Time Machine solution!
The first backup might take quite some time, depending on your network and hard drive speed. All the following backups will be incremental and a lot faster.

Bonus: you don’t even have to manually connect to the server share before a backup. Time Machine will let its magic happen and auto-mount / un-mount the share whenever it is needed. Peace of mind in a box.

Credits: I used this guide with some changes I made.

Useful links:

afpd.conf manpage

AppleVolumes.default manpage

Media Server

What it takes to make the perfect media server for me?

Just a good torrent client and Plex!

Let’s get to it!


For the torrent client I just used Transmission. It is more than good and it has a clean remote UI.

First get Transmission:

sudo add-apt-repository ppa:transmissionbt/ppa
sudo apt-get update
sudo apt-get install transmission-cli transmission-common transmission-daemon

We should add our user to the debian-transmission group.

sudo usermod -a -G debian-transmission user

Remember the directories we created earlier?
Let’s give the correct permissions.

sudo chmod -R 775 /media/diskspace/transmission

Now stop the daemon to configure transmission.

sudo service transmission-daemon stop

Backup the default settings:

cd /etc/transmission-daemon
sudo cp -a settings.json settings.json.default

Then create a transmission settings directory in your home folder (example:/home/user/.config/transmission-daemon), copy settings.json into it, and change its permissions to make it accessible to transmission-daemon:

mkdir /home/user/.config/transmission-daemon
sudo cp -a /etc/transmission-daemon/settings.json transmission-daemon/
sudo chgrp -R debian-transmission /home/user/.config/transmission-daemon
sudo chmod -R 770 /home/user/.config/transmission-daemon

Then, remove /etc/transmission-daemon/settings.json, create a symbolic link in the /etc/transmission-daemon folder, and edit it permissions to make it accessible to Transmission and the user account:

cd /etc/transmission-daemon
sudo rm settings.json
sudo ln -s /home/user/.config/transmission-daemon/settings.json settings.json
sudo chgrp -R debian-transmission /etc/transmission-daemon/settings.json
sudo chmod -R 770 /etc/transmission-daemon/settings.json

You can now start editing /home/user/.config/transmission-daemon/settings.jsonwithout worries of losing your settings.

You can copy mine but remember to change your settings and password if they don’t agree:

    "alt-speed-down": 500,
    "alt-speed-enabled": false,
    "alt-speed-time-begin": 540,
    "alt-speed-time-day": 127,
    "alt-speed-time-enabled": false,
    "alt-speed-time-end": 1020,
    "alt-speed-up": 1,
    "bind-address-ipv4": "",
    "bind-address-ipv6": "::",
    "blocklist-enabled": false,
    "blocklist-updates-enabled": true,
    "blocklist-url": "",
    "cache-size-mb": 4,
    "dht-enabled": true,
    "download-dir": "/media/diskspace/transmission/completed",
    "download-limit": 100,
    "download-limit-enabled": 0,
    "download-queue-enabled": true,
    "download-queue-size": 5,
    "encryption": 2,
    "filter-mode": "show-all",
    "idle-seeding-limit": 30,
    "idle-seeding-limit-enabled": false,
    "incomplete-dir": "/media/diskspace/transmission/incomplete",
    "incomplete-dir-enabled": true,
    "inhibit-desktop-hibernation": false,
    "lazy-bitfield-enabled": true,
    "lpd-enabled": false,
    "main-window-height": 500,
    "main-window-is-maximized": 0,
    "main-window-layout-order": "menu,toolbar,filter,list,statusbar",
    "main-window-width": 467,
    "main-window-x": 50,
    "main-window-y": 50,
    "max-peers-global": 200,
    "message-level": 2,
    "minimal-view": false,
    "open-dialog-dir": "/media/diskspace",
    "open-file-limit": 32,
    "peer-congestion-algorithm": "",
    "peer-id-ttl-hours": 6,
    "peer-limit-global": 240,
    "peer-limit-per-torrent": 60,
    "peer-port": 9071,
    "peer-port-random-high": 9098,
    "peer-port-random-low": 9026,
    "peer-port-random-on-start": true,
    "peer-socket-tos": "default",
    "pex-enabled": true,
    "play-download-complete-sound": true,
    "port-forwarding-enabled": false,
    "preallocation": 1,
    "prefetch-enabled": 1,
    "prompt-before-exit": true,
    "proxy": "",
    "proxy-auth-enabled": false,
    "proxy-auth-password": "",
    "proxy-auth-username": "",
    "proxy-enabled": false,
    "proxy-port": 80,
    "proxy-type": 0,
    "queue-stalled-enabled": true,
    "queue-stalled-minutes": 30,
    "ratio-limit": 1.5000,
    "ratio-limit-enabled": true,
    "rename-partial-files": true,
    "rpc-authentication-required": true,
    "rpc-bind-address": "",
    "rpc-enabled": true,
    "rpc-password": "{c371b29b1eb8a1164023ef4a13013e7583d8a736E5n9jnT/",
    "rpc-port": 9025,
    "rpc-url": "/transmission/",
    "rpc-username": "tsagi",
    "rpc-whitelist": ",*.*.*.*",
    "rpc-whitelist-enabled": true,
    "scrape-paused-torrents-enabled": true,
    "script-torrent-done-enabled": false,
    "script-torrent-done-filename": "",
    "seed-queue-enabled": false,
    "seed-queue-size": 10,
    "show-backup-trackers": false,
    "show-desktop-notification": true,
    "show-extra-peer-details": false,
    "show-filterbar": true,
    "show-notification-area-icon": false,
    "show-options-window": true,
    "show-statusbar": true,
    "show-toolbar": true,
    "show-tracker-scrapes": false,
    "sort-mode": "sort-by-name",
    "sort-reversed": false,
    "speed-limit-down": 0,
    "speed-limit-down-enabled": false,
    "speed-limit-up": 1,
    "speed-limit-up-enabled": true,
    "start-added-torrents": true,
    "statusbar-stats": "total-ratio",
    "trash-original-torrent-files": false,
    "umask": 2,
    "upload-limit": 100,
    "upload-limit-enabled": 0,
    "upload-slots-per-torrent": 4,
    "user-has-given-informed-consent": true,
    "utp-enabled": true,
    "watch-dir": "/media/diskspace/transmission/torrents",
    "watch-dir-enabled": true

Now start the daemon and test the setup heading tohttp://your.server.ip.adress:9025/

sudo service transmission-daemon start


Finaly we need to set up Plex.

Go to Plex website and copy the link for the appropriate version for your setup. I got the 32bit Ubuntu version.

Download it and install it.

sudo dpkg -i plexmediaserver_0.

Next give plex the permissions it needs:

sudo gpasswd -a plex tsagi

Go to http://your.server.ip.adress:32400/manage and point your libraries to the transmission’s completed directory. It can figure out if you have a series episode or a movie in the directory.

Liked it? Every week I send an email. It involves:

  • Interesting things from the internet world.
  • Discussions on pressing matters.
  • Some personal additions.
  • Many surprises!

Join now and enjoy every Friday in your inbox! Sign Up here!

Universal Raspberry Pi Remote

I am getting mad of the remote controller in the house.

Actually I use three:

  • The TV remote
  • The Radio/iPod/CD Player remote
  • The Air Condition remote

Some time ago I fell on this post. It is an IR receiver & emitter circuit attached to a Raspberry Pi. I had some spare time so I decided to build it!

Circuitry was fairly easy.

Parts I used:

Infrared LED : Had a spare one but you can use any from an old remote
IR Receiver : I used a TSOP382. You can use any BUT check the datasheet!
NPN Transistor : I don’t know the part code
1.5Ω Resistor : It just has to be really low
220Ω Resistor : Nothing to say here

You can see the connections clearly here:

After the first assembly and testing I made it smaller using a strip board:

And this is what we end up with:


LIRC stands for Linux Infrared Remote Control. And does exactly what it says.

LIRC is now included in Raspbian’s official repositories for Raspberry Pi and you can install it with:

sudo apt-get install lirc

Append this on your /etc/modules:

{% highlight bash %}
lirc_rpi gpio_in_pin=23 gpio_out_pin=22

Change your /etc/lirc/hardware.conf to:

# /etc/lirc/hardware.conf
# Arguments which will be used when launching lircd

# Don't start lircmd even if there seems to be a good config file

# Don't start irexec, even if a good config file seems to exist.

# Try to load appropriate kernel modules

# Run "lircd --driver=help" for a list of supported drivers.
# usually /dev/lirc0 is the correct setting for systems using udev

# Default configuration files for your hardware if any

And now restart your LIRC daemon:

sudo /etc/init.d/lirc stop
sudo /etc/init.d/lirc start


Now that we are all set up lets check if our IR transceiver works

# Stop the lircd so /dev/lirc0 is not in use
sudo /etc/init.d/lirc stop
# Get RAW data from the transceiver
mode2 -d /dev/lirc0

When you press some buttons on a remote control you should get something like:

space 12300
pulse 590
space 19395
pulse 540
space 7024
pulse 495
space 402351
pulse 560
space 7085
pulse 480
space 29043

If not then check your wiring. It is possible that you crossed the wires on the Pi.


It’s really easy to create add a new remote on LIRC.

# Stop lircd so /dev/lirc0 is not in use
sudo /etc/init.d/lirc stop

# Create a new remote control configuration file (using /dev/lirc0) and save the output to ~/lircd.conf
irrecord -d /dev/lirc0 ~/lircd.conf

# Edit ~/lircd.conf and add edit the name of the controlled device
nano ~/lircd.conf

# Make a backup of the original lircd.conf file
sudo mv /etc/lirc/lircd.conf /etc/lirc/lircd_original.conf

# Copy over your new configuration file
sudo cp ~/lircd.conf /etc/lirc/lircd.conf

# Start up lirc again
sudo /etc/init.d/lirc start

Do not forget to check irrecord --list-namespace for the valid key names. If something doesn’t meet your needs just put it on a KEY_ value that you will not use for this remote.

Now let’s test the remote:

# List all of the commands that LIRC knows for 'samsung_tv'
irsend LIST samsung_tv ""

# Send the KEY_POWER command once
irsend SEND_ONCE samsung_tv KEY_POWER

# Send the KEY_VOLUMEDOWN command once
irsend SEND_ONCE samsung_tv KEY_VOLUMEDOWN

# Send the KEY_VOLUMEDOWN command 10 times lowering the volume for 10 units at once
irsend --count=10 samsung_tv KEY_VOLUMEDOWN

Here is a video where I change channels from command line:

You can add more remotes just by appending a new lircd.conf at the previous one.

For the LIRC configuration I followed this guide.

I also made an Android application using the web interface provided here but the code needs a lot of polishing so I can’t share it yet.

It was cool for an evening project:)

ELOT-743 translator

I had a task to translate a big Greek address book in English.

Due to the fact that Greek Language is full of special characters, a problem occurred when passports where to be created. There should be a fixed way to translate names from Greek to English.
So the ELOT-743 standard was created to solve the confusion

Here you see most of it:

Greek English Greek English Greek English Greek English
α a Ή I Ξ X Ύ Y
ά a θ th ο o Ϋ Y
Α A Θ TH ό o φ f
Ά A ι i Ο O Φ F
β v ί i Ό O χ ch
Β V ϊ i π p Χ CH
γ γ ΐ i Π P ψ ps
Γ G Ι I ρ r Ψ PS
δ d Ί I Ρ R ω o
Δ D Ϊ I σ s ώ o
ε e κ k ς s Ω O
έ e Κ K Σ S Ώ O
Ε E λ l τ t ΟΥ OU
Έ E Λ L Τ T ου ou
ζ z μ m υ y ού ou
Ζ Z Μ M ύ y Ού Ou
η i ν n ϋ y γγ ng
ή i Ν N ΰ y ΓΓ NG
Η I ξ x Υ Y Γγ Ng

So to save my self from the abyss and to avoid the government’s site that had the capability to translate only small text, I wrote a python script myself.

Here is the dictionary to translate the strings:

# -*- coding= utf8 -*-
"""Main source

And here is the actual script:


# -*- coding= utf8 -*-
import sys, getopt
from string import maketrans
from elot743 import *

def replace_all(text, dic):
     for i, j in dic.iteritems():
              if i != j:
                  text = text.replace(i, j)
     text.replace(',' , 'n')
     return text

def readFile(infile):
     print "reading file",infile,"...n"
     i = open(infile, 'r')
     for line in i:

     return array
     print "nfinished reading file!n"

def writeFile(outfile, array):
     print "writing to file",outfile,"...n"
     print array
     o = open(outfile, 'w')
     for item in array:
           o.write("%sn" % item)
     print "nfinished writing to file!n"

def main(argv):
   inputfile = ''
   outputfile = ''
      opts, args = getopt.getopt(argv,"hi:o:",["ifile=","ofile="])
   except getopt.GetoptError:
      print ' -i  -o '
   for opt, arg in opts:
      if opt == '-h':
         print ' -i  -o '
      elif opt in ("-i", "--ifile"):
         inputfile = arg
      elif opt in ("-o", "--ofile"):
         outputfile = arg
   if inputfile == '':
      inputfile = raw_input('File where the names to be translated exist (ex. names.txt) : ')
   if outputfile =='':
      outputfile = raw_input('File where the translated names will be written (ex. trnames.txt) : ')
   print 'Input file is "', inputfile
   print 'Output file is "', outputfile


   print 'File is translated!'

if __name__ == "__main__":

To run the script, you can call it from command line by typing:

python -i  -o 

Where the text file where the names to be translated exist and the text file where the translated names will be written.


You can run it without the arguments and it will prompt you for the file names.

I believe that it will not be helpful to many but it could be a relatively good example of using dictionaries in Python;)

The project code can be found here on GitHub. Feel free to use it.

Feel free to leave your comment below!