Tag Archives: raspberry pi

Making luakit play YouTube videos

Luakit, even though it’s a quite awesome (and fast!) browser, doesn’t play YouTube videos out-of-the-box. At least, when installing it from Raspberry Pi Debian repos, it doesn’t pull the dependencies need and doesn’t even list the packages as ‘recommended’. Nowhere I could find it, but one Arch Linux forum page had a hint, which I decrypted:
Install gstreamer1.0-libav and gstreamer1.0-alsa – the latter being responsible for sound in YouTube videos.
That’s it. Hope it helps =) If you find it’s still not working for you – comment below, I’ll try to debug the issue.

Compiling the latest Arduino IDE for Raspberry Pi

I now have started to use Raspberry Pi 2 with Raspbian Jessie as my desktop PC, and it does all the things I need it to do pretty well. Except… Well, Raspbian is stuck with Arduino IDE 1.0.5, even Jessie. Honestly, it sucks – the newest is 1.6.4 (arduino.cc, not arduino.org version. Screw arduino.org.) Did you know we’ve gotten a sketch autosave feature somewhere around 1.5? If I’d have known, I could have gotten some of my sketches saved when Arduino IDE crashed. Oh, BTW, 1.0.5 also crashes. Why are we stuck with it is incomprehensible.

Even more incomprehensible given that Arduino IDE happily compiles on Raspberry Pi 2 with just a build.xml file (ant build system file) slightly modified to add a new architecture, as well as some pre-compiled files replaced by the ones compiled for ARM. I won’t go into details much, since I hope that Arduino maintainers accept my build.xml modifications  and do what’s necessary to support ARM architecture. If they won’t, I’ll post complete build instructions myself. I’ll describe what needs to be done though.

  1. First, dependencies. Honestly, I have installed a lot of packages while trying many different ways to run Arduino IDE (including getting Linux x32 tarball and trying to replace libs one by one, which was probably stupid), so I just don’t know which from what I’ve installed is necessary and which isn’t. If you absolutely need it before it’s supported, you can always use tools like apt-file to determine necessary packages by using their filenames. I guess that ‘apt-get build-dep arduino’ will bring most of them.
  2. Then, there’s libastylej.so . You’ll need to install libastylej-jni package – it’s something that Arduino IDE sources have to download from arduino.cc website. I have modified build.xml so that it’ll copy the installed libastylej.so instead of unzipping the bundled version. You’ll also have to install avr-gcc and avrdude, as well as libusb-dev.
  3. Now’s building. You can use the official tools and instructions for building Arduino IDE, except that, as for now, the working build.xml is in my Arduino repository copy. It’s forked from version 1.6.5, but I’m sure it’ll work with the next versions as well. As for now, you might just clone my  repo instead of official:
    git clone https://github.com/CRImier/Arduino.git
    You should be able to just run ‘ant’ and relax while it compiles. Then use ‘ant run’ to run the thing, at least for the first time (haven’t researched if it does something first run-specific). After first run, at least, it should be perfectly safe to just  run it as ‘linux/work/arduino‘ (from ‘build’ directory) or even move the ‘linux/work’ directory somewhere and name it ‘arduino-1.6.5’.
  4. To have the “Compile” and “Upload” functions working, you need to replace all the files in ‘build/linux/work/hardware/tools/avr/bin‘ by their symlinks in /usr/bin.  You’ll also want the ‘build/linux/work/hardware/tools/avr/etc/avrdude.conf‘ to point to ‘/etc/avrdude.conf‘. Here’s an one-liner that you have to execute in the bin directory to make symlinks:

    for i in *; do echo $i; rm $i; ln -s /usr/bin/$i $i; done

If you try this approach and it doesn’t work, there’s a possibility I have forgotten something. Do post an error message in the comments – I’ll try to solve it =) There might be some problems because I’m using Raspbian Jessie, when most of you will use Raspbian Wheezy, so I figure some packages might need to be grabbed from testing repositories in case there’s a problem with them in Wheezy.

One more problem solved, and Raspberry Pi is one step closer to being a suitable work PC replacement for a guy like me. I’d say web browsers are still a major problem though. On Raspbian Jessie, as for now, both Epiphany, Iceweasel and Chromium crash randomly from time to time. A browser that crashes randomly isn’t a good browser for me. If you’re searching for a browser too, try Luakit. It’s Webkit-based, fast, never crashed since. You can see the latest HTML5 test of it here.

Why I consider Debian to be one of the best OSes for beginners

As I promised, I’ll tell you why I prefer Debian over other distributions and why I’d advise it as a starting platform for Linux beginners.

I’ve wanted to start using Linux some 4 years ago. I’ve been in a school where informatics teacher was in charge of setting school PCs, including some in public usage. Those were often raided by students who’d put porn pics on a desktop, set pornsites as homepage and do all kinds of other nasty things. Apparently, he wanted to experiment with some kind of public-available PC that’d be resistant to those attacks, so once he put some kind of Linux distribution with full-screen Opera in kiosk mode on one of public PCs. This worked as a charm – it’s hard to change desktop background picture when there’s no desktop or change settings that are unchangeable in kiosk mode. I, just being curious, asked him what the distribution was, and he said it was Debian.

