Tuesday, December 29, 2015

Gradle thinks 2.10 is lower than current version

Ok, so it is a bug? Yes, well simply set the gradle plugin version located in build.gradle
to greater or equals to 1.5.0. Ah! So you want to upgrade your gradle to current version 2.10
as this article being write. You could check out my gradle-upgrade-manually.

Which is going to be very fun and interesting.

Gradle Update Manually

Yup, i am using Debian 8 x64. Installing gradle with `apt-get install` gives me gradle version 1.5.
The project i have been doing requires version 2.2. Humm,  ok just download 2.10 from
https://services.gradle.org/distributions, copy and unzip into /opt/gradle-2.10

$ sudo chmod 777 /opt
$ wget https://services.gradle.org/distributions/gradle-2.10-all.zip
$ unzip gradle-2.10-all.zip

I rename the /usr/bin/gradle to
$ sudo mv /usr/bin/gradle /usr/bin/gradle-old

Append my ~/.bashrc with
export PATH=$PATH:/opt/android/platform/android-sdk-21/tools:/opt/android/platform/android-sdk-21/platform-tools:/opt/gradle-2.10/bin

Modify my android project gradle-wrapper.properties to

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=file:///opt/gradle-2.10/gradle-2.10-all.zip

Modify build.gradle to use gradle plugin at least 1.5.0 since older than that
will complain that 2.10 is lower than required 2.2

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'
    }
}

Then you are all set to compile and go :D

Sunday, September 6, 2015

Linux ExifTool PDF Metadata Editor

A simple but powerful ExifTool to edit pdf metada. You can check how simple to use it here.
Since it is so simple so nothing else to cover here :D, Lol.

As an example, If you have a pdf file called drawing.pdf and you want to update its metadata, Use the utility, exiftool, in this way:
exiftool -Title="This is the Title" -Author="Happy Man" -Subject="PDF Metadata" drawing.pdf

^^

Monday, August 24, 2015

KiCAD Manual Routing

KiCAD is a wonderful tool to create schematic and pcb desain. After reading this awesome tutorial.
I feel like an expert after crunching the tutorial for 120 minutes. The hard thing comes up right away.
I was not able to manual route the track.

After googling for sometimes than there is a word come out to the surface, manual routing.
Just readily to be clicked once i googled this keyword `Err(4) trace near pad issue in Kicad`.
Well the answer to do manual routing is to disable the DRC ( Design rule checking ).


KiCAD' PCBNew version information:

Application: Pcbnew
Version: (2013-june-11)-stable
Build: wxWidgets 2.8.12 (no debug,Unicode,compiler with C++ ABI 1002,GCC 4.8.1,wx containers,compatible with 2.4,compatible with 2.6)
Platform: Linux 3.14.8-100.fc19.x86_64 x86_64, 64 bit, Little endian, wxGTK
Boost version: 1.53.0
Options: USE_PCBNEW_NANOMETRES=ON
         KICAD_GOST=OFF
         USE_WX_GRAPHICS_CONTEXT=OFF
         USE_WX_OVERLAY=OFF
         KICAD_SCRIPTING=OFF
         KICAD_SCRIPTING_MODULES=OFF
         KICAD_SCRIPTING_WXPYTHON=OFF

Happy Electrifying ^^

Wednesday, August 19, 2015

GVim, Vim, Indexer How-to indexing

Just found out that my Vim indexer.vim only starts to indexing or re-indexing if i start my gvim
from command line under the my web application project directory.

[sc]
option:ctags_params=" --exclude='*.sql' --exclude='*.js' --exclude='*.css' --PHP-kinds=+cf --fields=+iaS --extra=+q --regex-PHP='/(abstract class |class ) ([^ ]*)/\\1/c/' --regex-PHP='/interface ([^ ]*)/\\1/c/' --regex-PHP='/(public |static |abstract |protected |private )+function ([^ ()]*)/\\2/f/' --regex-PHP='/define[(].([a-zA-Z0-9_]*)/\\1/f/' "
/opt/lampp/htdocs/sc

Indexer starts to running ctags at background process if i start gvim from /opt/lampp/htdocs/sc just like
the [sc] rule. Why bother? Well i noticed from my past experience is that ctags or re-indexing will be
started if i open one of my file under [sc] rule, which is /opt/lampp/htdocs/sc, and indexer would picked
up and re-indexing. Indexer smart enough to check if a file is open from any rules that supplied in
~/.indexer_files

