Sunday, October 4, 2009

Home UPS part 2

there are two ways to do this. the 1st is http://icrontic.com/articles/super_ups, a great artical on home UPS where the guy just bought an inverter and a bunch of batteries and tested how long it took for the batteries to die.

My way, not perfected yet as I am still learning, is based on numbers. After writing this, I have decided that maybe its a better way without numbers. just do it. read the web site. but i will explain a few things here.

So in the previous article I was saying kettels should not be run off the UPS. The reason being is that a home UPS is made up of deep cycle batteries, not your normal car battery. Deep cycle batteries a typically used for a long release with no spikes in power consumption, as in golf carts. The reason golf carts have a limiter too, that way there there is a constant current, stopping starting and accelerating will decrease the life of your battery. A car battery on the other hand is is used for a power start, quick high current for a short period of time. It should never drop below 80% voltage.

Basically we need to find out the amount of watts we will be using in the period the power will be off. I will be using lights, microwave, a computer, adsl modem, wireless router, satellite, dvd player, tv, decoder and a few plugs for charging laptops and mobile phones. i will add their consumptions together, multiplied by the minutes per hour i will be using them divided by 60. it would look like this... a little (25W*8 lights) *60/60, on all the time, 850W * 15min cooking time / 60, ......

This will give us a max wattage. Ill come back to this in another article.

Another thing you should know, store your batteries in a garage. hydrogen is expelled into the atmosphere when using wet batteries. the cheaper of the lot (gell cell and dry cell although better for safety and deep cycle) and make sure there is some way of venting. a little fan would be nice, but potential sparks can be hazardous. being in a garage there is enough movement to disperse the hydrogen sufficiently.

Sometimes this gas rusts and corrodes metals, watch out for this. it can save your life to catch it before it catches you.



these are two threads from the website above. valuable info! very valuable

You're right about it being a bad idea to add more batteries in series, but actually, I think you'll get BETTER than three times the runtime by tripling the number of batteries. ( Pairs of batteries in parallel, that is two batteries in series for 24V, and those pairs each in parallel )

like this:

-[__UPS___]-

-[bat]-[bat]-

-[bat]-[bat]-

-[bat]-[bat]-

Battery or wiring resistance should only go down since the pairs ( two batteries in series ) are connected in parallel. The one part of the string where the current is flowing through single wires shouldn't have any more current than a single pair.

Besides, if you're getting significant resistance from the wiring, it's too small, at least at this scale.

Next, battery capacity goes UP when you lower the demand. ( I can't post a link, I'm too new. Look up "Peukert's Law" on Wikipedia to learn more and see the equations...)

The numbers below are made up, but they illustrate the principal. The actual equation will vary a lot with battery chemistry and construction. Flooded lead acid batteries are affected by this more than sealed lead acid batteries.

Batteries are normally rated for a 20 hour discharge. That is to say a 100Ah battery is rated to deliver 5A for 20 hours when tested to full discharge.

If you pull the power faster, you get less power out of the battery. If you drain the battery in 10 hours, you might only get 85Ah. If you did it in 5 hours, you might get just 70Ah. If you did it in 1 hour, you might get as little as 50Ah, or just half the energy you'd get in a 20 hour discharge.

Let's apply this to the UPS example. Let's say your UPS draws 50A from a battery to run your stuff.

If you use the 100Ah battery from my example above, a 50A draw will drain the battery in just an hour, since the high current draw will make the battery able to deliver just 50Ah.

However, if you triple the number of batteries ( thus tripling the rated capacity of the batteries ) you get more than 3 times the runtime. Since the drain rate is slower ( at least three times the single runtime...) each battery delivers it's power more slowly and you'll get more out of each battery, perhaps 65Ah. 65Ah time three ( the number of batteries ) is 205Ah. That's a runtime of a little over 4 hours.

So a tripling of the batteries might quadruple the runtime, more or less.

YMMV.


