#Arduino -> Nikon trigger via laser for watterdrops

February 22nd, 2010

Today I have been asked if I can write something about mine Nikon Arduino trigger video that I have put on Youtube.

And here it is, description, schematics, video and sample pictures.

The idea has already been seen on the Internet. Arduino is controlling photo resistor on which laser beam is pointed. When resistance changes itself because of the drop that is cutting beam then Arduino is triggering Nikon camera after the amount of time specified with one trim capacitor which can be between 0 and 1023, but I have divided it with 2 so that I have better control of the delay. All information is displayed on 2×16 LCD display. Also to be able to take picture of drops colliding it’s necessary that speed of the drops be 10 drops/sec so I have implemented one button for that with proper code behind it.

I have also 4 buttons and 2 led diodes on the board. Buttons that I have are reset for resetting of the electronics, debug that is switching debug mode on and off, drops that is designed to count drops per second and ready button that is used when I’m taking pictures so that when drops are falling fast I don’t trigger camera every time when they are going down. Led diodes that I’m using are green for power and yellow for visual notification when the trigger is trigged.

Here is the final schematics that I’m using right now.

Nikon-Arduino trigger schema

Nikon-Arduino trigger schema

For simplified solution with cables I’m using standard audio cables with 3.5mm stereo jacks on both sides, so I can use same cables for other purposes as well. I have also modified Nikon cable remote so that it has 3.5mm female stereo jack built in for simple use with trigger and without it.

Nikon trigger schema

Modified Nikon cable release

Here are few pictures of the whole setup.

Nikon Trigger

Nikon Trigger

Nikon Trigger

Nikon Trigger

Of course code behind is in this NikonFastTrigger.pde (14) file available for download.

Simple instructions.

  1. when the program is loaded it will display Ready on the second line
  2. when drop breaks laser beam then instead of Ready on display will be Busy until you press Ready button
  3. offten because I have laser box about 1m above the surface delay is needed between 150-220 ms

For drops counter I’m doing like this.

  1. switch to drops counter with drops button
  2. then I try to create drops stream with about 1 drop per second with help of the normal digital watch and by changing delay I set Arduino to recognize that as 1drop/sec
  3. now the only thing left is to configure drops stream to 10 drops/second for colliding watterdrops

Here are couple of pictures captured with this setup and pictures of colliding drops are to come.

And here is the video from YouTube.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Twitter

CANON PowerShot and Ixus service manual and part list

January 8th, 2010

Last week my kids have broken Ixus 70 that my wife got for hers birthday.

I tried to find service manual to see how am I going to assemble lens but without any success, at least not for free.

So finally when I have founded it and paid for it, I though why not have it here on blog so that everyone that needs it can get it for free.

So here are they, 2 files, service manual and parts list.

Enjoy.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Twitter

How to install Snort Intrusion Detection System on Windows

December 22nd, 2009

First short explanation what is Snort from Snort official website:

Snort® is an open source network intrusion prevention and detection system (IDS/IPS) developed by Sourcefire. Combining the benefits of signature, protocol and anomaly-based inspection, Snort is the most widely deployed IDS/IPS technology worldwide.

Installation of Snort on Windows is pretty simple.

First, you need to download and install few things. For Snort to be able to act as sniffer and IDS it needs Windows Packet Capture Library which is WinPcap. The stable latest version on the site is 4.1.1 and you can download it here.

Now when we have WinPcap installed the next step will be to download Snort. The latest version for Windows is 2.8.5.1 and you can download it here. Installation shouldn’t be a problem, if you need IPv6 support and logging to Microsoft SQL or Oracle database then you need to select proper radio and check boxes and if don’t then just go next and next to the end and that’s it. Default installation directory is C:\Snort so remember it because it will be our working dir all the time.

So we have installed WinPcap and Snort but we are not finished with installation yet. We have one more thing to download and install. The Snort rules. These rules are those small files that tells Snort what it should search for in captured packages and how to identify them, as a threat, information disclosure or something else. For us to be able to download Snort rules we have to be registered on Snort site. Registration is free and rules are one month old for free users, for those who need the latest threats detected at the same moment when they are published to the community I suggest to buy VRT subscription so you will have the latest rules directly as they are announced. So now we will download snortrules-snapshot-2.8.tar.gz rules archive file.  When you open archive file you will get following structure:

