admin

admin

Saturday, 13 October 2012 22:51

USB Audio Adapter work with OpenWRT

This article shows you how to play audio from a USB audio device which is connecting to a TL-LINK TL-WR1043ND wireless router.
 
Prerequisite
  • Wireless router flashed with OpenWRT. This project based on TP-LINK TL-WR1043ND wireless router.
  • USB audio adapter which supported by Linux. As shown in figure below is the USB sound audio that I'm using.
Wednesday, 03 October 2012 16:26

8 Channel Relay Box

This is a 8 channel relay box that the input connect to a controller allow it to control large loads like home appliances.
 
I'm using this relay box for a snooker centre to control snooker table lamps. The lamps consists of 6 pieces 20W and 3 pieces 10W fluorescent lamps, total of power consumption is 150W per table. Picture below shows the snooker table lights for the snooker centre.
Tuesday, 25 September 2012 20:53

Wireless Router Home Automation

This project eliminate the use of an expensive Wifi/Network Shield but still able to control home appliances from any where. You may already own a wireless router which support OpenWRT or else you can get a very cheap wireless router such as WR703N for this project.
 
In order to eliminate install many packages on the router, I am using HTML and Javascript for the web interface, while hardware interface is using Lua which is come with OpenWRT. The whole process is just install a serial driver (see step below) to make the instruction simple & keep the router free of resources.
Friday, 21 September 2012 10:45

Lua sleep function in milliseconds

Lua Socekt must be use in order to call sleep function in milliseconds.

An example to install Lua Socket to OpenWRT

opkg update
opkg install luasocket

 

An example to sleep 10 milliseconds

require "socket"
socket.sleep(0.010)

 

Lua can only sleep/wait in seconds (not milliseconds) without install Lua Socket. Code below shows the sleep funciton.

function delay_s(delay)
   delay = delay or 1
   local time_to = os.time() + delay
   while os.time() < time_to do end
end

 

Example to sleep 5 seconds

delay_s(5)

 

 

A few ways to send message to serial port of router which flash with OpenWRT. PHP;ser2net; socat; Lua and etc.
  • PHP require to install lighttpd,lighttpd-mod-cgi,lighttpd-mod-fastcgi,php5-cgi,php5-fastcgi,libsqlite3, installation is complicated & consume resources.
  • ser2net/socat is very simple but did not support web service.
  • Lua comes as a default in openWrt and support web service. The goodies is OpenWRT using Luci for web GUI and LuCI is an embedded rapid application development framework written in Lua.
Prerequisite
Thursday, 13 September 2012 15:46

Softaculous AMPPS Web Server

I'm testing Softaculous AMPPS for my web server, by far it is working very well.
 
Web Server software that I had tested
WampServer is my first web server software, I change to EasyPHP until I replace my notebook.

EasyPHP: http://ediy.com.my/index.php/blog/item/14-easyphp-web-server-winxp
I use EasyPHP since WampServer is not working on my Toshiba notebook.
 
AppServ: http://ediy.com.my/index.php/blog/item/21-appserv-seb-server
I didn't use AppServ for my projects, because the PHP version is either too old or too new that it is not suitable for my website.

Softaculous AMPPS: http://www.ampps.com/
Finally I use AMMPS since EasyPHP did not display pictures for most of the Joomla slide extensions. 
Saturday, 08 September 2012 19:20

D-LINK DNS-320 Firmware Upgrade from 2.00 to 2.02

I read a post about the D-LINK DNS-320 firmware version. It shows that there is new version released from D-LINK website. So I decided to give a try.
 
Download
Make sure backup all data before firmware upgrade. After upgrade the firmware, the DNS-320 performance become very slow. I had to re-format the HDD and install software again in order to solve the problem.
Friday, 07 September 2012 23:01

OpenWRT in Client Mode

Client mode uses its wireless connection as the WAN interface, and shares the internet connection only to the LAN ports. It is not seen as an access point by laptops or other computers scanning for AP's and does not accept wireless connections from client devices.
 
As shown in figure below, the new SSID (wwan) cannot be seen by other client devices nor accept wireless connection from client devices. Therefore the client devices (Notebook3 and Notebook4) must connect to the Wifi router using network cable.
Monday, 03 September 2012 11:04

Fun_plug 0.7 installing Packages

Additional fun_plug packages (eg. LAMP, Transmission client, etc) can be install/uninstall after installing fun_plug. Article below show you how to install additional packages to fun_plug 0.7. You should read this article if you want to know more about fun_plug.
 