This is a great artical, thanks for the write up mike, I got a great deal on ups's last year i bought a pallet of them from a conpany here in portland when it went out of business and got 14 for 50 bucks, none of whice had good batteries, after wards i bought 7 12V 55 Amp/Hour batteries that were designed for telephone backup systems for 40 Dollars each, i run two mac G4's with 3 14 inch lcd flat screens, each item has its own ups and they all have there own batterys, i get around 12 hours of run time, also dont give up on solar, it works grteat, i have one batteries hooked up to 2 ups that are charged only by a 45watt solar panel setup, and it runs a gaming computer just fine, iv never ran this setup more then a couple hours but its always ready to go when i want it, BTW i live in oregon, USA


One thing I noticed is that, in your diagram of multiple batteries in parallel, you have both leads connecting from the inverter/charger to the same battery. I recently read that in a battery bank the two leads should be connected to opposite ends of the bank; i.e. in your "Parallel battery connection" diagram the negative wire should run from the leftmost battery back to the inverter. Otherwise that right-hand battery gets charged and discharged much more than the others.

Monday, September 28, 2009

Home UPS

Looking at a few UPS sites, http://icrontic.com/articles/super_ups, has set me up with enough info to put my house on batteries. still a few questions I have. can you get deep cycle gel cell batteries? I ask this as I heard lead acid batteries let off a gas that can corrode metals, rust silver, and if not well ventilated can cause a serious fire/explosion risk. If any one can give me a little more info on this it will be great.

secondly, I am looking at attatching my UPS to my distrabution board. supply from main trip to UPS and UPS to trips for lighting and plugs that supply power to the office, and tv and DSTV. kettle too, possibly microwave. maybe jacuzzi, but thats going a little far. Ok the Kettle will have to have its own battery. a car battery to be specific. Watch for part 2 for the explanation.


Any opinions, please! Im not too keen on blowing myself just yet. batteries are pretty scary things to work with

Friday, September 25, 2009

Ubuntu Networking

I have been playing around with my wireless and mucking about with my mac address. these are just a few useful tools I have been using.

I picked these up off the net somewhere, when i find it again I will put the link up. there are many web sites on macchanger.

sudo /etc/init.d/networking start
sudo /etc/init.d/networking stop


sudo ip (Untitled 18) set wlan0 down
sudo macchanger wlan0
sudo ip (Untitled 18) set wlan0 up


machanger package will need to be installed, I normally search for programs in synaptic package manager, and download them from there, unless the link is shown on the page.

MAC Changer Syntax

macchanger [options] device


macchanger eth1


macchanger --endding eth1

Current MAC: 00:09:a5:eb:23:f8 (Hansung Eletronic Industries Development Co., Ltd)
Faked MAC: 00:09:a5:6f:31:23 (Hansung Eletronic Industries Development Co., Ltd)

macchanger --another eth1

Current MAC: 00:09:a5:6f:31:23 (Hansung Eletronic Industries Development Co., Ltd)
Faked MAC: 00:11:18:5b:3a:1f (Blx Ic Design Corp., Ltd.)

macchanger -A eth1

Current MAC: 00:06:5b:f6:f3:48 (Dell Computer Corp.)
Faked MAC: 00:0d:11:93:0c:4f (Dentsply - Gendex)

macchanger -r eth1

Current MAC: 00:0d:11:93:0c:4f (Dentsply - Gendex)
Faked MAC: 3c:f1:89:f9:1f:ce (unknown)

macchanger --mac=01:23:45:67:89:AB eth1

Current MAC: 00:40:96:43:87:65 [wireless] (Cisco/Aironet 4800/340)
Faked MAC: 01:23:45:67:89:ab (unknown)


When you completed the your MAC address changes you need to start/restart the networking service

Friday, July 24, 2009

Upping your Golf

Here is a link to a 7 minute tutorial on how to better your golf game in minutes a day. Click here to view me give a small presentation on how to improve your golf. I post these more out of a reminder for myself, but hopefully going to help a few out there who need a laugh or a better game.

Wednesday, July 22, 2009

My Monkey twitter cam