Some time after this, I installed it on one of my PC and started experimenting with it. I broke things a lot, and therefore got to fix them a lot. That’s when I learned the basic principles – like, there are video cards that just do not work in Linux. No matter what the vendor is. Hope this will change, but nowadays it’s not really likely to – there will still be incompatible laptops, for example.

Then I got a not-so-fast Intel board with no possibility to upgrade the GPU/CPU. It really wasn’t anyhow fast for desktop, and I decided to make a server on it. The only suitable place for it was hard to reach and it also had video driver problems under Linux – so I didn’t have any other option than to live without GUI and had to use SSH. It was kind of hard but I eventually got Samba installed – even though I couldn’t have set up passwords properly =) Thank god nobody looked through my files… Or so I think 😉 But I had a file server and tried to improve it actively to suit my needs.

The board broke after some time, due to my hands that were kind of unsuitable for any hardware modifications back then. I was left without a server and any experimentation possibility. It was so until my friend called me and explained he needed a 3G router for one 10 day long event, the day after that. We both were kind of broke those days, so there was no possibility to buy/rent a factory one. So, I needed to set up a gateway with a possibility to use USB modem as an uplink – something I never did before, and all this just in one night. I didn’t promise anything but decided to try, and it just appeared that Internet has all sorts of tutorials about almost everything, and Debian configuration seemed to be a well-covered topic. So, my gateway was ready and I even managed to get some sleep. That was impressive for me as it showed just how easy things are.

After the event, I left the gateway working as my own home router and it appeared to work, and was stable enough… Until I messed everything up again =) I had to reinstall things multiple times, but every reinstall was a cleaner one, I understood installation options better and each time the system was more and more stable. It lasted for around two years at a final state, just working (c). I reinstalled it once again, and finally it’s both working and not a mess of services, unused packages and downloaded files.

Now, I have enough knowledge – but it wouldn’t be so if I didn’t experiment with real things =) And reinstalls both saved time to repair and taught me how and what to backup.
Would I have gotten that all experience, using some other distribution?

Probably, no. Debian has everything you’d demand from a Linux distro for both novices and average users, maybe even professionals:

  1. Easy installation (lacking from many distributions).
  2. Clean structure with hardly any fixes needed, which’d have taken a lot of my time when I was a beginner.
  3. Large community – that means tons of tutorials available and being made, and people that are glad to help.Friendly environment – things are mostly as simple as they can be, but no more simple that is necessary
  4. Good package system – it was hardly needed to compile anything during these 3 years, that would sure add some problems,
  5. Being a stable system – unlike Ubuntu, I mean. Even though it’s a derivative from Debian, they seem to like breaking things from release to release. And Debian maintainers seem to be way more mature in this field.
  6. Being both desktop system and server system at the same time – only one button during installation divides those two things. Therefore, you know that you can easily resign from using desktop environment, and it’s somehow encouraging.
  7. Having different release types – you won’t be dealing with unstable software on a server or with outdated software on desktop. An upgrade from one release to another is flawless most of the times.
  8. Old enough to have well-developed philosophy about how things should work.

Some of those pros are good for novices, some – for experts. And if a distribution is suitable for people of many different levels, it means you stay on the same distribution all the time and get used to it. That does save time and effort. And it’s certainly better to be pro at some well-structured distribution than to have entry-level knowledge in many.

So – every of those qualities Debian has is really important for both learning and usage. That is why I’d advise Debian to any novice in Linux – nothing else has this exact set of qualities, and those qualities are just too important to dismiss any of them.

Raspberry Pi wearable PC project – updates, v2

Today, I’ll describe a temporary pinout for my prototype and some more technical details. Raspberry Pi seems to have a lot of useful pins. Still, it’s not enough of them for my goals. For now, I’m not including Arduino and thus I’ll need to suffice from what I currently have. There are some protocols RPi supports by hardware. Some of them, however, are supported only by software, and thus we need to use bit-banging and polling instead of hardware 1-Wire or infrared. This makes me sad and also loads the CPU, which I won’t have much of.

The following pins are populated on a GPIO header every Raspberry Pi has. I’ve managed to find a usage for all of them. I’ve also noted which pins are connected to some kind of hardware inside the CPU that supports this protocol (like SPI/I2C/UART Raspberry Pi CPU has) and which pins will need to be controlled using bit-banging, emulating a protocol by software.

GPIO4 – 1-Wire (SW)
GPIO7 – CS1 (HW)
GPIO8 – CS0 (HW)
GPIO17 – IR-out (SW)
GPIO18 – IR-in (SW)
GPIO22 – DRST (display reset) (SW)
GPIO23 – CSm0 (SW)
GPIO24 – CSm1 (SW)
GPIO25 – CSm2 (SW)
GPIO27 – DD/C (display D/C pin) (SW)

As we know, Rev. 2 boards have 4 more GPIO pins on a separate header, P5. This header also works as I2S connection point, so I think I’ll try to get some kind of cheap I2S audio chip supported by Linux and make a small audio breakout board – maybe 😉

There are some GPIOs that I certainly won’t be using in my project, and those aren’t available on some of the headers yet they control some of the RPi features and thus are tied to some resistors or separate connectors on RPi board, such as RPi audio output or I2C pins on RPi camera connector.