Pre-installation Requirements
  • D-LINK DNS-320 ShareCenter.
  • A working fun_plug 0.7 installing on D-LINK DNS-320 ShareCenter.
Sunday, 02 September 2012 17:49

Fun_plug 0.7 on D-LINK DNS-320 ShareCenter

This article provide the step to install fun_plug 0.7 on D-LINK DNS-320 ShareCenter. Fun_plug allows user to start additional programs and tools on the NAS.
 
Pre-installation Requirements
  • D-LINK DNS-320 ShareCenter
  • Hard Disk Configure as Volume_1: Standard as shown in figure below
Sunday, 02 September 2012 14:52

Connecting ULN2803 Line Driver to Arduino

If you are using Arduino (or any other TTL device) to control 4 channel relays or more, I would suggest to use ULN2803 Line Driver instead of Transistors or FETs. You can use ULN2003 which is much more cheaper if you plan to use not more than 7 channel relays.

The ULN2803 Integrated Circuit (IC) is a "Eight-way Line Driver". It allows you to interface TTL signals (5v) with higher voltage/current (50V/500ma) loads.

As shown in figure 1 and figure 2, an Arduino is control 8 relays, one using ULN2803 line driver and the other one using transistors, both circuit are equivalent.

This is an article to guide you on how to use a webcam attach to a router and act as an IP camera. At the end of the article, it show you how to adding authentication to the project.
 
 Prerequisites
Saturday, 25 August 2012 12:49

TP-LINK TL-WR1043ND router as a Print Server

This article shows the step on how to setup the TP-LINK TL-WR1043 router as a print server. The USB printer is connected to the USB port of router in order to support print sharing from network.
Wednesday, 22 August 2012 15:49

OpenWRT in VirtualBox

If you are considering to test OpenWRT without a router or you don’t want to flash the router firmware over and over again. Here is the right place for you.

OpenWRT in VirtualBox is an image file run in VirtualBox. By the time I write this article, the VirtualBox & OpenWRT image version are Ver 4.1.20 and 10.03.1 respectively. 

Tuesday, 21 August 2012 21:09

OpenWRT Dynamic DNS

Dynamic DNS allows that your router can be reached with a fixed hostname while having a dynamically changing IP address.

Dynamic DNS is a must if you want to control your devices/network over the internet with dynamic IP address in your Local Area Network. Read this article for more about Dynamic DNS and Port Forward.

OpenWRT come with a package called luci-app-ddns but is not install by default. We must install the luci-app-ddns package in order to enable the Dynamic DNS service.

Samba is a free software re-implementation of the SMB/CIFS networking protocol, Samba provides file and print services for various Microsoft Windows clients.

First, this assumes that you already have OpenWRT installed. Read this article if you haven't upgrade firmware to OpenWRT.

Second, you must have a working USB flash drive attach to router. Read here for installing USB flash drive.

FTP is a method of transmitting or recieving files across the Internet and stands for File Transfer Protocol. This article guide you on how to enable FTP  function on the OpenWRT router.

It is assumed that the router is flashed with OpenWRT. See this article if you haven't upgrade firmware to Openwrt.

The more packages you install on your OpenWRT, the more space you need. It's useful to extend the storage capacity of your USB enabled OpenWRT router.
 
This article explain how to use a flash drive as a storage installing in TP-LINK TL-WR1043ND router. It is assumed that the router is flashed with OpenWRT. See this article if you haven't upgrade firmware to Openwrt.
Sunday, 19 August 2012 12:13

16 Output Arduino Controller

The is a sketch for Arduino to communicate with computer or embedded device (eg. wireless router) using serial communication.
 
Arduino Duemilanove have 14 digital IO pins (2 digital IO used by serial) and 6 analog IO pins. Here I coded the analog IO as digital IO, so we can easily get 16 digital IO.
Saturday, 18 August 2012 18:42

WinSCP (Windows Secure CoPy)

WinSCP is an open source free SFTP client, SCP client, FTPS client and FTP client for Windows.

Most people use vi as the text editor during configuration of embedded device. I hate to use vi, in which I have to memorize all the commands. Whereas WinSCP is a GUI (Graphical User Interface) program where you can edit your file like notepad. Additionally you can use WinSCP to download and upload files including settings of permission.

TP_LINK TL-WRT1043ND router and OpenWRT is use in this tutorial.

Thursday, 16 August 2012 14:40

Integrating PuTTY in WinSCP