Snort rules

Copy all four directories over those in C:\Snort replacing contents that already exists on the hard drive.

Now when we are done with easy part we need to configure Snort to run. Because these rules are written for unixoid systems we need to change some things in the main config file C:\Snort\etc\snort.conf so that Snort can start at all.

Here are the things that you need to edit to be able to run snort:

Find lines 269 and 270. These lines will not allow Snort to start, at least not on Windows because Snort detects the second one as double config detection line so we need to change this.

Change from this:

config detection: search-method ac-bnfa
config detection: max_queue_events 5

To this:

config detection: search-method ac-bnfa max_queue_events 5

Now, the next thing that we need to change is lines where we say to Snort where to find dynamic preprocessor files. On lines from 298 to 303 change this:

dynamicpreprocessor file /usr/local/lib/snort_dynamicpreprocessor/libsf_dce2_preproc.so
dynamicpreprocessor file /usr/local/lib/snort_dynamicpreprocessor/libsf_dns_preproc.so
dynamicpreprocessor file /usr/local/lib/snort_dynamicpreprocessor/libsf_ftptelnet_preproc.so
dynamicpreprocessor file /usr/local/lib/snort_dynamicpreprocessor/libsf_smtp_preproc.so
dynamicpreprocessor file /usr/local/lib/snort_dynamicpreprocessor/libsf_ssh_preproc.so
dynamicpreprocessor file /usr/local/lib/snort_dynamicpreprocessor/libsf_ssl_preproc.so

To this:

dynamicpreprocessor file C:\Snort\lib\snort_dynamicpreprocessor\sf_dce2.dll
dynamicpreprocessor file C:\Snort\lib\snort_dynamicpreprocessor\sf_dcerpc.dll
dynamicpreprocessor file C:\Snort\lib\snort_dynamicpreprocessor\sf_dns.dll
dynamicpreprocessor file C:\Snort\lib\snort_dynamicpreprocessor\sf_ftptelnet.dll
dynamicpreprocessor file C:\Snort\lib\snort_dynamicpreprocessor\sf_smtp.dll
dynamicpreprocessor file C:\Snort\lib\snort_dynamicpreprocessor\sf_ssh.dll
dynamicpreprocessor file C:\Snort\lib\snort_dynamicpreprocessor\sf_ssl.dll

Next thing to change is line 324 on which we have dynamic engine path, so change it from this:

dynamicengine /usr/local/lib/snort_dynamicengine/libsf_engine.so

To this:

dynamicengine C:\Snort\lib\snort_dynamicengine\sf_engine.dll

I don’t know why, maybe some mistake, but lines bellow should be commented out by default, but they were not so we have to comment them out. Because we are not VRT subscriber and don’t have any dynamic detection files we need to coment lines from 339 to 354, so change this:

dynamicdetection file /usr/local/lib/snort_dynamicrules/bad-traffic.so
dynamicdetection file /usr/local/lib/snort_dynamicrules/chat.so
dynamicdetection file /usr/local/lib/snort_dynamicrules/dos.so
dynamicdetection file /usr/local/lib/snort_dynamicrules/exploit.so
dynamicdetection file /usr/local/lib/snort_dynamicrules/imap.so
dynamicdetection file /usr/local/lib/snort_dynamicrules/misc.so
dynamicdetection file /usr/local/lib/snort_dynamicrules/multimedia.so
dynamicdetection file /usr/local/lib/snort_dynamicrules/netbios.so
dynamicdetection file /usr/local/lib/snort_dynamicrules/nntp.so
dynamicdetection file /usr/local/lib/snort_dynamicrules/p2p.so
dynamicdetection file /usr/local/lib/snort_dynamicrules/smtp.so
dynamicdetection file /usr/local/lib/snort_dynamicrules/sql.so
dynamicdetection file /usr/local/lib/snort_dynamicrules/web-client.so
dynamicdetection file /usr/local/lib/snort_dynamicrules/web-misc.so