I’ll definitely re-use the following pins:

GPIO6 – LAN_RUN (resets USB hub, connected to pin 12 of SMSC chip)
GPIO40 – PWM-out (audio right channel)
GPIO45 – PWM-out (audio left channel)
I won’t need RPi audio anyway, as the quality is too shitty for me to consider this as an option.

Yet I plan on using RPi camera and I’d like to view activity LED sometimes, so the following pins will stay untouched:

But those connectors certainly won’t be enough, so I’ll need to wait for the Arduino stage of my project =)

Current state of my project after this update

Current state of my project after this update

As I’ll make external “shields”, such as the Nokia 3310 screen shield, I’ll need some external connectors to attach things. I also need them to be waterproof, remember?

BTW, what about the displays? Each of Nokia 3310 displays has the following pins:
RESET (needs to actually be used – we have to send a short pulse to initialise a display before usage, Philips even claims that not doing this can damage the controller)
MOSI (seems to perform the same function as SPI SCLK)
SCLK (seems to perform the same function as SPI SCLK)
D/C (this is needed for the display to distinguish between data and commands being sent. Quite logical for the ease of display controller firmware developers, yet that’ll cause some problems as we will need to extend RPi’s hardware SPI by adding software extensions)
CS (seems to perform the same function as SPI CS, active logic level is low, too)
VOUT (needs to be tied to GND through a capacitor)

As I’ve mentioned, I need CS multiplexer for the displays. Guess what – I’ve already built this, just haven’t had a possibility to check anything. I’ve used 74HC138 IC in SSOP case and a little board that extends SSOP to DIP, then desoldered DIP pins and attached the necessary wires. Raspberry Pi has two CS signals. I’ve decided that one of them will be a CS signal for enabling multiplexer, as it certainly won’t need to work for all the time. Multiplexer I use has 3 inputs and 8 outputs. Thus, I need 1 CS pin (as chip enable pin) and 3 GPIO pins to get 8 CS pins – and, as CS signal state doesn’t need to be changed that often during data transfer, I think I’ll be fine with this. I only will use 3 CS signals now but I guess I’ll occasionally find uses for those 5 left – like, for some of those small RF transmitters =)

Click on the image to see the whole picture, not just a part of it =) Active logic level is low because the same is for SPI CS signal.

This is the pinout of display connector I already have made:
EXT_CON1 pinout:

I guess that looks scary. And I hope that's waterproof enough.

I guess that looks scary. And I hope that’s waterproof enough.

But that’s not the only connector I’ll need. I’ll also need to connect more peripherals, like:

USB flash drives or Arduino through USB-UART connection… why not both, after all?
I2C keypad I’m planning to make
Infrared receiver and transmitter
External display that can be connected to TV-out of Pi.
DS18B20 sensors
SIM card readers
LED flashlight
Hardware interrupts – pins that are used to notify Pi that it’s about to receive/has to fetch some kind of important information that can’t wait, like a keypress from an external keyboard.

So – I managed to get one connector from hard disk drive. This was easy to reuse – though I needed a file and some more tools to minimise the connector so that it could fit in the case.

EXT_CON2 pinout:


This connector will certainly require its own Eagle part =(

This all has been connected, too. Now I just need to think about external shields, and I guess LCD shield will be the first to be made =) Also, the mystery – how to fasten shields to the case? Screws might not be waterproof enough, magnets will have to be strong enough to hold everything and weak enough not to trigger the switches… I’ll have to think about it, for sure. I’m getting my LCDs during this week, hope they’re not buggy and will fit, else everything will be delayed.

For now, I just need to buy DC-DC converters. My search of custom one or two-layer PCBs for easily available DC-DC ICs kind of failed. I realised I have to go for pre-built modules =( I guess it’ll be hard to find one that won’t be bulky and will be efficient at the same time. So – VIN pins on the EXT_CON2 are not yet connected. Also, there’s just the same 5V-3,3V linear regulator =) I’ll certainly have to remove it, too – as soon as I get a pulse DC-DC.

Looks a little bit scary but it's really so little that I couldn't discard it.

Looks a little bit scary but it’s really so little that I couldn’t discard it.

I’ve installed wireless module I’ve desoldered from a broken tablet PC I had lying around. Many of those, especially cheap Chinese craplets, have WiFi modules either soldered on the top of the board or connected by wires. This was the case for me, so this module was easy to get. Just one thing – some of USB devices that are soldered inside other electronics need 3V3 voltage, not 5V. So be careful with them, should you use one. As you can see, I also supply 3V3 to my module using a separate wire =)
My module is identified in lsusb as:

Bus 001 Device 005: ID 0bda:8179 Realtek Semiconductor Corp.

It’s based on RTL8188EUS chip, and Raspbian didn’t have drivers for it in the default distro. That’s when I understood this situation needs a lot of luck. I googled “how to set up network on raspberry pi model a”. See, I basically made a Model A RPi out of my RPi Model B. That means – no Ethernet. It turned out most people didn’t even think about this or even use network on a Model A. Those who did, used USB-WiFi adapter… And mine didn’t work because it didn’t have a driver.

