2015년 12월 2일 수요일

My touch pad mount







Can touch pads substitute mice? I am not sure, but I prefer to use touch pad. It has functionality that matches mouses. Surely some operations like drag and drop, mouse is still superior operation device, but daily situation, like web surfing, I think touch pad is good enough.

My keyboard has number pad that I seldom use but requires me extra space and more distance to reach my mouse or touch pad. So I decide to make a touch mount above keyboard. It would not work with mouse, but was very suitable for touch pad.

1. hardware

It is very simple to make touch pad mount. Just salvage some metal (or al, copper...) plate from old gadgets and vend it for your taste. And then place your touch pad on it. That's all.

I was able to get some copper plate and used it as my own touch pad mount. This mount can be placed anywhere around or above the keyboard. It keeps my hand moving shorter as possible, comporting my wrist.

2. software

There is truth. Touch pad is different device from mouse. Commonly touch pad has smaller surface than mouse can move. It means that, to move some screen position, maybe touch pad needs more sweep operation than mouse move. To solve this problem, touch pad should be given some inertia for mouse pointer movement. We are used at scroll inertia, but mouse pointer movement inertia is not so common. I was not able to find suitable driver for my need, so I made one :)

Below is my auto hot key script to enable inertia applied mouse pointer movement. It worked well with my logitech touch pad.



#HotkeyInterval 1000
#MaxHotkeysPerInterval 100
#SingleInstance force
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

Started = FALSE
OX = -1
OY = -1
DX = 0
DY = 0
Auto = FALSE
loop
{
sleep, 20
if(GetKeyState("LButton")==0 && GetKeyState("MButton")==0 && GetKeyState("RButton")==0) {
MouseGetPos, X, Y
if(X != OX || Y != OY) {

;MsgBox, moving
DX := DX * 0.1 + (X - OX) * 0.9
DY := DX * 0.1 + (Y - OY) * 0.9
if (OX == -1) {
DX := 0
}
if (OY == -1) {
DY := 0
}
if(Abs(DX) > 100) {
DX := 0
}
if(Abs(DY) > 100) {
DY := 0
}
}
else {
DX := DX * 0.6
DY := DY * 0.8
MouseMove DX,DY,0,R
;MsgBox, %DX% %DY%
if(Abs(DX) < 1) {
DX := 0
}
if(Abs(DY) < 1) {
DY := 0
}
}
OX := X
OY := Y
}
else {
MouseGetPos, X, Y
OX := X
OY := Y
}

}

$WheelUp::
Send {WheelDown}
Return

$WheelDown::
Send {WheelUp}
Return




Note that last two blocks - WheelUp and WheelDown event handler is for reverse scroll. If you don't want this feature, you can remove these blocks.


2013년 6월 22일 토요일

Connecting desktop cnc with parallel interface to my laptop

Early in this year I bought cheap chinese desktop cnc engraver for about $800, good and easy to operate, except for one problem. When I purchased it I didn't noticed that It has parallel interface for computer operation, but my laptop don't has any parallel port. It has only USB port. My desktop PC has parallel port but It was to old and slow.

I searched web for solution to connect my cnc to laptop and found that it is not easy.
First, USB is for serial communication and it can't communicate with parallel device. some electronic device is available for data conversion between serial and parallel devices. It is called shift register. 74HC595 is one of that kind of chips and you can get information from here. Unfortunately, I am not electronics expert, I am software developer. So making some data converter using this chip will be difficult job.
Another problem is, popular desktop cnc softwares also talk to parallel ports not usb. So if I succeed to connect my cnc to laptop, it will still be problem that no suiltable software exist.

Someone tried to solve this situation. they made home brew device to convert usb data to parallel data. If you are interested, check it out here.

Some guys made mach3 usb - parallel interface which is called PLCM-LPT2. You can check it out here. another team has released UC-100 which is very simillar to PLCM-LPT2. Find out it here. These products are commercial product and maybe they will operate perfectly. One disadvantage - theses products support only one cnc software, MACH3. Their divers are supplied as mach3 plugin form. so you decide to use another cnc software, they will do no good.

I spent lot of time to find a way to solve my problem. It looked very simple to solve, but as time goes by, It gets harder. And I found that I was not alone. Many people faced the same situation and found nothing useful.

And then, a miracle happened. I heard someone used arduino board for parellel - serial conversion. It was simple and handy.  He made it for jedicut but I think it can be extended to another software.

Another one is arduino g-code interpreter for reprap 3D printer project. You can google so many arduino based cnc interface board. Arduino is good because it doesn't require heavy knowledge about software or electronics. It is very simple to develop and price is not expensive. You can buy it easily via internet.

I want use my cnc engraver easily with laptop. So I decide to make my own version of arduino serial - parallel convertor.


Above, a parallel cable is connected to cnc engraver and a usb cable is connected to laptop. I don't have db25 female connector, so I had to wire it using hand wrapping tool.

It worked as I expected. It receives data from laptop via usb cable. It recognizes only six command 1,2 for x axis movement, 3,4 for y axis, 5,6 for z axis.

I can write g-code interpreter for arduino, but it will be waste of time because someone else already released good program. I made g-code interpreter on laptop. It interprets g-code and send six command(1,2,3,4,5,6) to ardunio. It just fits my need.

Currently only three g code supported. f, g0, g1. It may be enough for common operation. For example, py-cam g-code output is mainly made of above 3 commands in 2d engraving, so I was enable to use py-com g-code to my laptop software without modifying it. Another command can be implemented easily, but I am currently busy so I have no time to improve my project. I want share this project someday, but unfortunately, my program source is commented with Korean letters, most of them may not be readable.




About myselft

I am mainly software developer, mainly client environment like pc, android, ios, web client and also web server environment like servlet, application server, database. But when I have time to spend for myself, I like to compose music, play guitar and enjoy making fun things - wood/plastic craft, electronics, and more.
I was born in 1967. I have married and have two sons. I live in Seoul which is pretty good place to live.