But anyway luckly i found out that the re-indexing or indexing could be performed at the directory
of the rule (project) specified in .indexex_files file. Any thought?

UPDATE:
Indexer does indexing if i open a file of any project that specified in .indexer_files and if only if
this is  the first file of first tab.

I usually work with multiple tab, thus any project that opened in new tab any file that opened will
no longer triggers indexer to re-indexing. For each tab i use NERDTree to have this beautiful
left navigations of a folder which is my project tree.

^.^

Thursday, August 13, 2015

LINUX: Liveusb How-to

Unetbootin is the right tool to create any live-usb linux distribution. Trying liveusb-creator
with no success to create xubuntu 14.04 on Fedora 19. Since liveusb-creator "tied" with
the current running OS.

Happy to share ^^

Sunday, July 19, 2015

Op-Amp cheatsheet?

Just found this old post at facebook. Cool!?


Opamp BasicsLike -> Microcontroller Projects & Updates
Posted by Microcontroller Projects & Updates on Thursday, July 4, 2013

Thursday, July 16, 2015

Arduino RFID, RC522, VUSB HID as Keyboard

Wrapped my project into nice grey project box. Nice project i have to combine
Arduino, RFID (RC522), VUsb together as HID Keyboard. Just tap an RFID card
and my little chips send it to computer as keyboard input. Warning this project not working
on Windows XP. And runs perfect on Linux OS, WinVista, Win7 and Win8.1





**Updates

https://github.com/adesst/arduino-vusb
You will need to create a dir named *UsbDevice* in the arduino libraries,
this example taken from my Linux Debian8 64, yours may vary.
adesanto@debian8:/opt/AVR/arduino-1.6.9/libraries$ ls -ltha
total 6.1M
drwxr-xr-x 26 adesanto adesanto 4.0K Feb 12 00:49 .
drwxr-xr-x 12 adesanto adesanto 4.0K Feb 12 00:49 ..
drwxr-xr-x  3 adesanto adesanto 4.0K Feb 12 00:12 UsbDevice

And clone the code into the newly created dir. Then the 2 codes
below are good to be compiled.

For the source codes, you can find them here:
https://github.com/adesst/arduino-vusb-hid-rfid-keyboard
Flash this code to 1st chip, that will act as USB-hid

https://github.com/adesst/arduino-rfid-serial
Flash this code to 2nd chip, that will act as card-reading via SPI
of RFID-RC522 and send the reading via UART to the 1st IC

Here is the new build schematic.



So happy ^.^

Usbasploader that Supports Watchdog Reset, Atmega328p Stuck after Watchdog reset [SOLVED]

Yeah, happy to announced that i have made a little update to https://github.com/adesst/usbasploader-v2
to support the watchdog timer reset. Previously the chip just stuck hung after watchdog is RESET the
system.

So happy ^.^

Usbasploader Hardware Does Not Recognized nor Detected, [SOLVED]

Weird thing happens today, i had written a post how i get my usbasploader board up and running.
And did add some troubleshooting. On my new board the Zener diode 3.3V of D- line is the caused.
I accidently removed got it wrong placed, the arrow pointing to Ground, and my computer had it
detected as Usbasp. But the problem only apply to my new Atmega8A-16PU and Atmega328P-PU.
Works perfect with or without Zener on D- line to my older production year of Atmega8A-16PU and

Atmega8 too.

And also i got so many times failling to have it jump to bootload though the jumper bit is active low.
I just reset the chip rapidly and after 2-3 times of reset it is always detected. Drop me a message
if your board is still not be able be detected. Anyway my usbasploader boards none of them
working on Windows XP, lets forget that OS anyway. :D

UPDATE:
Actually replacing the zener 3v6 with Fairchild 55C 3V6
500mW does fix the problem and the device is more stable
as it shown in the schematic.
These are the glass Zener 3v6
500mW Fairchild

Zener diode to replace the ones on
soldered board

Wednesday, June 24, 2015

jQuery load() Not Work or Firing

Maybe it is just the cached or the element container. Just happened today that jQuery.load()
seems not to work at all. After googling i came out with specifiying

$.ajaxSetup({cache: false, async: false});

The async:false just addition since i prefer synchronous connection than asynchronous.
Also redundant to add random number at the end of url query