What it is: It is a web cam set up to spot a change, like a security cam, only I am using it to catch monkeys, or actually just observe them. I have caught one trying to open my sliding window, which makes me think he knows its a sliding window, and he knows how to slide it, he just needs to be a bit bigger, a little more weight, and it unlocked and the guy is in my house chowing bananas and oats, drinking my beer and wine, and really just making a mess. Actually I doubt he can top mine off, maybe he will start tidying the place. Well this is what the cam is for.

Oh to get back to what it does, It then sends the picture to a twitpic site which I created, and set up, and became a fan of. this then updates my actual twitter site, awhich then sends me a text telling me that there has been an intruder.


So I have a laptop running UBUNTU. we need a linux machine for this. I am sure there are ways for windows, but this is free.
My dads web cam, for the life of me i have no idea where mine is..must be in england in some box. cause its sure as hell not here in South Africa.

and a twitter site, actually two twitter sites, which means a secondary email address.


All you need to know is on this web page, http://www.i-hacked.com/content/view/277/42/. this is where i got it from. truelly amazing that it pretty much worked first time.


But I will go through my steps. and usefull commands




Downloaded the motion file and install it


mkdir ~/motion
cd ~/motion
wget
http://prdownloads.sourceforge.net/motion/motion_3.2.11-1.ubuntu.hardy_i386.deb?download
sudo dpkg -i motion_3.2.11-1.ubuntu.hardy_i386.deb


that means the .deb file lands up in the motion folder in your home folder which you created. and the install lands up in /etc/motion/.


ryan@ubuntu-ryan:~$ lsusb
Bus 005 Device 002: ID 050d:805c Belkin Components
Bus 005 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 003: ID 0471:0311 Philips PCVC740K ToUcam Pro [pwc]
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000
ryan@ubuntu-ryan:~$ ls /dev/video*
/dev/video0
ryan@ubuntu-ryan:~$

ok if I have unplugged, and plugged my webcam a few times and video becomes video1 or video2...so on, so make sure of this when getting it to run.


you may need to edit the protection rights on the folder
ryan@ubuntu-ryan:~$ sudo chmod -R 700 motion // or even 777 but try to just sudo edit the motion.conf file

ryan@ubuntu-ryan:~$ sudo gedit /etc/motion/motion.conf
looking at the other web page it seems as their motion.conf is in there home/motion folder. I will need to check that. I just seem to run mine out of the ect. probably very bad security. Anyone would like to comment here?


###############################################

# TwitterSecuritySystem motion.conf
# This config file was created for motion 3.2.11

############################################################
# Daemon
############################################################

# Start in daemon (background) mode and release terminal (default: off)
daemon on

# File to store the process ID, also called pid file. (default: not defined)
process_id_file /var/run/motion/motion.pid

###########################################################
# Capture device options
############################################################

# Videodevice to be used for capturing (default /dev/video0)
videodevice /dev/video0
v4l2_palette 8


#above Here is where i had to play with video.

# The video input to be used (default: 8)
# Should normally be set to 0 or 1 for video/TV cards, and 8 for USB cameras
input 8

# The video norm to use (only for video capture and TV tuner cards)
# Values: 0 (PAL), 1 (NTSC), 2 (SECAM), 3 (PAL NC no colour). Default: 0 (PAL)
norm 1

# Rotate image this number of degrees. The rotation affects all saved images as
# well as mpeg movies. Valid values: 0 (default = no rotation), 90, 180 and 270.
rotate 0

# Image width (pixels). Valid range: Camera dependent, default: 352
width 320

# Image height (pixels). Valid range: Camera dependent, default: 288
height 240

# Maximum number of frames to be captured per second.
# Valid range: 2-100. Default: 100 (almost no limit).
framerate 2

# Minimum time in seconds between capturing picture frames from the camera.
# Default: 0 = disabled - the capture rate is given by the camera framerate.
# This option is used when you want to capture images at a rate lower than 2 per second.
minimum_frame_time 3

auto_brightness off
brightness 0
contrast 0
saturation 0
hue 0