Most of the time, I use both WinSCP (Windows Secure CoPy) & PuTTY together, especially when work with Openwrt and DD-Wrt. It is very troublesome to start each program individually. So I decided to integrate PuTTY into WinSCP.

 

WinSCP is an open source free SFTP client, SCP client, FTPS client and FTP client for Windows.

http://winscp.net/

 

PuTTY is a free implementation of Telnet and SSH for Windows and Unix platforms.

http://www.chiark.greenend.org.uk/~sgtatham/putty/

 

I would suggest to download the portable version for both WinSCP & Putty. With the portable version, you can easily copy WinSCP & PuTTY from one computer to another computer without erase the settings.

Here is the link for partable WinSCP & Putty:

http://portableapps.com/news/2012-07-29--winscp-portable-4.3.9-released

My previous article Control Arduino via PHP (EasyPHP) control Arduino from a computer with web server. Another article Control Arduino with TP-Link TL-WR1043ND Router which the Arduino is connecting to the router, but it is not safely to control over the internet.

 
Now I want to control Arduino without a computer and it is very safely control over the internet. Here is the step.
Saturday, 11 August 2012 14:02

AppServ Web Server

Before reading this article, you may want to know EasyPHP web server that I setup previously, please refer this page http://diy2u.weebly.com/1/post/2012/07/winxp-easyphp-web-server.html.

 
I'm installing Apserv web server today (11/08/12) due to EasyPHP web server did not display any image slide from my computer.
 
I tested 4 different versions of EasyPHP from EasyPHP-5.3.9 to the latest EASYPHP 12.0, and also tested with different browsers, but I had no luck to make it work. 
 
I confirmed that it is not the Joomla problem, because the same webpages can run on my website (the webpages that you are seeing now). I suspected it must be something wrong with the library settings or the EasyPHP configuration, but I don't want to spend too much of time to figure it out.
This tutorial is intended to show you how to open ports (also call virtual server) on your router so that you can control/link your device over the internet. I would suggest to undestand what is IP address if you don't know what is Private IP and Public IP address.
 
In short Public IP is for outside organisation and Private IP is for inside organisation.
 
This guide is based on TP-LINK TL-WR1043ND wireless N router with original firmware. Assumed using the following settings. You might want to know what is Dynamic DNS on OpenWRT.
  • TL-WR1043 router IP address: 192.168.1.1
  • Device to be control (IP address) : 192.168.1.49
  • Device to be control (Port) : 455
 
Digisnap 2000 (Electronic shutter release) is powerful but expensive. This project replacing Digisnap 2000 with very simple function.
Sunday, 29 July 2012 12:06

Delphi Auto Backup

This is an auto backup and restore program with time schedule. I developed this program in year 2009 for my office.
Software & Components for developing
1. Delphi 7
2. EhLib
3. Zip Master
4. Cool Tray Icon
 
Download
Sunday, 29 July 2012 11:56

Cheque Printing Software

This is a program for those who want to print a lot of cheques.

Software & Components for Developing

1. Delphi 7
2. Fast Report
3. EhLib
 

Downloads
Source Code: http://www.divshare.com/download/18624628-375
Compiled Executable Files: http://www.divshare.com/download/18625292-ccf
 

How to Install

  1. Download the Compiled Executable Files program & save it to any folder. 
  2. Run ChequeP.exe


How to use

  1. Run Cheque.exe to open main window
  2. Click on New button to prepare first batch of cheque.
  3. Now you can enter cheque particulars from the main window
  4. You can enter as many cheques as you want before print
  5. Click on Print Current button to print selected cheque
  6. Click on Print All button to print all cheques
  7. Click New button again to prepare next batch of cheque, all existing cheque particulars is backup-ed

 

  • Tracking button is use to display all cheque particulars being enter previously. The top empty row is use for filtering
  • Design button is use for cheque print out design
  • Payees button is use to enter payees information so that payees name can be select from main window
Sunday, 29 July 2012 11:19

Control Serial via PHP

It is simple to control serial via PHP.

<?php
exec("mode com4: BAUD=9600 PARITY=n DATA=8 STOP=1 to=off dtr=off rts=off");
$fp =fopen("com4", "w");
//$fp = fopen('/dev/ttyUSB0','r+'); //use this for Linux
fwrite($fp, "string to send"); //write string to serial
fclose($fp);
?>

Sunday, 29 July 2012 11:04

Control Arduino via PHP (EasyPHP)