$('.container').load("http://myweb/app/" + Math.random(100000000));

Fire! and did not work :(( After double check that i found out the .container was missing
or overwrite by accident to other name. Fix has been patched and Fire! Ohh Yeah! it works.

while(true){ keepCoding("^^"); }


Sunday, June 21, 2015

XAMPP 32 bit unable to run on Xubuntu 64 bit

Just happened to download xampp 1.8.0 and unable to start apache and other applications. Strangely xubuntu only shows that phpstatus failed at line 4 saying php is no such file or directory. No luck on
googling but my past experienced tells that xampp 1.7 to 1.8 are 32bit. Ok, give it a try to install
glibc.i686 and apparently libc6 is the equivalent on xubuntu.

Firstly we have to add the 32bit arch by
$ sudo dpkg --add-architecture i386
$ sudo apt-get install libc6
It will install all necessary libs.

Re-run php
$ /opt/lampp/bin/php -a

It will show the prompt meaning it runs successful.

while(true){ keepCoding("^^"); }

Friday, May 29, 2015

Compile PHP with unixODBC options

I have XAMPP 1.7 running, with php 5.2.8. Old yes but almost all of my running projects are
built on top of it. Recently i got a project that requires to use MSSQL-SQLEXPRESS.
I chose to use Codeigniter 2.1.2 as the framework to develop. One of teammate is using
MS-Windows environment and he used sqldrv as the database driver with ease.

While my part using GNU/linux Fedora19 64bit having problem. After while searching how to
connect to SQLExpress than the easy answer itu to use FreeTDS and unixODBC. Modify
php.ini of XAMPP 1.7 with no problem. After restart apache and run one of my test_odbc
file shows an error "undefined reference odbc_connect()"

More googling and ends up that i convincing my-self to compile the odbc library from scratch.
So i yum install  unixODBC-devel.i686 and so freetds-devel.i686 then download php 5.2.8
source file from Here. Done the extraction, now to build the extention.

$ pwd
/opt/php5-src/php-5.2.8-src/ext/odbc
$ /opt/lampp/bin/phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20060613
Zend Extension Api No:   220060519
configure.in:3: warning: prefer named diversions
configure.in:144: warning: AC_CACHE_VAL(lt_prog_compiler_static_works, ...): suspicious cache-id, must contain _cv_ to be cached
../../lib/autoconf/general.m4:2031: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:2052: AC_CACHE_CHECK is expanded from...
aclocal.m4:3535: AC_LIBTOOL_LINKER_OPTION is expanded from...
aclocal.m4:5473: _LT_AC_LANG_C_CONFIG is expanded from...
**(And bunch of messages, truncated for simplicity)**
$ sudo yum install glibc-devel.i686
You need the glibc-devel so you can build 32bit application on 64bit system
$ ./configure --with-php-config=/opt/lampp/bin/php-config --with-unixODBC=shared,/usr CFLAGS='-m32'
Then Error that saying
checking for Adabas support... cp: cannot stat '/usr/local/lib/odbclib.a': No such file or directory
configure: error: ODBC header file '/usr/local/incl/sqlext.h' not found!

You could solve this by modifying Makefile that being generated, goto line 4737 and removed
  ext_output="yes, shared"
  ext_shared=yes
  test "$PHP_ADABAS" = "no" && PHP_ADABAS=yes
I don't know what caused the double occurrences that simply override the previous check
and initialization. Re-run the configure
$ make
/bin/sh /opt/php5-src/php-5.2.8-src/ext/odbc/libtool --mode=compile gcc  -I. -I/opt/php5-src/php-5.2.8-src/ext/odbc -DPHP_ATOM_INC -I/opt/php5-src/php-5.2.8-src/ext/odbc/include -I/opt/php5-src/php-5.2.8-src/ext/odbc/main -I/opt/php5-src/php-5.2.8-src/ext/odbc -I/opt/php5-src/include/php -I/opt/php5-src/include/php/main -I/opt/php5-src/include/php/TSRM -I/opt/php5-src/include/php/Zend -I/opt/php5-src/include/php/ext -I/opt/php5-src/include/php/ext/date/lib -I/usr/local/incl  -I/opt/php5-src/include/php -DHAVE_CONFIG_H  -m32   -c /opt/php5-src/php-5.2.8-src/ext/odbc/php_odbc.c -o php_odbc.lo 
 gcc -I. -I/opt/php5-src/php-5.2.8-src/ext/odbc -DPHP_ATOM_INC -I/opt/php5-src/php-5.2.8-src/ext/odbc/include -I/opt/php5-src/php-5.2.8-src/ext/odbc/main -I/opt/php5-src/php-5.2.8-src/ext/odbc -I/opt/php5-src/include/php -I/opt/php5-src/include/php/main -I/opt/php5-src/include/php/TSRM -I/opt/php5-src/include/php/Zend -I/opt/php5-src/include/php/ext -I/opt/php5-src/include/php/ext/date/lib -I/usr/local/incl -I/opt/php5-src/include/php -DHAVE_CONFIG_H -m32 -c /opt/php5-src/php-5.2.8-src/ext/odbc/php_odbc.c  -fPIC -DPIC -o .libs/php_odbc.o
In file included from /opt/php5-src/php-5.2.8-src/ext/odbc/php_odbc.c:37:0:
/opt/php5-src/php-5.2.8-src/ext/odbc/php_odbc_includes.h:74:21: fatal error: WINDOWS.H: No such file or directory
 #include
                     ^
compilation terminated.
make: *** [php_odbc.lo] Error 1

Well at this point is strange if you open the php_odbc_includes.h:74 it says HAVE_ADABAS 
blabla, i just removed all off them until it reaches the #elif ... HAVE_UNIXODBC

$ make 
And success it says
Build complete.
Don't forget to run 'make test'.
   
At this point if you check the modules/ you will see odbc.so sits there, yeah!
I like the manual-way so i just copy and paste on my XAMPP extention folder.
/opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/

Restart the Apache service and run my script yeah! Now it connects like charm :))