As I obviously needed to install software, I needed network connectivity. One could have tried using PPPD, but it’s not in the default distribution and therefore doesn’t make sense – to set up PPP connection, I needed to install PPPD, and in order to install PPPD I needed network connection. PAN over Bluetooth had the same problem – no Bluetooth support by default =( So the only way to go was USB-WiFi module. Some modules are supported out of the box, but some require a firmware package to work. Downloading a firmware package from repositories has the exact same problem – you need network connection. One can always download a package .deb file, but if there are dependencies or version mismatch, you are screwed. Fortunately, my WiFi adapter didn’t need firmware packages, it only needed a driver, which happened not to have any dependencies =) For those curious where’d I get the
drivers – MrEngman on Raspberry Pi forums has compiled those drivers for Raspbian and published them, helping all those people that have WiFi adapter with the same chipset. Thank you very much, man! Should you arrive in Latvia – I owe you a beer 😉

And for those people that own RPi Model A and need a network connectivity for the initial setup – you have two ways. One is picking an out-of-the-box supported USB-WiFi from THIS LIST. Other is plugging your SD card into Raspberry Pi Model B, installing the packages using cable connection and plugging the card back. You’ve been warned 😉

My shitty soldering job =(

My shitty soldering job =(

I already think about making a more serious PCB. That is – I need to eliminate wiring and glueing modules using hot glue. Instead, all the modules I have have to be soldered to the board which’d hold everything. Also, I plan on using a separate USB hub chip – would be great if I could make a big protoboard both populating all the sockets, such as I2C, SPI etc, and holding USB hub and all the USB-connected modules – WiFi/BT/UART/whatever. I don’t really need separate boards, and if I remade this mess of wires I have now into a single shield board, it all would certainly be more stable and I’d certainly save some space in the case. So – now I just need to put all the components into Eagle CAD (my CAD of choice when it comes to electronics) and make a board… There is a problem, though. I wonder if I’d be able to do two-sided board by myself, as I can’t make vias now, and I’ll certainly need a lot of inter-layer connections. So – need to get to know how does one make vias at home =) I think about drilling small holes in the board where vias need to be, putting thin copper wires inside and soldering those wires to both sides of the board. Seems to be the way, at least.

With the custom board, I’ll certainly need one option: controlling modules’ power supply. That is – putting a transistor in the power line of each module, be it WiFi, screens or external modules. That will save energy and also improve reliability as it’ll be a possibility to turn off a module should it break and short-circuit everything or freeze everything. I can imagine some kind of power-on self-test-now. Let’s say there’s a startup program that checks all the modules, turning them on one by one. As there’s a possibility that a module is faulty and system will freeze, it has to be taken into account. When system freezes, RPi built-in watchdog will automatically reboot
the system. To avoid reboot loop, the program controlling modules will have to see which module failed on each startup and avoid turning it on again until the problem is solved. It could be done by making some kind of flag before launching module and removing it after the module has been sucessfully loaded, and checking for unremoved flags at each boot to determine whether the boot process had been interrupted due to a module failure. Or, maybe, making boot-up logs and parsing a log of previous boot during the boot process. Any way, this seems to be a good idea – I’ll just need hardware and software to support it 😉 Offtopic: it’s always as cruel as this. We might have excellent ideas – the only problem seems to be the implementation, that’s where most of the ideas get crushed.

The card, with WiFi antenna and DS18B20 connectors visible.

The card, with WiFi antenna and DS18B20 connector visible.

I’ve now bought 8GB SD card for my Pi, and it is still alive =) Seems to be indestructible no matter what I do. Now I just need to test whether the CS multiplexer is working or not, set up Bluetooth and WiFi AP software, install some necessary Python modules for the development, then connect one Nokia 3310 screen I already have and start testing. Software will certainly take its time. I can fit various modules into my setup but there’s no sense if I can’t really use them because there’s no program able to control them. God, this will be a challenge =) Now I see the following software problems for me to be solved:

  • Nokia 3310 LCD control. I’ll need to see whether I’ll need to go for LCDProc or just build my own module on top of “spidev”, extending hardware SPI. That’ll be the challenge, especially when you remember that those LCDs will be the main output device for interacting with user.
  • SPI multiplexer control. It will probably be simple yet problems are still possible.
  • I2C keyboard driver. It’s a little bit early to talk about this because it hasn’t been designed yet, so there’ll be a separate article. But there certainly will be problems =(
  • Menu controller. See, in my plans this keyboard will control some kind of menu where one’d be able to select various actions from those that will be available – and there’ll be a lot of actions available =) So this all needs to be coded somehow, and be reliable and fast.
  • Infrared device control. It really depends on what I choose to do, I guess LIRC will do for the most use cases, but I’m still wondering – what if I’ll need more?
  • Audio device control, that is – volume/active device/source/sink control. I’ll probably use Pulseaudio, but one needs to remember it’s far from perfect.

There’s a big possibility I’ve forgotten to include something, I know =) But you also know that I’ll tell you about the problems I meet on my way, sharing my experience with you. So you’ll se by yourself =)

Waiting for the board to be soldered on =)

Waiting for the board to be soldered on =)

