Sunday, June 30, 2013

USB Custom Hardware Interface for Unity3D

This is a simple project to demonstrate the USB custom hardware interfacing with Unity3D game engine on top of Microsoft Windows operating system(s).

The custom hardware unit used in this demo is build around Microchip’s PIC18F2550 MCU. This custom USB controller consists with 4 push buttons and linear potentiometer. In supplied demo user needs to control aircraft with those buttons and potentiometer. According to the game logic 4 buttons are used to control the flying direction and flying angle of the aircraft and potentiometer is used to control the speed of the aircraft.


System's host environment consists with 2 main applications such as Session Controller and Unity3D game. Session Controller is responsible for USB communication and data conversions. It’s a native application written using Delphi and it gets started with Unity game project. Communication between Session controller and Unity game project is happening through OS level shared memory location. In this demo both Session Controller and Unity game project are heavily depends on Windows API functions, and also both the applications requires administrative privileges to execute.

Screen capture of custom hardware controller game

In this demo project MCU firmware is developed using MikroC PRO 5.0. Session controller is developed using Embarcadero Delphi XE3 and all the Unity scripts are in C# style. HID interface of this project is based around J.W. Beunder’s Delphi HID library.

USB controller schematic

The supplied PCB design of this project is based on commonly available SMD components. Please note that this hardware setup is quiet sensitive to external noises, so it is recommended to use some properly grounded shield with this controller. If USB connection between host and the controller is more than 1.5m, it is advisable to use USB cable with ferrite bead(s).

All the source codes and design documents of this project are available to download at github.com/dilshan/unityusb. Source codes of this project are released under the terms of MIT License. Design documents of this project are released under the terms of CC BY 3.0.

Tuesday, June 18, 2013

Classical Brute Force Attacker for Sudoku Puzzles

In this post we introduce brute force attacker for Sudoku puzzles. In title we say "classical" because it operates in a traditional "dictionary base" style. This terminal application is design and tested on Linux base systems and it can capable to solve any symmetrical Sudoku puzzle up to dimension of 9×9.

The primary objective of this application is to get some performance readings on some x64 configurations and initial version may not support external maps. Later I extend it to support with user defined maps and now it can handle up to 9×9 data matrix with at least one known value. The attack database (dictionary) is based on text-files with sequential access controller and it helps to reduce to main "system memory" consumption.

Working order of Brute Force Attacker

The performance of this application is based on system architecture (especially with RAM and auxiliary storage architecture), process configuration (such as process priority, memory allocations, etc.) and with number of unknowns and there distribution in the given map.

This application is available to download in here with full source code and it release under the terms of MIT Licenses. Please note that the bundled binary file in this archive is compatible with x86-64bit Linux systems only.

Thursday, June 6, 2013

Smart Audio Box

Smart Audio Box (SAB) is microprocessor controlled audio switch and amplifier system, which is specifically design for audio composers and for audio engineers. SAB consist of 4 high impedance stereo inputs and two output modes. One output mode can drive stereo headphone/earphone and other output mode can drive pair of 8W speakers. In prototyping stages we identify those modes as "Personal Mode" (headphone output) and "Audience Mode" (power amplifier output).

Another main feature of this system is its programmable 16 step attenuation controller. This attenuation controller helps to control the audio output level of each output-mode.

Prototyping version of Smart Audio Box

The main component of SAB system is ATmega8 MCU, other than that headphone amplifier is design around NJM4556 high current operational amplifier and power amplifier is based on TDA1521A.

To operate, this system requires 2 power sources. Microcontroller, ADC interfaces and CMOS logic-switches requires 5V - 2A, single rail DC input. Both the output stages are design to driven by a 12V ~ 13.5V - 1.5A symmetrical power supply.

User interface of SAB system consist of 5 push buttons (S1 to S5) and 5 L.E.Ds (LED1 to LED5). S1 switch is use to toggle the output mode between power amplifier and headphone driver. S2 and S3 are profile selection switches. S4 is "manual" input channel selector and S5 is "automatic, sensor driven" input channel selector. 4 L.E.Ds are use to indicate the active input channel and remaining L.E.D indicate power status of the system.

This SAB system is design as an open hardware project. Its design files and schematics are available to download at here. ATMega8 firmware source code is released under the terms of GNU GPL version 3.0 and all the design documents are released under the terms of GNU FDL.