Monday 22 December 2014

Fixing an LED headtorch

I purchased an LED headtorch that has an adjustable lens. When the lens was pulled out to focus it, a plastic ring would dislodge and block the LED. The fix was simple: glue the plastic ring in place with a hot glue gun.


The lens unscrews off, in the middle is the plastic ring. I'm not sure what the ring does, but I think it helps direct the light from the LED, and/or keeps the LED board pressed down at the right angle.


The ring glued into place.

Thursday 20 November 2014

Repair of a cheap chinese Ni-MH battery charger

The AC cord terminals on this charger were not soldered properly from the factory, and over time they came loose. The fix, of course, was to solder them back on.


The screws are hidden under a sticker.

Three screws and some plastic clips join the two halves of the case together.


The pins at the bottom left are the AC terminals. They are supposed to sit to the left of the yellow capacitor.

The reverse side of the board.

The pins after being soldered back in. Better than new!

Wednesday 27 August 2014

Monday 12 May 2014

Sharing one wifi adapter with many devices

Diagram of the network. The dotted lines are wifi connections, and the continuous line is an Ethernet cable



Why: The area where I live currently has free wifi internet for anyone to use, however the signal is very weak, and only one of my wifi devices (a TP-Link TL-WN722N USB wifi adapter) can receive the signal.
I want to be able to share the "free wifi" network with all of my devices.
This allows me to get rid of my terrible, overpriced, unreliable Telstra Bigpond ADSL.

How: I have the TP-Link TL-WN722N plugged into a Toshiba Tecra M5 laptop running Debian Stable. There are two network adapters connected to the laptop; the TP-Link TL-WN722N USB wifi adapter, which is labelled  "wlan2", and a built-in Ethernet port, labelled "eth0". The Ethernet port on the laptop is connected to the WAN port on my Belkin wireless router. The laptop is configured as a router which sends IP packets between the "wlan2" and "eth0" networks. This means that any device connected to the Belkin router (by a wired or wireless connection) will be able to access the internet through the "wlan2" adapter on the laptop.

The following instructions could serve as a basis for your own configuration.
The instructions should work on any Debian-based Linux distribution, but other distros may have things (such as the /etc/network/interfaces folder) configured differently.  Note that you should change "eth0" and "wlan2" to match your own network interface names. If you are confused about any of these steps, the list of useful links at the bottom of the page may help you.

The laptop is configured using the following steps:

1. Enable IP packet fowarding:
Open the file /etc/sysctl.conf in your preferred text editor, and add (or uncomment) the line net.ipv4.ip_forward = 1

2. Install dnsmasq:
You can do this by entering the following in a terminal: sudo apt-get install dnsmasq

3. Configure dnsmasq:
dnsmasq needs to be configured to serve IP addresses to a device conneced to the "eth0" network (in my case, the Belkin wireless router). To configure dnsmasq, add the following lines to /etc/dnsmasq.conf

interface=eth0
dhcp-range=192.168.1.100,192.168.1.200,24h



4. Configure the "eth0" interface with a permanent IP address
This is done by adding the following lines to the file 
/etc/network/interfaces

auto eth0
iface eth0 inet static
      address 192.168.1.1
      network 192.168.1.0
      netmask 255.255.255.0
      broadcast 192.168.1.255


5. Reboot the laptop

6. Create an IP packet routing script:
The following script will tell iptables to do the packet routing between the "wlan2" and "eth0" networks. To create the script, create the file /etc/network/router_firewall and add the following:

#!/bin/bash
#
# script for source Network Address Translation using iptables
#

iptables -F
iptables -t nat -F
iptables -X

iptables -N val_input
iptables -N val_output

# allow packets with NEW, ESTABLISHED and RELATED states
iptables -A val_input -m state --state NEW,ESTABLISHED,RELATED -i lo -j RETURN
iptables -A val_output -m state --state NEW,ESTABLISHED,RELATED -o lo -j RETURN

iptables -A val_input -m state --state NEW,ESTABLISHED,RELATED -i eth0 -j RETURN
iptables -A val_output -m state --state NEW,ESTABLISHED,RELATED -o eth0 -j RETURN

iptables -A val_input -m state --state NEW,ESTABLISHED,RELATED -i wlan2 -j RETURN
iptables -A val_output -m state --state NEW,ESTABLISHED,RELATED -o wlan2 -j RETURN