Talking about the I2C keyboard, I’ve received two I2C GPIO extender ICs from Maxim Integrated. They’ve been so generous as to provide me two free samples of it =) Now I’m thinking about how to design a I2C keyboard I’m planning to make. Won’t be that simple yet will be simple =) Gotta spend some hours in Eagle CAD preparing for this, I haven’t actually tried to make my own components in Eagle, so it seems that this will be the first one. I’ve already ran into some design difficulties. That is – my keyboard has to be CPU-efficient, generate interrupts only when a key is pressed, not require any CPU work unless there’s a pressed key (those are 3 different things 😉 ), and it also has to be reliable and cheap. However, I already do have some ideas in mind. I guess it’d be fun to ask advice about this project from Maxim technical support =) I guess they do have some good ideas about how to implement it, and will be able to provide the feedback about my implementation.

The next update will be when I’ll feel I have enough to say =) So stay tuned, it won’t be long. Just keep in mind that I also am preparing for the finals now, finishing my high school. That means I won’t be able to spend as much time on this project as I would be able, be it holidays =(

And it's not even a triumph yet ;-)

Raspberry Pi wearable PC – updates

Good news! I have moved towards my project of wearable Raspberry Pi. First of all, my Raspberry Pi is working. I’ve desoldered all the connectors that were bulky, even though I haven’t desoldered the SMSC ship yet. I’ve desoldered the linear regulator… And replaced it with exactly the same 1117 regulator =) It’s just a temporary proof that external regulator really does work as intended. The Pi boots up nicely even after this drastic modification and is equipped with 8GB card. It also has a case and the prototype shield is being made.

And it's not even a triumph yet ;-)

Poor Pi. It has suffered so many injuries and is still alive.

What I’ll be pairing with Pi?

  • DS18B20 sensors
  • Infrared receiver and diode
  • LED strip piece
  • I2C RTC based on DS1307Z with logical level shifter
  • I2C GPIO expander used as key matrix controller
  • DC-DC 5V-3,3V converter
  • 2 Li-ion 18650 cells
  • DC-DC 7,2V-5V converter
  • Usb hub
  • USB BT dongle
  • 3x Nokia 3310 screens with custom CS signal multiplexer


  • Pulseoximeter
  • Geiger counter
  • NFC
  • WiFi

How? Just see this diagram on the left. It gives you some clues about what exactly I’m going to make. Diagram on the right shows you what I currently have =)

That's how things are now just for you to see =)

That’s how things are now =)

Turns out Linux also has Paint-like software. This was created by Pinta. Seems like they didn't think much about the name and just rearranged the letters ;-)

That’s how things should look like.

I’m probably going to loot some free sample-offering IC companies =) I’m certainly going to need an acelerometer and gyroscope after that. I have an idea to get them from some mobile phone motherboards scattered around my room, but I just don’t have equipment suitable for desoldering BGA chips – otherwise I’d have had those parts already.

How exactly I’m going to do that?

I’ll need some kind of a board with ATMega – solely for expanding GPIOs, as well as getting normal PWM outputs and analog inputs. These, unfortunately, aren’t available on Pi but I’ll sure need them. I have an Arduino Nano – it’s just that it has broken FTDI chip, all pins desoldered and some traces damaged, but most of them are still fine =) This is necessary for the pulseoximeter to work, for example, as it does require analog input. See, I’m kind of tight on money now =) This explains why I have to suffice from what I currently have and not what I could have ordered from Adafruit/Farnell/DealExtreme/whatever. But I really want to finish this project, and my skills are good enough to get some things out of worthless electronic waste. Moreover, I have some projects that turned out not really good after all – but I can get some parts out of them. So – project will go on. After all, this is something I’ve dreamed about for, like, 1 or 2 years.

Size of my current prototype. Height of it is the same of two matchboxes =)

Size of my current prototype. Height of it is the same of two matchboxes =)

I’ll then have to strap this case onto my wrist using some kind of flexible textile band. As you can see, the case is kind of big. But I still like the idea of wearing it on my wrist. Why? I know, it’s bulky and such – but I plan on giving this project benefits that no smartphone currently has and really using this wearable PC, and I think any continuation of this project is not possible if I don’t use it in my daily life. That, of course, means wearing it on my wrist, no matter if it seems oversized. Later, when I get some money, I might make this smaller, but now I just have no possibility – remember, I’ll have to use what I got now 😉 But for now I’ll have to wear this bulky thing when it’s ready. After all, I could eventually come up with a solution to make a device even this size more prettier =)

As I’ll be using this outdoors, I also want this case to be waterproof. This sure will mean some testing of the closed case under the shower (imitating the rain that sometimes happens =) ) Probably I’ll also test it fully underwater – you know, things happen 😉 And I’ll definitely include some kind of device that’ll monitor if water got inside and notify me immediately, at least with LED on the case. A small circuit using, like, one transistor and an external battery has to be enough.

Yes, that's what I'm talking about. Contacts like that connect HDD controller with HDD head and don't let any air or water through them.

Yes, that’s what I’m talking about. Contacts like that connect HDD controller with HDD head and don’t let any air or water through them.