To this:

#dynamicdetection file /usr/local/lib/snort_dynamicrules/bad-traffic.so
#dynamicdetection file /usr/local/lib/snort_dynamicrules/chat.so
#dynamicdetection file /usr/local/lib/snort_dynamicrules/dos.so
#dynamicdetection file /usr/local/lib/snort_dynamicrules/exploit.so
#dynamicdetection file /usr/local/lib/snort_dynamicrules/imap.so
#dynamicdetection file /usr/local/lib/snort_dynamicrules/misc.so
#dynamicdetection file /usr/local/lib/snort_dynamicrules/multimedia.so
#dynamicdetection file /usr/local/lib/snort_dynamicrules/netbios.so
#dynamicdetection file /usr/local/lib/snort_dynamicrules/nntp.so
#dynamicdetection file /usr/local/lib/snort_dynamicrules/p2p.so
#dynamicdetection file /usr/local/lib/snort_dynamicrules/smtp.so
#dynamicdetection file /usr/local/lib/snort_dynamicrules/sql.so
#dynamicdetection file /usr/local/lib/snort_dynamicrules/web-client.so
#dynamicdetection file /usr/local/lib/snort_dynamicrules/web-misc.so

Now we need to trim a bit SSH preprocessor to work on Windows as it is different from Linux one, so find line 753 and change this:

preprocessor ssh: server_ports { 22 } \
max_client_bytes 19600 \
max_encrypted_packets 20 \
disable_srvoverflow \
disable_protomismatch \
disable_badmsgdir

To this:

preprocessor ssh: server_ports { 22 } \
max_client_bytes 19600 \
max_encrypted_packets 20

Now we are good to go. We can test snort easily from the command line. So now go on Start->Run and type cmd following by enter key. Now in command prompt type following commands:

c: and then enter key

cd c:\snort\bin and then enter key

snort -v -c C:\snort\etc\snort.conf -l C:\snort\log -K ascii and then enter key

So now we have entered Snort directory and started Snort on command line. You will first see Snort starting and parsing config file snort.conf and then you will see lot of output when Snort start sniffing and controlling packages on the network. If it finds any package that is not regular network traffic it will save info about it in c:\Snort\Log\alert.ids file. Simple output of one captured packet looks like this:

[**] [1:254:7] DNS SPOOF query response with TTL of 1 min. and no authority [**]
[Classification: Potentially Bad Traffic] [Priority: 2]
12/22-12:19:12.577553 192.168.137.206:53 -> 192.168.137.10:55153
UDP TTL:128 TOS:0×0 ID:5399 IpLen:20 DgmLen:79
Len: 51

Now to explain what we have here. The first line says what type of attack is it, the second line says what classification is it and what priority does it have, and the last three lines are data about the attack, attacker IP, your IP, destination and source ports and so on.

Important part of this log is [Priority: 2] because that’s how you can identify the real threat from false one. The threats are divided in three groups, group 3 or [Priority: 3] is the lowest one and it usually means that someone is scanning your network. The second one is a bit serious. It’s information disclosure and it has [Priority: 2]. This means that someone has got some info about services that you are running which is usually the first part of any attack, gaining of information. The most critical one is the one with [Priority: 1] which usually means that right now someone is trying to exploit some of services that you are running. This could mean that you have older version of some service on your server, like IIS that is not updated or Exchange server or something else and that snort has detected some patterns in packages sent to server that could be exploits which can do harm.
Now we can stop Snort with Ctrl+C and Snort will display some statistics. The only thing that we have to do now is to install Snort as a Windows service. To do so we will write following command on command prompt:
snort /service /install -c C:\Snort\etc\snort.conf -l C:\Snort\log -K ascii
After this command service is installed and you can start it from service manager or simply type sc start snortsvc.
So with this Snort is installed on your machine and is logging everything. Now you just need some program to parse alerts and do actions based on the alert priority. There are lot of those available on the Internet.
Note 1: If you have more than one network interface on your machine you need to tell Snort on which one should it listen. First type snort -W command to list all interfaces on your machine (works only on Windows) and then when you find which interface is the one that you will listen on then you need to add -i n where n is number of interface from the list that you got. You need to add that to all Snort commands that you are executing from command prompt and when creating Windows service.
Note 2: If you want Snort to log alerts to Eventlog as well as to log files than add -E (only on Windows) to the command line parameters.
Update:  Here is my snort.conf (44) file which is working on my machine without any problems. It could be something with updated rules that can cause problems with starting of Snort.
Update2:  One trailing / on ssh preprocesor line was left by mistake, now it’s removed.
Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Twitter