The Arduino Duemilanove (not Arduino Uno) is control by a computer over the network or internet via PHP. This article assumed that you already install WAMP web server & Arduino driver in your computer.

My Arduino Duemilanove is connecting to the USB port of my computer, the USB serial com port is detected as COM4.

Sunday, 29 July 2012 10:55

EasyPHP Web Server (WinXP)

WampServer is my favorite personal local web server before my Sony Vios notebook get spoil. Now I switch to EasyPHP due to WampServer is not running on my new Toshiba notebook.

I had do a research before I stick into one particular web server software, here you can get some web server information. After study some post from internet & tested myself. Finally EasyPHP is my choice.

 

EasyPHP is a wonderful WAMP server application. With EasyPHP, you will have PHP,   MySQL , Apache,  PhpMyAdmin, Xdebug on your computer.   

I start using EasyPHP from version 5.3.9. Now it is EASYPHP 12.0 and there is three different PHP version including in EASYPHP 12.0:

Original project is on http://www.circuitcellar.com/avr2006/winners/AT3296.htm published in AVR contest 06 by Steven Savage. But the link is not available any more. 

The interface plugs into a PS2 keyboard port on the PC and accepts commands from the infrared remote. I'm using an ordinary DVD remote (38KHz) to control my computer.   


The original schematic is not correct, I had make the correction for PC Data & PC Clock of SV1.
Source Code and Compliled Hex file: infra-red ps2 keybard atir.zip
Sunday, 29 July 2012 09:57

Run Android 2.3 on VirtualBox

This guide is based on Android 2.3 (Gingerbread)  & VirtualBox 4.1.8 running on Microsoft Windows XP.

I choose Android 2.3 because I own a Samsung GALAXY Y (S5360) hand phone which preloaded with Android 2.3. I always test the applications on my computer before I download to the hand phone.

Fun_plug is a collection of applications compiled and packaged by fonz. fun_plug is install on top of D-Link firmware. It is much more powerful than the D-Link original firmware. The following modules is install by default:

  • Lighttpd – a lightweight HTTP server for hosting web pages on the NAS
  • OpenSSH – Secure Shell (which you already used to login to the NAS)
  • Mediatomb – a UPnP media server (alternative to the one provided by Conceptronic)
  • NTP – Network Time Daemon (to synchronize the NAS’ clock with accurate time servers on the Internet)
  • UNFS3 – user-space NFS server (a file server protocol which is often used by computers running Linux)
  • NFS-Utils – NFS server (efficient file transfer and synchronization utility)

This guide is based on fun_plug 0.5 & D-Link DNS-320 ShareCenter and assumes an SATA hard disk is installing to the DNS-320 ShareCenter formatted as ext3.

This is a guide on how to restore from DD-WRT to the original stock firmware. The router that I'm using is TP-Link TL-WR1043 Ver 1.8. 
 
Download
 
Software required
  • WinSCP is an open source free SFTP client, SCP client, FTPS client and FTP client for Windows. Its main function is file transfer between a local and a remote computer. I use this sofware to transfer files from my WinXP computer to the router.
  • PuTTY is a free implementation of Telnet and SSH for Windows and Unix platforms. I use this software to SSH to router & perform flashing command. 
 
Enable SSH
  1. Open up a browser and navigate to http://192.168.1.1 (you should use your own IP)
  2. Login in to DD-WRT.
  3. Goto Services tab and enable SSH
  4. Goto Administration/Management and enable SSH

Copy firmware file to Router

  1. Unzip the downloaded firmware file to any folder, now you have wr1043nv1_en_3_13_10_up(120210).bin in your computer
  2. Run WinSCP
  3. Transfer wr1043nv1_en_3_13_10_up(120210).bin to /tmp of router
  4. You may want to rename the firmware filename to shorter one, I renamed it to a.bin

Start Flashing
  • Run PuTTY (SSH to router)
  • Enter command as blow

cd /tmp

mtd -r write a.bin linux

The router will reboot upon flashing successfully

This tutorial show you how to install PHP on the TP-Link TL-WR1043ND router.

I assume you already have a working installation of OpenWRT on your router. Click here for more about OpenWRT.

You can refer to my previous post http://ediy.com.my/index.php/blog/item/2-openwrt-on-tp-link-tl-wr1043nd-router to upgrade firmware to OpenWRT.


After upgraded the router firmware to OpenWRT backfire, SSH to the router. For Microsoft Windows, I always use PuTTY. You can download PuTTY from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Sunday, 29 July 2012 08:56