Saturday, May 23, 2015

Compiling Antlr2

Compiling Antlr2 with no success. As of this article being written the latest version is 2.7.7.
The source is downloaded and configured but when `make` processing this errors comes in.

>> /usr/bin/make -C lib/cpp/src all                         

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

make[3]: Entering directory `/opt/antlr2/antlr-2.7.7/lib/cpp/src'

*** compiling /opt/antlr2/antlr-2.7.7/lib/cpp/src/../../../lib/cpp/src/ANTLRUtil.cpp

*** compiling /opt/antlr2/antlr-2.7.7/lib/cpp/src/../../../lib/cpp/src/ASTFactory.cpp

*** compiling /opt/antlr2/antlr-2.7.7/lib/cpp/src/../../../lib/cpp/src/ASTNULLType.cpp

*** compiling /opt/antlr2/antlr-2.7.7/lib/cpp/src/../../../lib/cpp/src/ASTRefCount.cpp

*** compiling /opt/antlr2/antlr-2.7.7/lib/cpp/src/../../../lib/cpp/src/BaseAST.cpp

*** compiling /opt/antlr2/antlr-2.7.7/lib/cpp/src/../../../lib/cpp/src/BitSet.cpp

*** compiling /opt/antlr2/antlr-2.7.7/lib/cpp/src/../../../lib/cpp/src/CharBuffer.cpp

*** compiling /opt/antlr2/antlr-2.7.7/lib/cpp/src/../../../lib/cpp/src/CharScanner.cpp

In file included from /opt/antlr2/antlr-2.7.7/lib/cpp/src/../../../lib/cpp/src/CharScanner.cpp:10:0:

/opt/antlr2/antlr-2.7.7/scripts/../lib/cpp/antlr/CharScanner.hpp:474:30: error: ‘EOF’ was not declared in this scope

  static const int EOF_CHAR = EOF;

                              ^

/opt/antlr2/antlr-2.7.7/scripts/../lib/cpp/antlr/CharScanner.hpp: In member function ‘bool antlr::CharScannerLiteralsLess::operator()(const string&, const string&) const’:

/opt/antlr2/antlr-2.7.7/scripts/../lib/cpp/antlr/CharScanner.hpp:565:41: error: ‘strcasecmp’ was not declared in this scope

   return (strcasecmp(x.c_str(),y.c_str())<0 p="">                                         ^



xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

                      >> E R R O R <<

============================================================



g++ -O2 -DNDEBUG -felide-constructors -pipe -c  -I . -I /opt/antlr2/antlr-2.7.7/scripts/../lib/cpp /opt/antlr2/antlr-2.7.7/lib/cpp/src/../../../lib/cpp/src/CharScanner.cpp



============================================================

Got an error while trying to execute  command  above.  Error

messages (if any) must have shown before. The exit code was:

exit(1)

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

make[3]: *** [/opt/antlr2/antlr-2.7.7/lib/cpp/src/CharScanner.o] Error 1

make[3]: Leaving directory `/opt/antlr2/antlr-2.7.7/lib/cpp/src'