I’m not including WiFi, Geiger counter or NFC in the project yet, but I think I’ll need them sometimes. So – there has to be some kind of expansion possibility, while keeping everything inside the case waterproof. Way to go, pogopins and isolated contact groups from the broken HDDs! I have already got one contact group from HDD that seems promising, all that’s left is to cut a hole in the plastic and wire all the contacts.

Even though case is big – I probably won’t really be able to stuff just everything in it. 18650 cells will have to be somewhere else. I could put them into some kind of cell-shaped cases (probably an 18650 holder modified just a little bit and also made waterproof) and then attach them to the same band that will hold the case on my wrist. But both DC-DC converters will definitely be inside, along with all the other electronics, except those that will be added from time to time.



I’ll need options for debugging. For example, I’m going to take some magnet-controlled switches and glue them inside the case close to the side. One’d control RPi reset pins, and second would enable UART-Bluetooth converter which’d help to access serial console if everything gets broken. This will be some kind of a last chance tool so I don’t need it enabled all the time – the only drawback is in that there has to be a magnet with me all the time =)

MDSM-4R 12-18


The device will certainly act as a RGB flashlight. I’ve got two pieces of LED ribbon, both around 6 centimeters long – one is RGB and other’s just white. Will probably add a possibility to swap them or just use them together. I’d also like to mount a low-power laser, maybe on my index finger – I’ve already tried it and it felt awesome =)



Seems like I’ll be using SPI actively for various things, and each device on SPI interface needs its own CS line. So – there’s a need in SPI CS signal multiplexer. This can be done easily by using some IC like 74hc138, and adds many more chip select lines for connecting more devices to Pi =) But I’ll need to make a Python wrapper library for spidev library so that we can actually use those CS lines, and it’ll occupy 2 or 3 GPIO lines.


Click image to go to product page

I2C will be fine – it won’t need any multiplexing. However, there’s another problem – DS1307Z RTC I’m using is 5V-only, and this is not going to make Raspberry Pi happy. So I need a logic level shifter – and I’m going to get it from TI, as the IC they have is the best for this purpose but is hard to get in Latvia for reasonable price.



I also plan on making an I2C keyboard that will consist of keys placed on fingers of my left arm, the same arm I’ll be carrying my PC on. I want to experiment with this way of controlling the PC, that is – key matrix on the fingers. But I’ll surely need a GPIO expander for this, and I2C seems to be a way to go.

I might buy a camera board if I happen to get enough money, even though it’s not my top priority for now. I already have the plans on how to extend the wiring up to 1M without noticeable losses in signal – using USB cable for power, ground and I2C signals and a shielded Ethernet cable for 4 differential data pairs =) The camera will probably be shoulder-mounted for better field of view with some kind of servo turning it around.

Click image to go to product page

If it lasts, I’ll try to add a GSM modem – at first it’ll be just capable of sending message through some simple software, but then code might be added to enable voice calls. I just don’t feel like being ready to code voice call support, but I haven’t looked that much at it yet =)




I also will need some ICs to help my project. Those include some that I just can’t get in Latvia for any kind of reasonable price. Thus, I’ll need money to obtain them =) For example, I need following ICs from Texas Instruments:

  • TUSB2077APT USB hub – I’ll temporarily replace it with a GL805-based board and, probably, will make a breakout for GL805.
  • TPD4E001DCKR USB hub ESD protector
  • TCA9555 I2C GPIO expander
  • PCA9306 logical level shifter for I2C – but I’ll look out for a possibility to replace this with something.

They’ve refused to send them as samples as it’s not any kind of university or company project. So – gotta get this on my own =) Or, maybe, search for similar things at other companies.

Bigger! Way bigger!

Bigger! Way bigger!

As the PC probably need to be silent sometimes, I’ll equip it with a vibromotor, similar to those used in mobile phones, just a little bit bigger. It could be also helpful in waking me up =)  Also I’m not sure whether I’ll need loudspeakers integrated. I think I’ll mostly use either wired headphones or BT headset with this. And if I’d need to use loudspeakers with my wearable PC, I have battery-powered Nokia speakers. Also, integrated loudspeakers are hard to make waterproof – sad but true.



Not to mention that Pi has shitty PWM-driven audio output =) I’ll certainly be using my PC as a MP3 player, so I’ll need to add an audio card to it. Either USB or I2S, I don’t know which will be more affordable for me.

The last thing – all this will sure need its own RPi SD card image, maybe even recompiled kernel =) This image will for sure be public and I’ll probably even make instructions on how to embed those things into Raspbian.

All in all, each of these chapters will get an article on its own. I’ll be soon putting an article about DS1307Z PCB that is already made and show you a RTC module for this project – I just don’t have a normal board etched yet to show you. Other things will then follow as soon as I make them.


So, what are the requirements for me to make it?


  • Soldering iron, enough solder and flux, along with some more essentials – check.
  • Soldering heat gun – I have a possibility to use friend’s one so no worry about this, check
  • Hot glue gun – check
  • Dremel – check
  • Everything to make my own PCBs – check
  • Power supplies for substituting batteries while they’re not working yet – check