Arduino wired remote code scanner for Alpine

November 23rd, 2009

Currently I’m working on project of interfacing Alpine with Peugeot steering wheel audio controls. I have founded some codes on mp3car.com but not all of them are working on my Alpine CDE-9880R.

Because some of them doesn’t work on my HU I had first to build Arduino scanner to scan for those missing remote codes.

Although I’m sending codes as binaries it was easier for me to work with decimals on the serial console and then latter convert them to binary so I have wrote function for that as well.

Because the first part of signal is always the same there was not need to convert it at all, and it’s stored in variable iHello, so the part that is changed is the second part or 3 decimal numbers.

Now because there are 255*255*255 = 16 581 375 possible combinations I had to bring this to some reasonable number otherwise it would take very much time to find right codes so I have limited combinations a bit.

I took the lowest and the highest values from codes from link above for the first and the second decimals, and limited the third one to 2 possible numbers that I’m sending as finish 85 or 213.

Here are those codes that I have founded working on my HU:

  1. 87  253   85 ( 01010111  11111101  01010101 ) – Pause
  2. 107 247   85 ( 01101011  11110111  01010101 ) – Band/ta
  3. 111  237   85 ( 01101111  11101101  01010101 ) – Defeat
  4. 119 235   85 ( 01110111  11101011  01010101 ) – Power
  5. 173 238 213 ( 10101101  11101110  11010101 ) – Mute
  6. 183 219   85 ( 10101101  11101110  11010101 ) – Source
  7. 187 218 213 ( 10111011  11011010  11010101 ) – Next Track
  8. 93  250 213 ( 01011101  11111010  11010101 ) – Previous track
  9. 219 214 213 ( 11011011  11010110  11010101 ) – Volume up
  10. 109 246 213 ( 01101101  11110110  11010101 ) – Volume down
  11. 171 239 85 ( 10101011  11101111  01010101 ) – Folder/memory up
  12. 85 255 85   ( 01010101  11111111  01010101 ) – Folder/Memory down

Now because I have IR remote for my HU and defeat is not on it I assume that it’s possible to find even more codes for it but I didn’t those so I stopped here where I have everything for my first project.

Here are pictures of the interface that I have built for testing of codes. It consists of 5 buttons which have been assigned different functions and 3.5 mm female audio jack which I use for connection with HU. HU has the same 3.5 mm female jack on the back so I can use regular 3.5mm stereo cable for testing without any modifications on HU or Arduino board.

Here is the Arduino Alpine scanner (64) sketch file with all functions that I have used for scanning, saving and displaying codes on serial console.

Here are the instructions how to use this sketch to find codes.

  1. First you need to erase eeprom with erase function to be sure that it’s clean on the start of scan.
  2. Now comment out function for erase and uncomment function for saving combination on eeprom
  3. Now you are ready for scan, so when you connect Arduino to your HU just press button 4 to start scan
  4. When you see some change on HU you need to press button 4 to stop scan
  5. Using buttons 1 and 3 you can go back or forward to find that combination that you discovered
  6. When you find it you can verify it with button 2 which repeats it again
  7. If that is combination that you are looking fore press button 5 to save it to eeprom
  8. When you have found all combinations that you are interested of connect Arduino to computer and on serial console you will have all combinations that you have found, so copy and paste them in iFounded array
  9. Comment out functions for saving, previous and next button and uncomment functions for import of combinations, sending of previous and next combinations
  10. Now when you power up Arduino press button nr 5 to import combinations and cycle them with buttons 1 or 2 to confirm that you have right combinations saved

Now when I have all of the codes needed to control HU I can finish the first project and the post about it is coming soon.

Any comments are welcome.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Twitter

