Logitech Performance MX Middle switch

Just a heads up in case anyone else’s Logitech Performance MX starts acting up on the middle mouse button: The switch used is an E-Switch TL3315NF160Q.

Apparently sometimes a drop of hot-glue is enough, but in my case the switch itself was broken. The linked tutorial does give clear instructions on how to reach it though. If you’re handy with a hot-air gun, it’s easily replaced 🙂

96×48 full-color LED Matrix

LED Panels

A few years ago I built a red-only 32 pixels high, 96 pixels wide LED Matrix, and due to all the positive responses I sought out to do it again the year after with a bigger better matrix. I did some research into affordable solutions, and as usual ended up with Chinese vendors. I got my hands on about 10 32×16 RGB LED panels with a 1cm pixel pitch, and a HUB75 connection, quite similar to the ADAFruit 32×16 matrix. ADAFruit had a bunch of information on them, and there are several other places where they’re being used, so I figured I’d give it a shot. I even bought a Digilent Basys 2 FPGA development board, as these boards are apparently best driven by an FPGA, and I was willing to pick that up.

However, when I started working on it initially, I found out that the Basys 2 did not even have enough memory for 24-bit color, and with my microcontroller of choice at that moment (TI Stellaris) I did not get more than 16-bit color without flickering. While the panels looked fun, with 16-bit color everything still looked very basic, and very limited. Definitely not the neat full-color panels I had in mind. I figured I’d either have to shell out for a much more expensive FPGA, or buy one of the purpose-built LED drivers from china, both of which were out of my budget for this project. The panels disappeared in a box somewhere, only to be stumbled upon at least 2 year later.
Continue reading 96×48 full-color LED Matrix

Flashing the ODROID-U2’s eMMC card without a reader

Why?

In the quest for the ideal XBMC set-top box, I’ve bought an ODROID-U2. It’s a small devboard with an Exynos 4412 quad-core Cortex-A9 processor. Pretty much the same chipset as the Samsung Galaxy S3 or the Note 2, which should be more than enough to power XBMC I figured. (Note: At this point it doesn’t run XBMC flawless yet, the menus work great and much faster than on the RPi or the Pivos XIOS DS, 720p content seems to work fine, but 1080 still stutters a bit. However, that’ll supposedly get fixed once XBMC upgrades to multi-core ffmpeg or the video decoder will be implemented)

While the ODROID will boot from MicroSD perfectly, there’s another option called eMMC that is supposedly much faster. If you buy it from them, it’ll include a small converter to microSD so you can flash it with a computer. However, as it turns out this converter is absolute garbage. it’s too big to fit into a regular uSD-SD converter, and even after I filed it down to the appropriate size, it still didn’t work.

So I had this nice box, with Android 4.0 pre-installed, but the one method to upgrade was broken.

Luckily, there’s another way to upgrade by booting to Ubuntu from a microSD card, and access the eMMC module on-board from there. I’ll detail how I did it here.

Continue reading Flashing the ODROID-U2’s eMMC card without a reader

OpenELEC on the Asus AT5IONT-I with sound over HDMI

For the past couple of months I’ve been running XBMC on a Windows 7 installation. Worked pretty much instantly after installing, but the boot times were horrible, and every now and then windows updates would nag. When I bought the box I briefly tried XBMCBuntu, but concluded that it was too much tinkering to get it working and gave up.

However, today I set out to give OpenELEC a try. Almost everything worked out of the box, except for audio over HDMI. I’ve tried most of the things on the wiki, but couldn’t get it to work in both the video as well as the XBMC menu. Most people seem to be satisfied with just the video, often calling the XBMC menu sounds “obnoxious”, but I’m rather fond of those, so I set out to fix it.

Here’s a quick guide on what I did.

Continue reading OpenELEC on the Asus AT5IONT-I with sound over HDMI

Dx.com’s Multi-Function 4WD Arduino Robot Car Kit

While browsing through DX.com’s new arrivals section, I stumbled upon this package:

Multi-Function 4WD Arduino Robot Car Kits

Seeing as I still had a bet with a friend to, at some point in our lives, do a real-life Robot Wars, I figured I’d give it a shot. It just got in a few days ago, so I figured I’d write a quick review. Continue reading Dx.com’s Multi-Function 4WD Arduino Robot Car Kit

Digital Addressable LED-strips

About a year ago, I ordered a few WS2801-type addressable RGB LED strips, and have been very happy with them since. Today I was curious how much they cost nowadays, and if anything new was out in China. It appears that a lot has changed since the last time I looked. Back then there were a few different chips, but the WS2801 was the only one doing 8-bit PWM, now there’s even a chip doing 12-bit PWM! However, it also appears that the protocol that was used back then (basic two-wire SPI) has been replaced by single-wire protocols requiring precise timing.