Programming languages:

  • Some Wiring language experience I got as a result of tinkering with Arduino before. Thus, it won’t be a problem to make firmware for Arduino as a GPIO expander.
  • Python – my language of choice, and it fits in the project as it has all the capabilities needed. I’ve already got some experience in writing more or less complex programs and it won’t be a problem to make usable and useful software for a wearable PC =)


  • Case – check
  • Raspberry Pi – check
  • Some pre-etched breadboards for prototyping – check
  • USB BT module – check
  • USB-UART module – check
  • BT-UART module – check
  • Magnetic switches – check
  • I2C RTC – PCB is not etched yet, but the layout is ready and I have all the parts
  • LED strips – check. Will need to remake them to work on 5V instead of 12V, though, or get a 5V-12V DC-DC.
  • USB hub with ESD protection – to buy from Texas Instruments
  • I2C GPIO expander – from TI, too
  • I2C level shifter – same
  • DS18B20 – check. Got like 3 of them already.
  • IR receiver/diode – check
  • ATTiny 2313 for multiplexer – check
  • Arduino – I don’t know whether mine is working now. If it isn’t, this part will be delayed.
  • 18650 cells with holder – not available yet. I know how to get decent cells here, though, so it’s a matter of money. I also know a person who’d buy the holders for me abroad, as they’re difficult to spot here.
  • DC-DC converters – not available for me yet, too. But I’ll soon make one using a LM2576 – just got one fixed for 5V and they seem easy to design a PCB for.
  • Nokia 3310 screens – I know a place where to search for those phones broken, and I’ll just get the screens by disassembling them.

Some cool battery hack lies beneath this image, click!


Note – I could get some 18650 cells from laptop batteries. The thing is that I don’t feel good about fiddling with lithium batteries as this easily gets dangerous – and I don’t want my arm to be torn off by an explosion, so I won’t be trying to get those cells for cheap.
I also have an idea for a temporary setup, not needing money. I happened to have 3 batteries of Asus EEE PC, a laptop I’m currently using. That means – 2 spare batteries, and they have just the same 18650 cells inside. So – I could find a way to wire EEE PC battery socket to the DC-DC regulators so that I could power the PC with the said batteries and charge them using my laptop, until I buy proper cells, holder and charger. After that, when I’ll need more custom solution, I’ll go for making something else =)

See, I want to build this PC as soon as it’ll be possible to but also make it functional enough to work, not to be just an additional weight for my arm. Therefore, I’m gonna make a prototype PC fast and then, as I get money, make it better step by step.

 What are the positive and negative sides of this project I can think of?


  • It’s completely open-source, excluding RPi GPU code, of course.
  • It’s the first project like that – no one has ever put anything like this in public.
  • There’ll be data about every step on my blog, or a substitute from other blog describing exactly the same part of my work.
  • Parts will be cheap – I just don’t have any other choice other than to pick cheap parts =)
  • It’s free from Google surveillance and things like that. With this PC, you control your privacy.
  • It’ll be really easy to modify it to suit your needs – to throw out something unnecessary or to add something that’s vital for you.
  • Almost everyone will be able to build one by spending some time working or, at least, to buy one instead =)


  • It does take some time and soldering skills to build a PC like that.
  • It’s big and bulky. At least, I haven’t found a good way to shrink it yet.
  • Everything that is planned will need to be coded, this will take time.
  • It’s not really suited for running a desktop environment on. You can have another Pi for development, though =) I’m using a laptop, so it’s fine for me. It won’t be any faster or slower than a Pi is, that’s it. I’ll certainly think about making a custom DE or modifying something already existent and lightweight.
  • It’s not developed by some kind of a company with resources. This is both good and bad thing. What’s bad is that if I fry some of the vital parts I have now (such as RPi), development will likely be delayed as I simply don’t have that much money.


I’ll be developing this anyway, as all the positive sides are just what I search for and all the negative sides don’t bother me that much. So – count on the project as a started, and I doubt there’d be any obstacles that’d divide me and this project… If only I don’t lose my prototype or it doesn’t fry itself due to being badly planned or MB due to my occasional clumsiness. Hope that won’t happen =)

Wearable PC project from Raspberry PI – preparation and idea

Raspberry Pi has been nearly anywhere – robots, desktop computers, laptops, control centers, HTPCs, control centers, game machines, bar tables, spy devices, web cameras – to be continued. But what about a wearable computer? Something I dream about? I haven’t seen some project that went public yet. Basically, nothing to be inspired from, than Pip-Boy =)

My favorite accessory from my favorite game. This does inspire, indeed!

And that’s OK, as long as the idea inspires me enough to write about it. Talking about Pip-Boy – that’s kinda of what I want my future wearable PC to look like. I want it to be placed the same way – on my arm, but I won’t be making it as big as Pip-Boy yet =) It has to have two 18650 cells inside, with the way to charge them. It also needs to have BT and USB hub inside, and, possibly, WiFi. I want it to be wireless yet reliable so some crucial communications will be wired. Talking about communications…

What could this PC have as a display? There’s no such a thing as “cheap yet good display for RPi”. SPI screens are slow to refresh. Composite video screens don’t have any much quality of image, also, the resolution is limited. HDMI screens are expensive and hard to find. Those DSI-connected screens simply do not exist. Given that my money is limited, I’ll now have to choose between composite video and SPI… And at the moment I choose neither. I think I can live without a screen for a while =) I had an old idea of hanging three Nokia 3310 screens to the SPI port of either RPi or Arduino as a helper module. I still have it and I like it – there is a place for them on my sketch I have in mind. They’d be showing time, date, status of various wearable PC additions and possibly would have some controls to make a simple menu using them. This is much more easier and less expensive, even though requires some soldering 😉