############################################################
# Motion Detection Settings:
############################################################

# Threshold for number of changed pixels in an image that
# triggers motion detection (default: 1500)
threshold 1500

# Automatically tune the threshold down if possible (default: off)
threshold_tune off

# Noise threshold for the motion detection (default: 32)
noise_level 32

# Automatically tune the noise threshold (default: on)
noise_tune on

# Despeckle motion image using (e)rode or (d)ilate or (l)abel (Default: not defined)
# Recommended value is EedDl. Any combination (and number of) of E, e, d, and D is valid.
# (l)abeling must only be used once and the 'l' must be the last letter.
# Comment out to disable
despeckle EedDl

# Ignore sudden massive light intensity changes given as a percentage of the picture
# area that changed intensity. Valid range: 0 - 100 , default: 0 = disabled
lightswitch 0

# Picture frames must contain motion at least the specified number of frames
# in a row before they are detected as true motion. At the default of 1, all
# motion is detected. Valid range: 1 to thousands, recommended 1-5
minimum_motion_frames 1

# Specifies the number of pre-captured (buffered) pictures from before motion
# was detected that will be output at motion detection.
# Recommended range: 0 to 5 (default: 0)
# Do not use large values! Large values will cause Motion to skip video frames and
# cause unsmooth mpegs. To smooth mpegs use larger values of post_capture instead.
pre_capture 0

# Gap is the seconds of no motion detection that triggers the end of an event
# An event is defined as a series of motion images taken within a short timeframe.
# Recommended value is 60 seconds (Default). The value 0 is allowed and disables
# events causing all Motion to be written to one single mpeg file and no pre_capture.
gap 60

############################################################
# Image File Output
############################################################

# Output 'normal' pictures when motion is detected (default: on)
# Valid values: on, off, first, best, center
# When set to 'first', only the first picture of an event is saved.
# Picture with most motion of an event is saved when set to 'best'.
# Picture with motion nearest center of picture is saved when set to 'center'.
# Can be used as preview shot for the corresponding movie.
output_normal center

# The quality (in percent) to be used by the jpeg compression (default: 75)
quality 75

############################################################
# Text Display
# %Y = year, %m = month, %d = date,
# %H = hour, %M = minute, %S = second, %T = HH:MM:SS,
# %v = event, %q = frame number, %t = thread (camera) number,
# %D = changed pixels, %N = noise level, \n = new line,
# %i and %J = width and height of motion area,
# %K and %L = X and Y coordinates of motion center
# %C = value defined by text_event - do not use with text_event!
# You can put quotation marks around the text to allow
# leading spaces
############################################################

# Locate and draw a box around the moving object.
# Valid values: on, off and preview (default: off)
# Set to 'preview' will only draw a box in preview_shot pictures.
locate on

# Draws the timestamp using same options as C function strftime(3)
# Default: %Y-%m-%d\n%T = date in ISO format and time in 24 hour clock
# Text is placed in lower right corner
text_right %Y-%m-%d\n%T-%q
text_event %Y%m%d%H%M%S

# Draw characters at twice normal size on images. (default: off)
text_double off

############################################################
# Target Directories and filenames For Images And Films
# For the options snapshot_, jpeg_, mpeg_ and timelapse_filename
# you can use conversion specifiers
# %Y = year, %m = month, %d = date,
# %H = hour, %M = minute, %S = second,
# %v = event, %q = frame number, %t = thread (camera) number,
# %D = changed pixels, %N = noise level,
# %i and %J = width and height of motion area,
# %K and %L = X and Y coordinates of motion center
# %C = value defined by text_event
# Quotation marks round string are allowed.
############################################################

# Target base directory for pictures and films
# Recommended to use absolute path. (Default: current working directory)
target_dir ~/motion/

# i removed the last / as my pictures were not getting saved