make[2]: *** [all] Error 1

make[2]: Leaving directory `/opt/antlr2/antlr-2.7.7/lib/cpp'

make[1]: *** [all] Error 1

make[1]: Leaving directory `/opt/antlr2/antlr-2.7.7/lib'

make: *** [all] Error 1

Includes some headers fixed the problems. Open the CharScanner.cpp and put this at the header.

#include   >fstream<
#include   >strings.h< // before
#include   >antlr/config.hpp<
// and

#include >antlr/exersharedinputstate.hpp< // after
#ifndef EOF
    #define EOF     std::ifstream::traits_type::eof()
#endif

Run `make clean` and the `make; make install`. Compile success, Yeah!

Saturday, May 9, 2015

Compile C++ BOOST Example

Playing around with Boost 1.58 library, i need to experience the compile and run the examples.
I go into libs/serialization/examples/ run b2 hummm seems to build everything. So give it a try
to compile it "by-hands"

$ pwd

/opt/c++/boost_1_58_0/libs/serialization/example

$ export LD_LIBRARY_PATH=/opt/c++/boost_1_58_0/stage/lib:$LD_LIBRARY_PATH

$ c++ demo.cpp -o demo -L /opt/c++/boost_1_58_0/stage/lib -lboost_serialization-mt

$ ./demo

** Throws some log meaning the application compiled and run successfully


Hurray!

Sunday, April 19, 2015

Remote Debugging and Installing to Android Emulator

Running an Android Emulator in my development laptop definitely slowing all the system.
I switched to vim instead of painful Android Studio IDE. My Laptop still slow.
So i came up with a solution that i could use my other laptop to run the android emulator.
The emulator now runs, with 5554:MyAvd-1 at the title.

Port forwarding in linux using ssh is really simple. I run
$ ssh adesanto@192.168.1.29 -L 5555:127.0.0.1:5554
$ killall adb; adb devices

The result is no device attached. Strange, i googled and end with
http://stackoverflow.com/questions/1754162/remote-debugging-with-android-emulator

I tried one of the answer from Christopher Orr,
  • ssh -NL 5556:localhost:5554 -L 5557:localhost:5555 myuser@remote-server
  • killall adb; adb devices
The result shows that there is a device at emulator-5556 but the status is offline.
After scroll down the answers i see that hheimbuerger, he forward mylaptop:5554 to target:5554
and  mylaptop:5555 to target:5555.

Aha! now after modify the tunnel and restart the adb process by
$ ssh -NL 5556:localhost:5554 -L 5557:localhost:5555 myuser@remote-server
$ killall adb; adb devices
I have my emulator list showing
List of devices attached
emulator-5554 device

Nice! i tried to run
$ adb logcat
It throws alot of messages at my screen showing it works!
Then i tried to upload one of my debug .apk, it uploads and running like charm.

Happy codding.

Saturday, April 18, 2015

Fedora/Centos Logging the iptables to /var/log/iptables.log

Recently my VPS got hacked and had to learn iptables to drop all outgoing traffic.
Everything seems to work, yeah google is your friend. But there was a problem.
In my fedora the iptables dropped packets logging did not appears to /var/log/messages
nor to /var/log/iptables.log.. strange.

Okay i started to dig why the log was not showed out. I know i am using rsyslog,
so i came out with this setting,

1. Create a file
    # touch /etc/rsyslog.d/iptables.conf
    # touch /var/log/iptables.log
2. Insert this into the config file
    :msg, startswith, "iptables:" /var/log/iptables.log
  & ~ Well this rules is not working, since the rsyslog format is to add timestamp
    at every beginning line of log. So modified it slightly with "contains" keyword.
   :msg, contains, "iptables:" /var/log/iptables.log
  & ~
3. restart the service
    # service  rsyslog restart

Now i can see all the log of dropped packets at /var/log/iptables.log

GNU/Linux  rocks!

Friday, January 2, 2015

Getting Started with USBAspLoader from ground up and troubleshooting

The Beginning