Yes, that simple. And 3310 are just soooo easy to get 😉

So – what’s RPi lacking from a perfect wearable PC base? Well, Model B with its 512MB of RAM seems good, but…
Small size and energy consumption seem to be the problem. What’s about size?
Even though we can’t change the board’s length or width, we can change height. There are some connectors that can easily be removed, and we can use pins to connect something to RPI instead. For example, we could replace the double USB connector with 2 groups of 4 pins – both replacing each 4 contacts of each one of two USB ports. For RCA jack, there’s only two pins. For audio – 5, but it seems that 2 of them are useless, so let’s say – 3. Ethernet jack? Well, I suppose I don’t really need Ethernet on my wearable computer, MB I could bring USB-Ethernet card with me just in case, but that seems an overkill even for debugging. So Ethernet jack stays somewhere else in my drawer 😉 I won’t be removing neither HDMI not CSI/DSI as they’re OK and don’t enlarge size that much, also, they will be used sometimes.

This photo shows what Pi looks like with connectors desoldered. Also, click to go to this project page =)

OK, something is clear about the size. What about the energy consumption? Well, there are three things on the board that consume energy.

That does look terrifying if you think about how much energy is wasted =(

First is the CPU. We can’t do much about it, though, except underclocking. The best we can do is to cool it down. I think heatsink really has to be in my wearable computer – just for the stability 😉 So – I’ll have to have a heatsink on CPU. I’m not sure how this will improve power consumption, though, but it will definitely make a job easier for the CPU. Second is USB hub&USB-Ethernet chip. Well, I personally think we can remove it without a doubt. Why? First of all, it’s laggy sometimes, some users still report driver problems regarding exactly USB-Ethernet, as I’ve seen on forums. Also, I won’t be needing Ethernet, remember? So I think it’s better to have the possibility of choosing whether I want USB hub enabled or not, and thus have better power management. You see, you can turn off external hub – but with internal it’s not that easy. Also, it freakin’ heats up =) So – I’ll also have to remove this SMSC chip. Third part is 5V-3.3V regulator. It’s linear, so it heats up, too. Also, I think I’ll need much more current on 3.3V line than this regulator can provide, so I think I’ll be replacing it with something else. Some guys did replace it with a switching regulator, I think I’ll do the same.

So – remove the linear regulator.
Also, speaking about the power – will have to think about whether this MicroUSB port with the corresponding capacitor and fuse are really necessary. Given that I’m likely to power everything through GPIO header, I think they aren’t.

Okay, I can now imagine the board without all those large connectors. The only things that remain are: GPIO headers, USB/audio/RCA headers, reset header, HDMI/CSI/DSI connectors and the CPU. It just seems like an Arduino now, having some pins we can plug a shield onto. And we will. I think that RPi is to be like a processor shield for my wearable computer, and we have to plug this processor shield into an expansion board. What’s this expansion board? First of all, something that will be connected to all the GPIO pins of the RPI. So – in the base there must be a PCB with sockets for GPIO pins and stuff. It should expose USB/RCA/audio connections, too. Then, we have to have some kind of USB hub there. I think it won’t be hard to make a hub directly on this PCB.
Like, we have chips like GL805, which have accessible specifications, and they don’t require that much of components to work, and what’s most important – they’re in every second Chinese USB hub. Even though they are, indeed, consuming around 100mA even when idle – it’s something for the start, later on we can grab something from TI to ensure power efficiency.
On this PB, I also plan putting BT and WiFi modules. I’ve seen WiFi modules for, like, 6-7EUR each, that had good Linux compatibility and could be soldered directly onto PCB with pads prepared for that.

Click on this to go to product page

Will have to find BT modules like that, though – BT is my concern as I feel I’ll be using it actively.
sample design pics here
Also, I’ll certainly have an IR sensor and IR LED on this PCB, along with some DS18B20’s and MB other stuff that I could develop on. See, as it is a wearable computer, some of temperature sensors are certainly going to be stuffed under the clothes to log the temperature of my body with 0,01 Celsius grade precision. Pulsoximeter will follow this shortly after that, and I definitely will add something more 😉 One more thought for this device – it could be the thing that registers when I fall asleep, just to turn off the lights and lock my PC so that nobody will blame me for leaving lights on and PC working =)

I could think of many usages, like a mobile phone/PDA replacement, audio player and stuff like that – the problem is I haven’t started actually working yet. I don’t even know if the RPi I’m holding in front of me right now is in a working condition – I occasionally threw it in my school bag and it got some minor injuries there, none of those look critical but there might be some critical ones that just can’t be seen easily. So – the whole project depends on whether mine RPi is working. I’ll provide updates when I have them =)

This is real… But inside there’s just a music player. Gotta fix that in my edition 😉

Gotta go and strip ALL the connectors off!

And no, it’s not an April Fools joke – updates are to be coming soon 😉