iptables -A val_input -j DROP
iptables -A val_output -j DROP

iptables -A INPUT -p tcp -j val_input
iptables -A OUTPUT -p tcp -j val_output

iptables -t nat -A POSTROUTING -o wlan2 -j MASQUERADE
# End of script



The script needs to be given executable permissions by entering the following into a terminal:  sudo chmod +x /etc/network/router_firewall

The script must be executed for the routing to work. This can be done manually by entering the following in a terminal: sudo /etc/network/router_firewall

7. Setting up DNS nameservers:
I changed the DNS nameserver settings on the Belkin router to "8.8.8.8" and "8.8.4.4", which are google's nameservers. 

Useful external links:
http://www.softprayog.in/troubleshooting/connecting-two-computers-with-ethernet-lan-cable 

http://www.cyberciti.biz/faq/linux-list-network-interfaces-names-command/ 

http://man7.org/linux/man-pages/man8/ifconfig.8.html 

http://manpages.debian.org/cgi-bin/man.cgi?query=iptables 

http://www.softprayog.in/tutorials/iptables 

http://www.unix.com/man-page/linux/5/interfaces/ 

http://en.wikipedia.org/wiki/IP_address 

http://en.wikipedia.org/wiki/IP_packet 

http://en.wikipedia.org/wiki/Dns 

http://www.cyberciti.biz/tips/linux-how-to-run-a-command-when-boots-up.html 




Saturday 25 January 2014

Enabling multiple users on Android 4.2.2

Android 4.2.2 introduces a new multiple users feature, which allows many people to share the same device, but have separate user accounts. Each user account can have its own wallpaper, browser history, apps, email accounts, google accounts etc. much like the user accounts on, for example, a PC. Each user can login from the lockscreen, and each account can be locked with any of the normal methods, such as a password or a pattern.

Most tablets with Android 4.2.2 already have multiple users enabled. However, some tablets such as my Pendo PNDPP410GPBLK have this feature disabled, and it also seems to be disabled on phones.

To enable multiple users, your device must be rooted. You also need a terminal app such as Android Terminal Emulator. The following instructions should work on both phones and tablets. Be aware that, while these instructions worked for me, there may be a small chance that something could go wrong, so having a backup of your device's ROM would be useful, just in case. Here are the steps:

1. Open up your terminal app, and type the command "su" (without quotes, and you need to press enter after typing each command).

2. Type  "pm get-max-users". This command will show the maximum number of users the device currently allows. If this command returns an error instead of a number, your ROM probably does not have any multiple user functionality, and the following instructions may not work.

3. Type "mount -o rw,remount /system". This allows you to write to the system files until the next reboot, which is necessary for the following command. 

4. Type "echo fw.max_users=4 >> /system/build.prop". This sets the maximum number of users the device allows, and you can change the number 4 to whatever number you want.

5. Reboot your device.

6. The Users section should now be in the Settings app, under "DEVICE". You should be able to add a new user by tapping on "ADD USER".


Friday 24 January 2014

How to root a Pendo Pad PNDPP410GPBLK 10.1" tablet

I recently purchased a Pendo Pad PNDPP410GPBLK from Officeworks. It is a 10.1 inch Android 4.2.2 tablet that is based on the Rockchip RK3168 SoC. If your tablet has the model number PNDPP410GPSLV, then it is the white version of the same tablet.

These instructions may also work on other Rockchip based devices.

I could not find a working method to root this tablet using Linux, so here are the steps for rooting this tablet successfully using Windows:

1: You need to enable the Developer options. Go to the Settings app. Tap on "About tablet", then tap on the Build number seven times until a message is displayed saying "you are now a developer". The "Developer options" section will now be displayed in the Settings app.

2: Tap on "Developer options". Make sure "USB debugging" is enabled.

3: You now need to install the Rockchip device drivers on Windows. Go to this link to download RK Driver Assistant. This program should automatically install the correct drivers for your device.

4: Go to the Device Manager in Windows. Right click on your tablet, and click "Update driver software".

5: Download and install "Kingo Android Root" on Windows. This program should root your tablet. If Kingo Android Root does not find your tablet, try rebooting and/or plug the tablet into a different USB port.

You should now have root access on your tablet.