Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat 23 Aug 2014, 09:21
All times are UTC - 4
 Forum index » Taking the Puppy out for a walk » Misc
My project remote monitoring pc audio and alarm
Moderators: Flash, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [23 Posts]   Goto page: 1, 2 Next
Author Message
AdrianH

Joined: 17 Oct 2013
Posts: 54
Location: Blackburn in the UK

PostPosted: Sat 02 Nov 2013, 05:29    Post subject:  My project remote monitoring pc audio and alarm
Subject description: HP thin clients, icecast, ideas always welcome
 

This project is keeping my mind active, teaching me a few things on computing and Linux so not all bad.

The idea is to have a computer, small and low powered at one location, that is capable of streaming audio to a computer at another, to act as a sort of monitoring or intercom system if needed between my home and another.

There are plans to add a small radio receiver device as used on car alarms or similar and a key fob so when pressed the computer can undertake a string of tasks.

When I got the idea, I picked up a couple of 2003/4 old HP T5700 thin clients for less then the cost of the Raspberry Pi's. They were an ideal candidate for small Linux distro's and I tried several before sticking with puppy.

The units have decent sound cards built in to them giving a watt or so of audio and having a mic boost function to lift the mic gain by 20 dB.

I did struggle with the various flavours of Puppy though until I came across one that SSH server would work. Being an old device I tried wary, then precise and now just tried slacko.

The 5.6 slacko has allowed me to install SSH-srv, and for it to work as is, when enabled, I could not get any other versions to do this.

I have installed icecast, darkice and rsound, enabled SSH and stopped other services such as logging, cups and freq scaling and also stopped it going into X, so it basically now sits here for testing with just a network, power and microphone connection.

The icecast/dark ice streams at 4Kib/s when on, so is not bandwidth heavy, and depending on the audio player I use can get latency less then a second over my internal network.

I also plan to use a package called rsound (rsd & rsdplay) to send return audio when needed, this is heavier on bandwidth at around 15 Kib/s but is quite quick.

The pc draws 12 watts power when running and the processor is running around 7 to 9% usage with SSH/darkice/icecast running, so has plenty of spare, peak load is around 16 watts which is comparable to my old desktop on standby!

I still have plenty to learn to complete. I need to run a script for icecast, darkice and rsound to start up automatically at boot up and shut-down cleanly on power off.

From the remote SSH terminal up to now I have just been using:
# icecast -c /etc/icecast.xml &
# darkice -c /etc/darkice./cfg &
# rsd &

The & running them as daemons, then using top to determine the process numbers to kill them later.

Then it will be on to the radio key fob part, to have the pc detect a button press and then do a string of functions and repeat until action is taken, be it send emails, notify a remote pc or something.

I am open to ideas, someone may know of programs I could use for this, or better ways of going about the project, I am all ears, or eyes in this case.

Cheers

Adrian
Back to top
View user's profile Send private message 
AdrianH

Joined: 17 Oct 2013
Posts: 54
Location: Blackburn in the UK

PostPosted: Sun 03 Nov 2013, 03:51    Post subject:  

I have a script added to rc.local that now runs up the audio packages icecast darkice and rsound, thanks to help from mikeb in the forum help section.

Now to think on what is needed to page me if help is needed, thinking of trying to find a sms gateway, or similar to phones.

Adrian
Back to top
View user's profile Send private message 
01micko


Joined: 11 Oct 2008
Posts: 7794
Location: qld

PostPosted: Sun 03 Nov 2013, 08:24    Post subject:  

Hmmm.. maybe install mailx (formerly nail), and just try to push a message to yourphNumber@yourprovider.com (YMMV).

Failed here but it can take a few hours. Probably not what your after. Unfortunately most gateways require captchas >> requires GUI >> requires a pebkac Sad

On the bright side, since symbian most phones/providers support email, which should be instant, just configure a prominent notification tone on the phone.

Interesting project, glad slacko could be of some use.

_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send private message Visit poster's website 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 11017
Location: Arizona USA

PostPosted: Sun 03 Nov 2013, 08:27    Post subject:  

Just curious, have you tried to get this thing to boot without a keyboard or display attached to it?
Back to top
View user's profile Send private message 
mikeb


Joined: 23 Nov 2006
Posts: 8181

PostPosted: Sun 03 Nov 2013, 09:07    Post subject:  

Shutdown cleanly...hmmm

busybox poweroff works but not exactly clean unless everything runs in ram.
The more normal route has a problem over ssh because of things like the network closing in mid script and no user interaction.... lack of real init and shutdown -h now basically....with slax its no probem. I have tried ways but as ssh is in a sub shell you cannot truly get at init.

Other thoughts...have you played with remote X over ssh?
bit more sophisticated...me had visions of using a vid cam program or even skype that way.

Esd can be used to send sound over ssh though think its incomplete in puppy....perhaps a method to be avoided but thought I'd throw it in there.
all sounds fun
mike
Back to top
View user's profile Send private message 
AdrianH

