Tuesday, December 24, 2013

DIY 3W constant current LED driver

This is quick post about 3W constant current LED driver which I was design to combine with some homemade furniture piece. The main components of this system is LM311 voltage comparator and IRF9540 P-Channel MOSFET.


Schematic of 3W LED driver module

This module is design to drive maximum of two 3W high power LEDs and it requires 8V - 10V DC (500mA) power source. In this given configuration this module may not need any heat-sink (for IRF9540) and consume maximum of 500mA of power.

Breadboard version of 3W LED driver

At prototyping stages we test this module using 9V DC (1A) power supply with two 3W LEDs (EDEX-3LA1-E1). I developed final version of this module using piece of strip-board and PCB design is not done.

Thursday, December 5, 2013

ParseGen - parser generator for FPC

ParseGen is rule driven, parser generator for FPC / Lazarus. ParseGen is design using FPC, FCL and Lazarus and it mainly supports for Windows and Linux operating systems.

ParserGen scanner is slight DFA (deterministic finite automaton) state machine. This scanner can operate on case sensitive or case-insensitive modes and it can easily configure/extend through given class structure. The parser of the ParseGen is recursive descent parser. ParseGen generate this parser using high-level source language and this language is logically similar to EBNF grammar. For example, in ParseGen, definition for "term" and "expression" can be written like this:

define: expression

  optional: "-","+"
  end       

  term       
  loop: "-","+"
    term
  end
 

end

define: term

  factor
  loop: "*","/"
    factor
  end
 
end

This parser generator is mainly design for  FPC / Lazarus, but it can use with Delphi with some minor changes. ParseGen is an open source software project and it is based on GNU General Public License version 3.

Most of the sample scripts and demo applications of this project are based on Niklaus Writh's Algorithms + Data Structures = Programs book and PL/0 programming language. In demo project we implement Writh's PL/0 parser using ParseGen and it is available in main project bundle.

ParseGen is available to download at github.com/dilshan/parsegen and documentation for source language is available in here.

Tuesday, November 19, 2013

microTone Module - Simple Analog Hardware Interface

microTone Module is analog interface to connect microcontrollers or digital logic systems with PCs. This interface use PC sound card’s audio output terminal to send commands to external hardware systems.

microTone Module is an open source project and all its software source codes and hardware designs are available to download at sourceforge.net/p/microtone. All the compiled software and source codes of this project are distributed under the terms of GNU Lesser General Public License. Hardware design and other documents are distributed under the terms of Creative Commons Attribution-ShareAlike 3.0 Unported License.