Seeing as there’s just too much choice and the information is scattered all over the place, I figured I’d do a summary of all I could find. Unfortunately I haven’t been able to actually get engineering samples of any of these strips, but I’m hoping that I can still compile a summary using only the datasheets. So here goes in alphabetical order! Continue reading Digital Addressable LED-strips

Turning a JY-MCU 3208 into something useful

During a recent impulse-buy at DealExtreme I added the following two items to my cart:

I intended to just play around with it, with no particular purpose in mind. However, I’ve recently been asked to bake up a clock-like display, and figured I could use these two for that purpose. This post will be the first in a series detailing what I’m doing with it, and how I’ve done so. The first post will focus on what the boards contain, where to get information, and a small summary of some of my plans.

JY-MCU 3208 Lattice Clock summary

First the JY-MCU 3208 Lattice Clock. Basically it’s just a little development board that comes out of the box with:

  • An ATMega8L clocked at 1MHz, but able to be clocked to 2MHz, 4MHz, or 8MHz
  • An external crystal of 32.768KHz intended for timekeeping, wired to TOSC1 (PB6) and TOSC2 (PB7)
  • 4 8×8 LED-arrays with red LEDs. Apparently it also houses green LEDS, but those have not been wired. You could, however, reuse these panels in a different project and use green too.
  • A HT1632C-chip to drive those LED arrays.
  • An AVR 10-pin ISP header that’ll plug right into most AVR-programmers, and features the TX and RX pins brought out to two of the ground pins.
  • A cylindrical powerjack-receptacle, with what appears to be an outside diameter of 5.5mm, 9.5m length, and an unknown inside diameter. All plugs I had of 5.5mm OD seemed to fit, so I’m not sure. (Maybe someone with an advanced caliper can confirm this?)

Apart from that it comes with solder-pads for a lot more components that you can solder on manually:

  • Two different Real-time clock chip designs, complete with backup battery (either a Maxim DS1302, or an RX-8325NB + RX-8025SA, both with a CR927 battery or battery holder)
  • A digital thermometer (Maxim 18B20)
  • A speaker
  • An LED wired in such a way that it can be used as a light sensor
  • A Mini-USB plug wired properly to be used with firmware libraries like V-USB
  • An IR-receiver

The factory firmware is basically a clock, but it’s highly inaccurate, and loses it’s time whenever it loses power. Even though it’s a nice demo, I think the real power of this board comes from the fact that you can write your own firmware and the PCB contains traces and solder-pads for virtually anything you’d want to make with a 32×8 display like this. Out of the box you could use it to receive data from the UART TX/RX pins and put that on the screen, which would make a nice display for something like an arduino, if you add extra components you could make a clock, a USB display, thermometer, or anything else you can come up with that uses a combination of the things listed above.

JY-MCU LM1640 summary

This one is a bit simpler. Out of the box, it’s just 4 4-digit 8-segment displays with a TM1640 chip to drive them. However, here too there’s room for more!

There’s solder-pads available for something like an ATTiny25/45/85 chip, with the option of removing two resistors so the TM1640 is connected to 2 output pins of the ATTiny, and the normal DIN and SCLK inputs will then wire to the ATTiny’s DI/DO pins, allowing for something like serial communication.

On top of that it allows you to place two push buttons directly wired to the ATTiny in case you’d like to run it standalone.

Stand-alone it’s nice for a display on any microcontroller/arduino project. With the ATTiny, you can write up an easier protocol, or even have it running as a standalone display.

My plans

My current plan is to create a clock, with the LM1640 used as an extra display to show, for example, the year, month, and day. I also plan to add an USB option so that you can synchronize the time with a computer, and possibly use the displays directly from the PC.

For this I’ll be adding the DS1302 RTC chip, and adding all the needed components for a USB connection.

Next post

The next post will feature all the datasheets and other manuals I can find, and will detail how I’d like to wire things up, what components I’ll be needing 🙂

Getting my Raspberry Pi set up for high-speed serial UART communication

I bought a Raspberry Pi to work together with my rooms moodlight. The current system uses an FTDI USB to RS485 converter cable with a full-blown linux PC pushing 1Mbps of data over that to drive the animations. I intended to replace that system with a Raspberry, seeing as it already has a UART on-board and would only need a small RS485 chip to drive the bus.
Unfortunately, out of the box the Raspberrys UART can only push 115200baud, and it spits out a shitload of debug data on the serial lines.
Here’s what I did to allow it to use the UART for other things, and to drive the UART at 1Mbps 🙂

The limiting factor on the UART speed is that UART Clock. It only allows baudrates of UART_CLK/16, and the clock is set to 3Mhz by default, limiting it to 187500baud. To drive 1Mbps, we need a UART-clock of at least 16Mhz. To do this we need to:

This should then allow you to set the baudrate higher, to test run ‘sudo stty -F /dev/ttyAMA0 1000000’. If that runs without problems, it’s probably OK. You can test some more with ‘sudo bash’, and then ‘echo  BOO > /dev/ttyAMA0’ and see if an attached FTDI device picks it up at 1Mbps.