Joined: 17 Oct 2013
Posts: 54
Location: Blackburn in the UK

PostPosted: Sun 03 Nov 2013, 09:28    Post subject:  

Just lost a reply, thought I sent it, never mind sure it will turn up!

01miicko

I have searched for sms gateways here in the UK and think for the cost of a few UKP for a hundred of so texts I will pay the price, a few of them have a developers contact so I plan to send an email or two to describe what I am trying to do and see if they have a console command I could use. It will take me a while, spending most of my weekends and evenings playing at this.

Flash

yes I have the unit sat here powered up without keyboard, mouse or screen connected, access via remote shell.

In the bios I can set three levels of halt on errors, settings are:
all errors
no errors
all, but keyboard

presently set as all but keyboard.


mikeb

Hi mike thanks for your help. when I mentioned shutdown cleanly, I was assuming that just rewbooting the pc may cause an issue and as I am backgrounding icecast, darkice and rsd assumed I needed to kill them before shutdown or reboot.

I have previously always used top to determine the process numbers and then used kill to stop each one.

It appears that just powering off or rebooting causes no problems or non to date that I can see. I am concerned about file space as the Thin client runs from 256K flash and 512 K ram.

Adrian

p.s.

In case anyone is wondering , this project is for use within my own family, even though there is a fixed land line, a mobile with a panic button (normally to be found in a handbag somewhere in the house) this is to try and give me a bit more peace of mind.
Back to top
View user's profile Send private message 
AdrianH

Joined: 17 Oct 2013
Posts: 54
Location: Blackburn in the UK

PostPosted: Sat 09 Nov 2013, 18:03    Post subject:  

Just an update.

Down to much and I mean much assistance from the forum members, things are progressing.

From the computer I can send perl scripts to the sms gateway and they go through and out to the mobile within seconds, say 6 to 10 seconds so that is working OK.

I can stream audio from the computer and with another bit of software talk back to it, although not to sure about getting it to run on other platforms such as windows etc.

Had a Chinese IP trying to hack through SSH so now have blocked over 130 thousand Ip address from that continent.

I have proved by going to another location that I can access via ssh and things tend to work as expected.

What I can not crack is how to write my own scripts to read the parallel port and then have decision loops to act as the main monitoring part.

At this stage I can not even figure out how to get the number value returned from pin0x379 to be accepted within a Bash script. My books and most of the net seems to show examples of data entry as strings.

But still, I hope to get there.

By the way in case anyone is interested I think of this as more of an embedded project small scale and flash storage.

I picked up a couple of small cards from Ebay, these cards can accept SD memory cards and act like a 2.5 inch IDE drive, so just equipped a card with a 4 GB card and will install into a second thin client and see how it performs. I should be able to do a full puppy install on it.

Adrian
Back to top
View user's profile Send private message 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 11017
Location: Arizona USA

PostPosted: Sat 09 Nov 2013, 21:56    Post subject:  

I hope you aren't getting that assistance via PM. That's not how the forum should be used. Smile

Other people have had trouble booting without a display attached. Did you have to do anything to get it to work?
Back to top
View user's profile Send private message 
AdrianH

Joined: 17 Oct 2013
Posts: 54
Location: Blackburn in the UK

PostPosted: Sun 10 Nov 2013, 05:08    Post subject:  

Flash wrote:
I hope you aren't getting that assistance via PM. That's not how the forum should be used. Smile

Other people have had trouble booting without a display attached. Did you have to do anything to get it to work?


No on both counts! All to be found in either the beginners or regulars section

mikeb and 01micko have been brilliant help.
I guess it is down to computers bios on the screens but, there is generally some way of switching off halt on errors tucked away within bios settings,

Adrian
Back to top
View user's profile Send private message 
mcewanw

Joined: 16 Aug 2007
Posts: 2305
Location: New Zealand

PostPosted: Sun 10 Nov 2013, 05:31    Post subject: Re: My project remote monitoring pc audio and alarm
Subject description: HP thin clients, icecast, ideas always welcome
 

AdrianH wrote:


I am open to ideas, someone may know of programs I could use for this, or better ways of going about the project, I am all ears, or eyes in this case.


I also have a longtime interest in anything to do with remote pc monitoring (video or audio). Vovchik introduced me to a nice commandline email program, which you may find useful at some stage. Link to a version compiled by trapster here: http://www.murga-linux.com/puppy/viewtopic.php?p=730068#730068

I have used this in the past to send motion video surveillance captures at regular intervals to my email account. I have been planning to use it to similarly send mp3 (or ogg) encoded audio, again triggered by some detected motion or audio detected event as part of a home security system.

Many years ago I have also used a pc parallel port to capture hdlc protocol packets with embedded tcp/ip over a satellite link - a simple protocol analyser (on an old 386 pc actually), but that was written in a mix of 80x86 assembler (for speedy capture) and C for processing and display and on msdos of all things (in around 1990...). I haven't investigated reading or writing to pc parallel port from Linux though (indeed pc parallel ports are becoming somewhat rare, which is a pity because they do provide a convenient and simple input/output interface for such projects as yours).