It has been a long absent since the last post of my electronic project and hacks.
Time to get my dusty arduino out of the shelf. G*! I don't know what to do with
this.

All i could remember is that i tried to get USBAspLoader up and running on my
Atmega8A-16PU. Ok, here is the deal. I write this article to aid anybody that
in my situation or maybe to refresh how to get USBAspLoader running.

SETUP

All Bill of materials are well described in the schematic below. Noticed i don't put
100nF electrolytic capacitor between uC Vcc and GND. But i do add 10nF capacitor
at my soldered board. Why? Well i forgot to add one on my breadboard, sorry.

And here is the schematic.

Don't get confused of the uC label, Atmega168, is has the same pin layout with Atmega8.
With the schematic reading given me some clue the arrangement on the breadboard. Plug
the USB cable and my Linux (Fedora 19) detected as

kernel: [27618.902659] usb 3-3: new low-speed USB device number 2 using xhci_hcd
kernel: [27619.073587] usb 3-3: New USB device found, idVendor=16c0, idProduct=05dc
kernel: [27619.073592] usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
kernel: [27619.073594] usb 3-3: Product: USBasp
kernel: [27619.073596] usb 3-3: Manufacturer: www.fischl.de

Fiuh.. ok enough with the prototyping, it is time to move it to real soldered board.
Here is the minimum configuration to get the USBAspLoader working. And why
am i writting this article and to use USBAspLoader? Simple it is play well with arduino
and to upload/program a firmware or Arduino sketch file is blazing fast!

If you noticed that i only use USB connector as Power and Data in/out. That is the
power of USBAspLoader, it is so compact and minimum to be setup and running.

Troubleshooting

Here are some problems i had faced while setup USBAspLoader to run.

  • Device detected as High Speed USB.
    Usually the D- and D+ is swapped. Try to swap the connection.
    The arrangement starts from Vcc, D-, D+ and GND. Check out this Wiki link
  • Device is unable to be enumerated. You have to check whether USBAspLoader
    is uploaded correctly. Also the Jumper must be active low, connected to ground.
    My jumper port is assigned to pin PD6. You could check it from the firmware,
    since i compiled the firmware from scratch then the setup pin is located in ../usbasploader/firmware/bootloaderconfir.h just set the JUMPER_BIT
    to any desired value. If you don't know what you are doing just check it
    and leave it as default. If you see it is set to 6 then it refers to PD6 and if 7,
    older version, then PD7.
  • The Device seems not responding although is already RESET.
    Simply leave the JUMPER_BIT floating and then press RESET.
    The bootloader will start bootloading the firmware which uploaded.
  • Device is restart by it self. Make sure the RESET pin of the uC has
    a pull-up resistor. Simply add a 15k resistor between Vcc and the RESET pin.
UPDATE**

Hope this article would help. Keep soldering! :p

Breadboard Self-Capacitance Problem

Just found out how self-capacitance or parasitic capacitance very annoying.
Let me share the experienced i had with breadboard self-capacitance.
I am driving a relay with a transistor, BC 337 (npn). With my usbasploader
on Atmega8 as my On/Off controller.

Here is the schematic.



The problem starts to showing. I had arranged all parts as in the diagram above
on a breadboard. When an On signal raised from microcontroller, Atmega8
with usbasploader, to the transistor and the relay starts to make a tick sound,
telling me that it is at "On" state. When the "Off" signal triggered... nothing happens.
The next "On" state nothing happens and so on. It is just turned "On" and hang.
Humm.. after several trials

1. Adding a capacitor 10uF at the transistor B-E pins

2. Adding a pull down resistor at the transistor Base pin, 10K Ohm.

The trials said above results the same condition whenever the transistor
had been raised to "On" it can not be switched "Off". Aha! I put a LED 1Watt
or a forward-bias diode as shown below figure.


The relay starts to ticking On and Off as expected. And the LED looks dimmed
when the transistor at "Off" state. Now i remembered that i have been warned
that breadboard has stray-capacitance or a well known name parasitic capacitance
and its 10pF. Big enough to hold some voltage to maintain the relay at "On" state.


I don't know whether the voltage that were trapped between the "free-wheel"
diode and the relay is oscillating since have no scope to check.But i am guessing it is.
Final summary is that soldered board more accurate, while breadboard still
a good choice to do some prototyping. So do both to make sure everything works
as expected