Next up is making sure nothing else is using the serial line.

Done! Now all that’s left is writing code to actually push something over that line and wire up a small rs485 chip 🙂

On Minecraft Mods

Introduction

I’ve been running a Bukkit Minecraft server for my friends and I, and recently someone insisted we try out Tekkit instead. Tekkit is a combination of several mods like BuildCraft, IndustrialCraft, and some others, running on a Bukkit 1.1 server. Seeing as Minecraft had become pretty stale for me, all these mods were a welcomed extension. Especially considering they took out most of the grinding of the vanilla game (e.g. constantly having to manually chop wood), I’d come to love all the mods in the Tekkit pack.

However, one problem with the Tekkit pack is that it’s horribly outdated, and most of the mods are pretty buggy, even though most of those bugs have been fixed by newer versions. Being unhappy with this state, I set out to look for updated mods and stumbled upon a few problems:

  • Most mods are incompatible with Bukkit.
  • Most mods are specifically tailored for a specific version of minecraft.
  • Most mods are not updated to the newest version of minecraft at all.
  • Combine the two before, and you see that even though there’s a newer version of mod A, you’re still stuck with an old one because mod B forces you to use an older version of minecraft.

Luckily there is a team at mcportcentral that tries to port all the mods to Bukkit and thus solves most of my problems, but the whole infrastructure of mods is pretty horrible 🙁

The compatibility problem: Obfuscation

From what I’ve gathered this far, the main problem is Minecraft’s obfuscation, and the fact that different teams are using different deobfuscation keys.

The version bit comes down to the fact that each version of minecraft is obfuscated differently, and as such the HelloWorld class might’ve been called a in version 0.1, but is now called b in version 0.2. If a mod depended on the HelloWorld class, and as such was compiled against the a class in v0.1, it will fail on v0.2 because that class is now called b. Even if nothing actually changed in the HelloWorld class, and even though the mod should remain mostly compatible, the obfuscation breaks everything.

The problem gets even worse when there are different deobfuscation keys being used. For example, let’s look at Minecraft Coder Pack (MCP) and CraftBukkit. The first will decompile and deobfuscate a Minecraft jar file, and spit out the source code and possibly a deobfuscated jar file. CraftBukkit is an already decompiled and deobfuscated version of the server, with some extra changes to allow for the Bukkit API. Both are, however, using a different deobfuscation key. So let’s say we have the HelloWorld class again. MCP could deobfuscate this to OhHaiWorld, whereas CraftBukkit might have deobfuscated it as WelcomeWorld.

So let’s say that instead of writing my mod for the vanilla minecraft server, I pick a deobfuscated one because it will allow me to keep it easily updated. (Note: this is what most modders do, but they re-obfuscate it with release so it’s easier to apply for normal users).Even though it’ll now probably work on Minecraft 1.2.1, 1.2.3, and 1.2.5 (provided the user deobfuscates first), it will still not work on both CraftBukkit and the Vanilla server.

Combination problem: Overwriting files

Another problem in the actual modding is that often you need to intercept parts of Minecraft, or change bits of it. Usually this is done by simply changing some of the Minecraft classes. The problem is that you can’t combine two mods that modify the same class, and if you’re using a different brand of server (e.g. CraftBukkit) that already had several changes in that class you can’t use a mod that modifies it too as it will undo the changes in that specific brand server.

Solutions

Luckily, there are a few solutions available, although most include a shitload of manual work too.

For example to manually port a mod from 1.2.3 to 1.2.5, you could get the MCP for 1.2.3, deobfuscate the mod, then get the MCP for 1.2.5 and reobfuscate it. If it doesn’t actually overwrite any of Minecraft’s files (e.g. it’s using something like Forge or ModLoader(MP) to do the actual hooks in minecraft’s code), this should be enough. If it does overwrite files, you should compare the (decompiled and deobfuscated) changes from the vanilla 1.2.3 server, and reapply those changes in the 1.2.5 server manually.

Porting a mod from vanilla to CraftBukkit usually involves more work. Maeyanie luckily keeps a list of name changes from MCPs deobfuscation key to Bukkit’s deobfuscation key which you can use to automate a part of the work. However, as CraftBukkit usually entails a lot of changes from the vanilla server, you still need to manually sift through any changes to Minecraft’s code. If the mod only adds files and uses Forge or something, that won’t be a lot of work, however if you’re porting Forge itself, you’re up for a lot of manual comparing and coding.

My involvement

I’m hoping to get more involved in the minecraft, and mostly CraftBukkit and Forge, mod scene at some point. I’ve got several ideas to try to automate more of the porting process, even though I’m not sure if I have the time to implement them all. Feel free to keep track of this blog for any future work on this.

Also, if there’s anything unclear, plainly wrong, or confusing, do feel free to use the comment field or contact me through other means 🙂