# File path for snapshots (jpeg or ppm) relative to target_dir
# Default: %v-%Y%m%d%H%M%S-snapshot
# Default value is equivalent to legacy oldlayout option
# For Motion 3.0 compatible mode choose: %Y/%m/%d/%H/%M/%S-snapshot
# File extension .jpg or .ppm is automatically added so do not include this.
# Note: A symbolic link called lastsnap.jpg created in the target_dir will always
# point to the latest snapshot, unless snapshot_filename is exactly 'lastsnap'
snapshot_filename %v-%Y%m%d%H%M%S-snapshot


#I also changed the the line above to look like %Y/%m/%d/%H/%M/%S-snapshot

# File path for motion triggered images (jpeg or ppm) relative to target_dir
# Default: %v-%Y%m%d%H%M%S-%q
# Default value is equivalent to legacy oldlayout option
# For Motion 3.0 compatible mode choose: %Y/%m/%d/%H/%M/%S-%q
# File extension .jpg or .ppm is automatically added so do not include this
# Set to 'preview' together with best-preview feature enables special naming
# convention for preview shots. See motion guide for details
jpeg_filename %v-%Y%m%d%H%M%S-%q


#and I also changed the the line above to look like %Y/%m/%d/%H/%M/%S-snapshot

############################################################
# Live Webcam Server
############################################################

# The mini-http server listens to this port for requests (default: 0 = disabled)
webcam_port 0
webcam_quality 50
webcam_motion off
webcam_maxrate 1
webcam_localhost on
webcam_limit 0

############################################################
# HTTP Based Control
############################################################

# TCP/IP port for the http server to listen on (default: 0 = disabled)
control_port 0
control_localhost on
control_html_output on

############################################################
# External Commands, Warnings and Logging:
# You can use conversion specifiers for the on_xxxx commands
# %Y = year, %m = month, %d = date,
# %H = hour, %M = minute, %S = second,
# %v = event, %q = frame number, %t = thread (camera) number,
# %D = changed pixels, %N = noise level,
# %i and %J = width and height of motion area,
# %K and %L = X and Y coordinates of motion center
# %C = value defined by text_event
# %f = filename with full path
# %n = number indicating filetype
# Both %f and %n are only defined for on_picture_save,
# on_movie_start and on_movie_end
# Quotation marks round string are allowed.
############################################################

# Do not sound beeps when detecting motion (default: on)
# Note: Motion never beeps when running in daemon mode.
quiet on

# Command to be executed when a picture (.ppm|.jpg) is saved (default: none)
# To give the filename as an argument to a command append it with %f
# on_picture_save echo I would have said on save %f
on_picture_save perl ~/motion/updateTwitter.pl --username YOURUSERNAME --password YOURPASSWORD --message "At %H:%M:%S Motion Was Detected" --picture %f

# Command to be executed when a camera can't be opened or if it is lost
# NOTE: There is situations when motion doesn't detect a lost camera!
# It depends on the driver, some drivers don't detect a lost camera at all
# Some hang the motion thread. Some even hang the PC! (default: none)
on_camera_lost perl ~/motion/updateTwitter.pl --username YOURUSERNAME --password yourPassword --message "WARNING Camera Was Not Detected"

###############################################################



Then the twitter file saved as updateTwitter.pl

#################################################

#!/usr/bin/perl

use strict;
use LWP::UserAgent;
use HTTP::Request::Common;
use Getopt::Long;

# Values to use when uploading to TwitPic
# You can change these defaults and you can
# override them with the command line options
my $picture;
my $username = 'USERNAME'; # This has to be your twitter username, not your email
my $password = 'PASSWORD'; # Twitter password
my $message = 'New Motion Detected'; # message you'd like to post
my $uploadOnly = 0; # Upload only, don't update Twitter
my $verbose = 0;

# These can be changed if the TwitPic API
# locations change
my $uploadAndPostSite = "http://twitpic.com/api/uploadAndPost";
my $uploadOnlySite = "http://twitpic.com/api/upload";

GetOptions( "help|h|?" => sub { Usage() && exit( 0 ) },
"picture=s" => \$picture,
"username=s" => \$username,
"password=s" => \$password,
"uploadOnly" => \$uploadOnly,
"verbose" => \$verbose,
"message=s" => \$message ) or Usage() && exit( -1 );