How to install Wine on Snow Leopard

October 26th, 2009

If you would like to have console Wine installed on your Snow Leopard machine procedure is simple.

  1. Install MacPorts
  2. In Terminal type sudo port selfupdate, to fetch the latest repository contents
  3. Run sudo port install wine to install all things needed for Wine. You can ignore error at the end regarding Wine version.
  4. Install Git in terminal sudo port install git-core
  5. Fetch the lattest source from winehq with git,  git clone git://source.winehq.org/git/wine.git ~/wine-git
  6. Enter to the ~/wine-git directory and run ./configure, ./make, ./make dep and ./make install commands

That’s it. Wine is now installed on your machine.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Twitter

Sorting of images by creation date from EXIF

September 15th, 2009

In my working with photographs the first step in postprocessing is moving them from memory card to pc. Usually this is done via Adobe Bridge and it works like a charm, new folders are being created based by date, files renamed and so on, but Adobe bridge lacks a support for importing folders from hdd as source folders which is option that I need right now, as I have founded on my hdd that I have lot of images that are coppied from memory card directly to hdd as they were created on card.

This brings me to the problem that I have lot of folders with lot of images without any order. This has begun to frustrate me, so I started to write program that will sort them based on exif in respective folders, but one night while reading DPreview forum I have founded link to one program that can do exactly what I want on the way I want.

The program is called DIM or Digital Image Mover. It’s exactly what it’s name says, image mover from one place to another. It doesn’t do anything more, just move/copy images from one place to another in the respective folders that are created by the date template that you provide.

Program is written in Java so it works on all platforms that have support for JRE – Java Runtime Enviroment and so far I have tested it on Mac OS and Windows without any problems.

It has support for all major raw files (NEF, CR2, CRW), jpeg, tiff, png and so on.

Here is a link to the site of the Alan Light who is author of the program, where you can find the latest version (4.0 at the moment), download it and send donation to author of the program.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Twitter

Almost 100 year old door lock

September 2nd, 2009

Here is one picture that I took yesterday of  almost 100 year old door lock on one Swedish church that was built in 1912.

Sepia effect and little bit contrast/sharpening was applied in post processing.

Door lock

Door lock

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Twitter

Disable IPV6 in Windows 2008 server or Vista

June 26th, 2009

Today while installing 2008 failover cluster I got error or notification from SQL server that two of my servers have same IPV6 address. Because I don’t use IPV6 and I have disabled it in network properties it was a bit weird to see this message.

Then I run ipconfig command that showed to me lot of Tunnel adapters that were disconnected and created automatically by Vista.

So to have painful installation of new cluster I have disabled IPV6 protocol totally.

Here is solution:

  • start run with win key + r or by start menu
  • regedit
  • go to HKLM\System\CurrentControlSet\Services\Tcpip6\Parameters
  • add new dword (32bit) value DisableComponents with value 1
  • restart
  • enjoy
Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Twitter

How to copy IIS configuration to another server

June 18th, 2009

In case that you ever wanted to migrate IIS from one server to another with all sites, application pools, etc. this is a very simple solution for that.

First you open Internet Information Services in mmc (Microsoft Management Console) and with right click on it you go on Backup/Restore. Create new backup, name it with something familiar and set password on it.

Now when backup is done you will see it in the list of backups.

Next step would be to open directory C:\Windows\System32\inetsrv\MetaBack and find there two files with extensions MD0 and SC0. Copy these two files to some media (network, usb, floppy, etc.) and transfer them to same directory on another server.

Restore process is the same like for a backup, take Backup/Restore from Internet Information Services in mmc (Microsoft Management Console) and in the list of backups you will see your backup as well. Click on it, take restore, confirm yes that existing configuration will be deleted and write password when asked.

Voila. Now you have two identical IIS servers.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Twitter

Merge pdf files online

June 12th, 2009

If you ever have had problem that you need software to merge several pdf documents here comes online solution with name MergePDF.net.

You select files, press merge button and then you download merged file.

Easy, fast and w/o any need to buy/install other programs for doing the very same thing.

Link here and if you find this solution worthy there is Donate button on the page to support this project.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Twitter