EDIT:

A quick google provided the following links re: parallel port and Linux:

http://www.tldp.org/HOWTO/IO-Port-Programming-6.html

http://yyao.ca/projects/ParallelPortLinux/

http://stackoverflow.com/questions/17851461/how-to-access-parallel-port-in-linux

http://as6edriver.sourceforge.net/Parallel-Port-Programming-HOWTO/accessing.html

http://maxy.homeip.net/old/parport/

http://www.bitwizard.nl/par/index.html

_________________
Non enim propter gloriam, diuicias aut honores pugnamus set propter libertatem solummodo quam Nemo bonus nisi simul cum vita amittit.
Back to top
View user's profile Send private message Visit poster's website 
mikeb


Joined: 23 Nov 2006
Posts: 8181

PostPosted: Sun 10 Nov 2013, 09:28    Post subject:  

Quote:
I hope you aren't getting that assistance via PM. That's not how the forum should be used. Smile

thats what I ended up doing for 2 years Very Happy

Most port usage stuff is based around data transfer...simple on/off less commonly used but looks like some good links there. I was going to suggest a cheap SMBus card otherwise.

A different approach that occured to me... a usb numeric keypad only pad...if you know what I mean.....16 keys could be used as human interface or simply solder wires as keyboard switches and use the ps/2 card as a cheap interface..or cannabalise a junked full keyboard.

mike
Back to top
View user's profile Send private message 
AdrianH

Joined: 17 Oct 2013
Posts: 54
Location: Blackburn in the UK

PostPosted: Sun 10 Nov 2013, 09:58    Post subject:  

I found a lot of the links when searching about linux and the parallel port, hence why I ended up with two executables parashell and pin.

Pin from command line gives the option to read each of the ports associated with the parallel connector such as data port status port command port etc.

An email back from the writer says it does work fine within a sh script?

Still trying that bit.

Adrian
Back to top
View user's profile Send private message 
greengeek

Joined: 20 Jul 2010
Posts: 2478
Location: New Zealand

PostPosted: Sun 10 Nov 2013, 20:00    Post subject:  

How many pins do you need to monitor on the parallel input? If you are only monitoring a single pin (eg monitoring a 'door open' switch or something) there is a way it can be done through usb by modifying a cheap usb keyboard. (SFR wrote some scripts for driving an entire PC via a single switch and I modded a usb keyboard for that purpose)

Or are you using more than one of the signals?
Back to top
View user's profile Send private message 
AdrianH

Joined: 17 Oct 2013
Posts: 54
Location: Blackburn in the UK

PostPosted: Mon 11 Nov 2013, 03:11    Post subject:  

I am initially monitoring just one pin, but the hope is to monitor more. The status port has 5 pins and provides the output as a decimal number combining all 5.

My initial script from last night is:

Code:
#!/bin/sh -x
# run try number 4
# This is a test script
# Pin resides in /bin
# Normal use is pin 0x379  where 0x379 is the status port in hex format
# Can not use port0x379 it has to have the space as the port number is a variable passed to pin
# result shpould be the response typically 120 decimal
# hope to use result as part of a if else and loop

status=0x379    # The number for the status port
smsdone=0       # To determine if sms message has been sent
debounce=0      # A Bit of software debounce

while :
do
#       echo "infinite loops  hit CTRL+C to stop"

result=$(/bin/pin $status)      # The result of reading the status pins # Line 18
#echo $result

if test $result -gt 120 && test $debounce -eq 5 && test $smsdone -eq 0  # line 21
        then                    # To be at this point, the contacts have been closed for 500 mS
#       echo "Yes"              # And the sms gateway has not been used
#       usleep 100000
#       echo $debounce
        /usr/etc/one            # The computer emits a sequence of 'beep' musical sounds
        /usr/etc/psms1          # The sms gateway will be accessed to 'page' mobiles
        smsdone=1
        debounce=0

elif test $smsdone -eq 1        # Line 31
        then sleep 120          # Sleep for 2 minutes
        smsdone=0

elif test $result -gt 120 && test $smsdone -eq 0        # Line 35
        then debounce=$(expr $debounce + 1)
        usleep 100000
#       echo $debounce

else
#       echo "No"                       # Line 40
        debounce=0
        usleep 100000

fi                              # Line 45

done


Not very elegant but a start.

Adrian
Back to top
View user's profile Send private message 
seaside

Joined: 11 Apr 2007
Posts: 886

PostPosted: Mon 11 Nov 2013, 17:00    Post subject:  

AdrianH,

You may find some useful material for parallel port using basic and c here-
http://basic-converter.proboards.com/thread/191/parallel-port-control

Cheers,
s
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 2 [23 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Taking the Puppy out for a walk » Misc
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1304s ][ Queries: 11 (0.0342s) ][ GZIP on ]