if( !$picture || !$username || !$password )
{
print "ERROR: Please provide all required arguments\n";
Usage() && exit( -1 );
}

if( ! -e $picture || ! -f $picture )
{
print "ERROR: The picture you specified $picture doesn't seem to exist\n";
exit( -1 );
}

if( $verbose )
{
print "Attempting to upload pic to TwitPic with the following options:\n";
print "Picture: $picture\n";
print "Username: $username\n";
print "Password: $password\n";
print "Message: $message\n";
print "Upload only: ";
if( $uploadOnly )
{
print "Yes";
}
else
{
print "No";
}
print "\n\n";
}

my $response;
my $ua = LWP::UserAgent->new( env_proxy => 1,
keep_alive => 1,
timeout => 30 );
if( $verbose )
{
print "Uploading picture to TwitPic.com...\n";
}

if( $uploadOnly )
{
$response = $ua->request( POST $uploadOnlySite,
Content_Type => 'multipart/form-data',
Content => [
media => ["$picture"],
username => $username,
password => $password ] );
}
else
{
$response = $ua->request( POST $uploadAndPostSite,
Content_Type => 'multipart/form-data',
Content => [
media => ["$picture"],
username => $username,
password => $password,
message => $message ] );
}

if( !$response->is_success )
{
print "ERROR: There was a problem while trying to contact to TwitPic\n";
die $response->status_line;
}

if( $verbose )
{
print "Done trying to uploading picture, checking response for errors\n";
}

# I guess we could actually use XML::Parser to parse this, but it's kind of
# over kill in this situation
if( $response->content =~ /stat="fail"/ )
{
$response->content =~ /msg="(.*)"/;
print "\nERROR: There was an error uploading your picture to TwitPic\n";
print "INFO: $1\n";
exit( -1 );
}

# If verbose, print out the response, so the user can access the picture
if( $verbose )
{
print "\nUploade successful, here are the details:\n";
$response->content =~ /(.*)<\/mediaid>/;
print "Media id: $1\n";
$response->content =~ /(.*)<\/mediaurl>/;
print "Media url: $1\n";

}

sub Usage()
{
print "\n";
print "updateTwitter.pl --username user --password pass --picture pathToPicture [--message messageToTwitter] [--uploadOnly]\n\n";

print "--username\tYour Twitter.com username\n";
print "--password\tYour Twitter.com password\n";
print "--picture\tPath to the picture you want to post\n";
print "--message\tOptional message to Tweet with your picture\n";
print "--uploadOnly\tUpload to TwitPic.com only and don't Tweet. This will ignore any message passed in\n";

}




##################################################



and to run

ryan@ubuntu-ryan:~$ sudo motion -n -c ~/motion/motion.conf


go check out 6idlewild on twitter to see if any monkeys have arrived.

Good luck. And leave some comments, Im here to learn, and feedback helps.

Tuesday, July 7, 2009

Marine Engineering

This is more to help me
But Coming soon too
Any Marine Engineers please contact me, I need some help with a few past exam papers

UBUNTU

So i have my ubuntu up and running on my hp laptop. Got it up quite easily. My advice is do it with a lan connection. My wireless card was not accepted and i had to boot into windows a number of times to get the info and download the necessary packages. Quite excruciating.

It is now primary and i never enter windows. I link up just fine to my nokia N95, with evolution nicely. I will add the links. To my ipod. Although any tunes i purchased through itunes i just cant play. Damn you apple! And i haven't been able to find a decent online music store yet. Amazon got quite close. But i think they need a lot of work.

Pressing tasks ahead are to actually install backtrack to a virtual drive in sun virtual box, with a live cd image, that way all changes are real.

Get a music player to play through my bluetooth headset. As i want to take the head set apart, solder it to my soon to be portable speakers. And turn them blue tooth.

My speakers i am about to add two cell phone batteries to to make them wireless.

And do more msfexploit. I exploited a window's xp machine, but the session didn't stay up. I need to have a better look.