Software library of microTone Module is a Win32 DLL and it can use with any programming language which allows interface with dynamic link libraries (e.g: C++, C#, Python, Java, Delphi, Visual Basic, etc.) Some wrappers for this DLL are already implemented and available to download at microTone Module sourceforge.net code repository. And also if you implement or improve microTone Module wrappers please share them with the community.

Documentation and other related information about microTone Module are available at microTone Module wiki at sourceforge.net.

microTone Module processing hardware unit is consist with well known CM8870 DTMF decoder and PIC16F628A microcontroller. Technically processing section of microTone Module can be implementing using most of the microcontrollers in the market and if you do so please share your designs, comments and firmware with the community.

Saturday, October 26, 2013

Centralize power switch for PC arrays with power failure monitor

UPS system is a common peripheral in computer field. Now most of these UPSs are equipped with USB driven system shutdown software. But some of the cheap UPS system may not have software controlled PC shutdown systems and some of them had some limitations too (for example operating system compatibility issues, supporting for multiple nodes, etc.).

In this post we design power failure monitor with centralize power switch for array of PCs. Using this system administrators can turn on multiple PCs with single button press and all of these PCs get power down automatically at power failure. To reduce cross platform issues we design this interface to work with main-board power switch and because of this administrators may not need any special software for this system. Most important point of this system is its independence with UPS hardware.

Prototype of centralize power switch project

Main controller of this system is PIC10F200 - 8bit microcontroller. Thanks to its SOT-23 package we can limit this system into 86mm × 58mm PCB. This supplied PCB design is based on SMD parts but this can be build using non SMD parts also.

At the testing stages we test this with both Linux and Windows operating systems. Configuration steps for each operating system are available at here.

This module is support up to 8 PC nodes and this can be extent into more nodes by adding counters (4017) and CMOS switches (4066) to the system.

This project is distributed as an open hardware project.  Control firmware of this project is distributed under the terms of MIT license and schematic and other design are distributed under the terms of Creative Commons Attribution 3.0 Unported License. All the project content is available to download at elect.wikispaces.com.

Sunday, October 13, 2013

LMD18245 base Microstep Motor Driver

This article describe the LMD18245 and PIC16F877A base 16 step bipolar stepper motor driver which is design to work with 12V 18º bipolar stepper motors. In this design we use pair of LMD18245 DMOS full bridge motor drivers to control 2 phases of the stepper motor and PIC16F877A MCU is used as controller.

We test this driver with several stepper motors (including 1.8º - 12V stepper motors) and all of them provide excellent smooth output with this driver. The supplied firmware of this driver is design for 16 micro-steps but it can be easily change to full-step, half-step, 8, 32 or 40 micro-steps.


In this given design LMD18245 current sense resistor is calculated for 200mA and it can be extend to 3A by changing the value of R2 and R4 resistors. For more information refer the LMD18245 datasheet.

This project is released as open hardware project. Firmware of this project is released under the terms of MIT License and schematic is released under the terms of Creative Commons Attribution 3.0 Unported License. All the project schematics and firmware source codes (including compiled binaries) are available to download at elect.wikispaces.com.

Sunday, September 29, 2013

USB Random Number Generator

This project is about USB port base true hardware random number generator and it is design around the avalanche noise which occurred in reversed biased P-N junction.

This random number generator is design using commonly available electronic components. The core component of this system is Microchip’s PIC18F2550 microcontroller. The noise source is 2N3904 (Q1) transistor and LM386 low voltage power amplifier is used to amplify the incoming noise signals. This peripheral is design to work as a self-powered USB HID device.

Cumulative distribution graph of random number sample

In this design we use 2N3904 as a noise source because it give more noise amplitude than any another transistors which we tested. Theoretically this transistor (Q1) can be replaced with any other suitable NPN transistor like BC548, BC107, 2SC945, etc.

The control software of this system is available for Linux and it’s compiled as x86 - 32bit binary file. This controller application required libusb driver and it can be obtain from www.libusb.org. This application is working with command line parameters (e.g: sudo ./randgen 500) or through interactive user inputs (e.g: sudo ./randgen).

The valid output range of this random number generator is around 10000 to 41000. This output range is fixed and its linear distribution graph is available with the project package.

This USB random number generator is design as an open hardware project and its schematics, software source codes and detail documentation are available at elect.wikispaces.com.

Tuesday, August 27, 2013

Microprocessor Controlled 16 Line Connectivity Tester

This is an ATmega32 based Proteus simulation of 16 line connectivity tester. I mainly did this project to get familiar with the new Proteus 8 simulator (mainly the new Proteus  - ISIS module).

The main functionality of this system is to detect open and short circuits in cables and connectors. This system can test maximum of 16 lines in each test cycle and it indicate the defective line(s) through LCD. This is customizable system and user can configure number of test lines through single push button (SW1).

The ATmega32 firmware is developed using WinAVR toolset and it design to work with both simulation and real modes.

Schematic of 16 Line Connectivity Tester

I never test this system with real parts. If someone interested about real implementation make sure to change RN1 and RN2 to 22K and diode array with 16 - 1N4148 diodes. Recommended supply voltage for this system is 5V DC.

This is an open hardware Project and this work is licensed under the Creative Commons Attribution 3.0 Unported License. The complete schematics and project files are available to download at elect.wikispaces.com.

Sunday, July 21, 2013

Simple High Bright LED Night Light with Dimmer

This is an easy to build "high-bright LED" night light, which I was design and developed in weekend to replace my existing 5W (filament base) night lamp. 

This circuit is mainly based around TL494 PWM driver IC and LM350 - 3A adjustable voltage regulator. The LED used in this project is 9V - 10W high bright LED and this given design is capable to drive maximum of six, 10W LEDs.

Microscopic view of 10W High Bright LED with controlled input

This unit is design to work with 12V to 30V DC power supply and it can withstand for voltage fluctuation around 12V to 35V.

The schematic of this unit is available at upvater.com under the terms of CERN OSH 1.1 License.

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.

Friday, May 24, 2013

Easy to Build Adjustable Dual-Rail PSU

Adjustable dual-rail power supply is an essential utility for analog electronic experiments. In this post we illustrate extremely simple, adjustable dual-rail power supply using LM317 and LM337 voltage regulators ICs. This PSU delivers 2A ±1.35V to ±18.5V output and thanks to 3 turn linear potentiometers output can be adjustable up to 2nd decimal point.

Wiring diagram of dual-rail PSU

The PCB of the PSU is simple to design and compact (65mm × 50mm). Both LM317 and LM337 need at least 60mm × 55mm or larger heat sinks (and both of these heat sinks need to be electrically isolated).

The PCB and schematic of this PSU is available to download at here.

Saturday, April 20, 2013

Command-line driven Intel HEX file decoder

Intel HEX is an open file format to save machine code data. Today lot of compilers and EEPROM/Microcontroller programmers support for this file format as de facto standard.

hex2file is a lightweight, command-line driven application to view and convert Intel HEX files into other file formats. I developed this application as a supporting utility for our on-going compiler/virtual machine projects. This utility supports four output formats which include CSV, plain- text, binary and numerical-text.

hex2file standard numerical output in screen mode

hex2file is an open source - free software and its available for both Linux and Windows operating systems. The latest version of hex2file utility is available to download at sourceforge.net – hex2file project page. The more details including project documentation are available at hex2file.sourceforge.net.

Sunday, April 14, 2013

Electronically Controlled Nichrome-Wire Cutter

Nichrome-Wire Cutter is an essential tool for model aircraft constructions. We mainly use Nichrome-Wire Cutters to fabricate model aircraft wing assemblies, other than that Nichrom-Wire Cutters are used to cut wax, polystyrene materials and other similar kind of materials.

In this project we construct electronically Controlled Nichrome-Wire Cutter. The main feature of this cutter is its (non mechanical) variable temperature controller. The temperature of the Nichrome-Wire is controlled using TL494 PWM controller. In this design TL494 is oscillated with fixed frequency and only varying factor is its duty cycle, in this given design R2 is used to control the duty cycle of the frequency.

Duty cycle variation with R2 potentiometer

This Nichrome-Wire Cutter requires 8V to 20V – 3A DC power source and 16.5V – 3A is recommended supply for this system. When constructing this system makes sure to solder and connect all the components properly, improper connections may cause oscillations and instabilities in output.

Recommended wire for this system is 1m of 24 S.W.G Nichrome-wire (generally with mix of 60% nickel, 16% chromium, 24% iron) with approximately 6Ω resistance. When constructing this system take special care about this Nichrome-wire. Improper wiring/mounting may cause severe burns, fire and/or permanent damage to the equipments.

The schematic, PCB and all the other materials related to this project are available to download at elect.wikispaces.com under the terms of Creative Commons - Attribution 3.0 Unported license.

Wednesday, March 27, 2013

Refurbish C64 Power Supply Unit

This is a quick post regarding my Commodore64 Power Supply restoration. This C64 is my first computer and two days back its power supply get burn because of some short circuit in its output connector. This is a first time I open this C64 PSU and its internal circuitry is really simple to track down.

Commodore64 Power Supply Unit

Main component of this PSU is its 6 terminal step-down transformer. Other than that its circuit it limited to 2 rectifier diodes, 7805 positive voltage regulator, 2 - 1W resistors and 4700µF/16V electrolytic capacitor.
In my C64 PSU, defective component is 7805 voltage regulator, once I replace it and rewire the output terminal its starts to work again (like good old days).

Commodore64 Power Supply Schematic

Above diagram illustrate the schematic of my C64 PSU (which I was traced using original PCB). The high resolution images of PSU, are available at my flickr photo collection.

Saturday, March 23, 2013

DIY Liquid Level Monitor and Automatic Control System

This is an easy to build "liquid level monitor" and "automatic control system". This control system is mainly based on Microchip’s PIC16F630 8bit MCU and few combinatorial logic ICs. This system is specifically design for industries where there is a requirement of maintaining a liquid level at a particular level. The level monitoring stage of this system can capable to sense up-to 8 liquid levels and its trigger point can be programmed at anytime by using its simple 2 button user-interface.

This system is design to work with 12V (or maximum of 25V) DC power source and its sensor system is capable of sensing liquids with resistance of up-to 30k to 35k. To minimize the sensor noise and output instability, the control software is equipped with simple 20-tap FIR like filter system.

The output stage of this system is design to work with 12V to 24V DC relays and it is recommended to use Tyco K10 series or similar kind of relay with this system.

The trigger point of this system is easy to define and it can be done by using S1 and S2 tactile switches. Once user press the S1 (MODE) switch the system enters into programming mode (and that stage trigger point LED starts to get blink), after that user can select desired trigger point by pressing the S2 (SELECT) switch continuously. Once new trigger point is set user can leave the programming mode by press S1 switch again.

The control software of this system is developed using Microchip’s Hi-Tech C compiler and it is available to download with GNU GPL license. This system consist with some sensitive CMOS ICs, so make sure to take necessary precautions while assembling and installing of this system (specially take care about the sensor probes).

As a sensor probes use any suitable low resistive conductor (e.g: copper or aluminum wire) and make sure that it is not reactive with the target liquid type.

This DIY "Liquid Level Monitor and Automatic Control System" is an open hardware project. All its design documents and firmware source codes are available to download at elect.wikispaces.com. All the design documents of this system are released under the terms Creative Commons Attribution 3.0 Unported License and firmware source code is release under the terms of GNU General Public License 3.0.

Saturday, February 23, 2013

Replacement Code Lock for LS7220 base Systems

LSI Computer System's LS7220 is a digital code lock system for automotive systems. This LS7220 integrated circuit is difficult to find in many places and because of that we design some alternative system which simulate the functionality of LS7220 code lock system. This simulated system executes on top of the PIC16F628A 8bit MCU and it release as an open hardware project.

LS7220 is a "hard-wired" code-locking system, but this simulated system provides both "hard-wired" and customizable (re-programmable) code locking options. This re-programmable feature provides some higher degree of protection to the system and it allows user/administrator to change system’s code at any given time by without changing the wiring layout(s) of the system.

Pinouts of Programmed MCU

In this project PIC16F628A MCU use its internal 4MHz oscillator and because of that it doesn't require any external clocking source(s). This system is design to work with 5V DC power supply and its output is interface with 5V - 12V relay to drive the locking mechanism(s).

Compared with the LS7220 the only drawback of this system is its limited supply voltage. LS7220 have some wide supply voltage range like 5V - 18V DC. But still you can couple this virtual system to that supply voltage by using some voltage regulation ICs like LM7805, LM317, etc.

The firmware of this system is written using Hi-Tech C and it is design with minimum external component dependencies. Because of that user can use "programmed MCU" with his/her own circuit design / customizations.

The main purpose of this project is to create some alternative design for LS7220 base code locking systems. Please note that this is not a project to degrade the features/specifications of LSI-CSI's LS7220 (or related) products. The complete project content including source codes and sample schematics are available to download at elect.wikispaces.com. All the content of this project are release under the terms of GNU GPL Version 3.0 license.

Monday, February 4, 2013

PT2399 base Echo Sound Effect Generator

This is an easy to build high quality echo sound generator and it’s completely based on Princeton Technology’s PT2399 echo sound IC. This supplied circuit is specifically design to interface with electronic musical instruments (e.g: electronic audio synthesizers, electronic organs, etc.) and with microphone systems.

This echo sound effect generator requires 12V - 25V DC power supply and it can deliver aprox. 20W output power (with 8Ω speaker and 20V - 5A DC power supply). This given design of echo sound generator has 3 main controls, such as echo delay adjustment, echo-effect mixer and master volume control. This delay and mixing ratio is heavily depended on input source.

Output of C1 note with maximum and minimum echo effects

At the testing stage we test this system with lot of input sources. According to our experiments this system can product good results with slow speed music and it produce excellent results with the voices. When it comes to high speed music (with maximum delay and mix levels) output seems to be bit noisy and distorted.

The complete schematic, PCB design, sample output files and output graphs of this system are available to download at elect.wikispaces.com. Please note that this supplied PCB is not tested by us, if you find any mistakes or have some suggestions about PCB design please drop us a mail.

Friday, February 1, 2013

nanoide – custom build tool with source editor

nanoide is an effort to build scriptable build tool with source code editor. Initially I developed this tool to test some of my ongoing compiler projects and later I extend it with source code editors and with simple UI.

nanoide build 138 with sample build script

nanoide build system is based on FreePascal style scripting system and it comes with more than 50 inbuilt support functions. With help of nanoide, users can create complex conditional build flows and it helps to automate system testing processes also.

Current version (build 145) of nanoide editor support C/C++, Java, Pascal/Delphi/Lazarus, Python, HTML, XML, CSS, Perl, Basic/Visual Basic, SQL, Tex, DOS batch scripts and UNIX\Linux shell scripting. nanoide is developed using Lazarus and it can be compiled and execute on Windows, Linux and Mac OS platforms. Virtually nanoide is compatible with any command line-driven compiler and it is tested with TinyC Compiler, Lua, Python, FPC and with PHP


nanoide build system and source code editors are release as an open source – free software under the terms of MIT license. Latest nanoide source codes and executables are available at sourceforge.net – nanoide project page.

Friday, January 25, 2013

Simple ATmega325 Development Board

This post is about simple Atmega325 development board which I was designed and build to test some large AVR systems. This development board contains ATmega325 MCU and MAX232 base RS232 driver/receiver unit. Thanks to SMD packages and components dimensions of this board get limited to 85mm × 62mm. This development board requires 5V external power supply and all its external circuitries (RS232 driver and hardware CPU reset) can be enable/disable through on-board jumpers.

ATmega325 Development Board

PCB design of this development board supports only for ATmega325 - TQFP64 package and MAX232 - SO16L package. This ATmega325 Development Board is release as an open hardware project and all its design files are available to download at elect.wikispaces.com.