DD-WRT on TP-Link TL-WR740N Router

The TP-Link TL-WR740N router use in this tutorial is Ver 4.22. Make sure you download the correct version of firmware. Flashing wrong version firmware will brick the router.

Here is the link. You must download both factory-to-ddwrt.bin & tl-wr740nv4-webflash.bin.


You must upgrade to factory-to-ddwrt.bin before you flash tl-wr740nv4-webflash.bin.

1. Enter 192.168.1.1 from IE to login to the router. Select System Tools then click on Firmware Upgrade.
2. Choose  factory-to-ddwrt.bin which you download to your computer previously.
3. Click Upgrade button to start firmware upgrading.
4. The router will restart automatically after completed upgrade.

Screen shot for upgrade firmware: http://www.divshare.com/download/18183284-fed


5. Login to router again. Now DD-WRT prompt you for changing user name & password.
6. Enter the new router user name & password then click on Change Password button.
7. Enter new user name & password to login to the router.
8. Click on Administration from DD-WRT menu then select Firmware Upgrade.
9. Choose tl-wr740nv4-webflash.bin & click on Upgrade button

The router will upgrade to DD-WRT dated 03-19-12-r18777 which is much more powerful than before.

The Arduino is plug into the USB port of TP-LINK TL-WR1043ND allow the router to control the Arduino.

After upgrade router firmware to Openwrt, Login to it & change the password in order to enable SSH.

SSH to the Router

  1. Run PuTTy
  2. Enter 192.168.1.1 for Host Name (this is the default IP for Openwrt set in TL-WR1043ND)
  3. Change connection type to SSH
  4. Click on Open button
  5. Enter your router username (username is root if you didn't change it)
  6. Enter your password
Saturday, 28 July 2012 16:34

HTML Onclick Image Button with CSS

This is a tutorial to show image button on webpage, it use CSS.
See http://www.w3schools.com/css/default.asp for more information.

Below is an example to show two image buttons. <div class="img"> is the CSS, it is not define in this example, but it is working without any CSS style.

</html>
</body>
<div >
<a target="_parent" href="/newWebPage.php"><img src="/images/light_on.png" alt="Light1" /></a>
<a href="javascript:runCmd(1,'a')"><img src="/images/fan_on.png" alt="Fan1" /></a>
</div>

<div >
<a target="_parent" href="/newWebPage.php"><img src="/images/light_off.png" alt="Light2" /></a>
<a href="javascript:runCmd(1,'a')"><img src="/images/fan_off.png" alt="Fan2" /></a>
</div>
</body>
</html>

 

Saturday, 28 July 2012 16:33

HTML Onclick Button Image

There is few ways to show image button on the webpage. Here I use <a.

<a target="_parent" href="/newWebPage.php"><img src="/images/light_on.png" alt="Light" /></a>


Above example shows an image with event. newWebPage.php will open if user click on the image.

  1. target="_parent" means open a new page when user click on the image. See http://www.w3schools.com/tags/att_a_target.asp for more information
  2. href= is the action. It will open newWebPage.php when user click on the image.
  3. img src= show the image on the page. It support many formats such as png, jpg, gif, bmp & others. I often use png & gif (animation) format since both support transparent.
  4. alt= will show the text if the associated image is not exist.

 

Note: IE8 and Google Chrome show output differently. There is a rectangular frame around the image if loaded with IE8, while Google Chrome did not show any frame.

Below example execute a javascript function called runCmd with two parameters:

<a href="javascript:runCmd(1,'a')"><img src="/images/fan_on.png" alt="Fan" /></a>



See http://www.w3schools.com/tags/tag_a.asp for more information on how to use <a

Below example shows four images aligned in horizontally:

<a target="_parent" href="/newWebPage.php"><img src="/images/light_on.png" alt="Light" /></a>
<a href="javascript:runCmd(1,'a')"><img src="/images/fan_on.png" alt="Fan" /></a>
<a target="_parent" href="/newWebPage.php"><img src="/images/light_on.png" alt="Light" /></a>
<a href="javascript:runCmd(1,'a')"><img src="/images/fan_on.png" alt="Fan" /></a>

Thursday, 26 July 2012 23:12

Openwrt on TP-Link TL-WR1043ND Router

OpenWrt is a highly extensible GNU/Linux distribution for embedded devices. After upgrade your router to OpenWRT, your router will become much more powerful (more features) than before.
Page 3 of 3
Back to Top