Go to advanced search

by kghunt
Wed Aug 07, 2013 6:35 pm
Forum: Python
Topic: USB RFID door alarm system help with code needed
Replies: 48
Views: 6994

Re: USB RFID door alarm system help with code needed

Try elif http://docs.python.org/2/tutorial/controlflow.html Those contacts looks fine. As for storing the badges if it's a few then hard code them but if it's lots or the are likely to change put them in a file or list. Or a file read into a list. Try this it doesn't take long a d will teach you the...
by kghunt
Wed Aug 07, 2013 4:23 pm
Forum: Python
Topic: USB RFID door alarm system help with code needed
Replies: 48
Views: 6994

Re: USB RFID door alarm system help with code needed

Yes reed contacts are pretty standard.

These are the sort of thing I am thinking of.

http://www.screwfix.com/p/tate-door-win ... tact/65547
by kghunt
Wed Aug 07, 2013 4:05 pm
Forum: Python
Topic: USB RFID door alarm system help with code needed
Replies: 48
Views: 6994

Re: USB RFID door alarm system help with code needed

Weird just tested it here again and it works. #!/usr/bin/env python #The shebang card = '0019171125' # Stored good card number consider using a list or a file. def main(): # define a main function. while True: # loop until the program encounters an error. badgeno = raw_input() # capture the keyboard...
by kghunt
Wed Aug 07, 2013 3:26 pm
Forum: Python
Topic: USB RFID door alarm system help with code needed
Replies: 48
Views: 6994

Re: USB RFID door alarm system help with code needed

Run 'lsusb' in the terminal with the device unplugged. Then run lsusb again and you should see what device it is. Also you can run. ls /dev/ttyUSB* in both scenarios. If it is not a usb serial device it will give you this error. ls: cannot access /dev/ttyUSB*: No such file or directory if it is you ...
by kghunt
Wed Aug 07, 2013 3:20 pm
Forum: Python
Topic: USB RFID door alarm system help with code needed
Replies: 48
Views: 6994

Re: USB RFID door alarm system help with code needed

Here is a basic example to get you started #!/usr/bin/env python #The shebang card = '0019171125' # Stored good card number consider using a list or a file. def main(): # define a main function. while True: # loop until the program encounters an error. badgeno = raw_input() # capture the keyboard in...
by kghunt
Tue Aug 06, 2013 9:56 pm
Forum: Raspbian
Topic: 2xRPi file transfer - Run from C code
Replies: 3
Views: 1104

Re: 2xRPi file transfer - Run from C code

Sockets are trivial in python. Probably < 10 lines of code each side. I have done this and I am a noob.
by kghunt
Mon Aug 05, 2013 9:37 pm
Forum: Python
Topic: USB RFID door alarm system help with code needed
Replies: 48
Views: 6994

Re: USB RFID door alarm system help with code needed

Thanks i will look into sourcing one. Do they need an external power supply or will the run of the gpio? Does anyone have the time to put together the main code for it? Should be fine off a gpio as you are no pass voltage through it just using it to switch a ground. I do think you should have a go ...
by kghunt
Mon Aug 05, 2013 9:27 pm
Forum: Python
Topic: How to run a python or bash command from Apache
Replies: 4
Views: 1881

Re: How to run a python or bash command from Apache

I have done this before with php apache and python. I set up a simple php page (no visible content) then call the URL passing URL encoded commands which are the passed as arguments to python code. It's actually relatively simple.
by kghunt
Mon Aug 05, 2013 9:12 pm
Forum: Camera board
Topic: diy ip multifunction door access controller
Replies: 5
Views: 3958

Re: diy ip multifunction door access controller

It does work. However if you want to be absolutely sure it will always be perfect you would need a microcontroller but I think for these purposes is just over complicates and increases the cost. I would be pretty confident about putting a pi in production as an access control unit, assuming that the...
by kghunt
Mon Aug 05, 2013 9:07 pm
Forum: Python
Topic: USB RFID door alarm system help with code needed
Replies: 48
Views: 6994

Re: USB RFID door alarm system help with code needed

All you need is a standard door reed contact available for a couple of quid at screw fix or similar place. It is essentially a magnet controlled switch. Make pin as an input but set its pull-up to high. Then connect one side of the contact to the gpio and the other to ground. When you pass the magne...
by kghunt
Mon Aug 05, 2013 8:58 pm
Forum: Beginners
Topic: Help with a startup script.
Replies: 7
Views: 1227

Re: Help with a startup script.

First step is to put all your commands in an .sh file and make it executable with chmod a+x filename.sh Run this script manually to make sure it has the desired output. ./filename.sh Then edit crontab crontab -e And add this @reboot sh /pathtofile/filename.sh & The ampersand at the end backgrounds t...
by kghunt
Mon Aug 05, 2013 8:48 pm
Forum: Camera board
Topic: diy ip multifunction door access controller
Replies: 5
Views: 3958

Re: diy ip multifunction door access controller

I work in the access control business and I have thread on wiegand already. http://www.raspberrypi.org/phpBB3/viewtopic.php?f=32&t=12632 My experiences are, interrupts in python on the rpi for this use are pretty much junk and while I optimised my code a lot and put a lot of effort into doing so (as...
by kghunt
Sun Aug 04, 2013 8:59 pm
Forum: General discussion
Topic: Paper-Duino-Pi
Replies: 33
Views: 12119

Re: Paper-Duino-Pi

My point was not to run the cloud based arduino ide from the pi itself... What would be the point in that when you can just used the arduino ide... :? The codebender application has the function to upload to remote arduinos using Ethernet shields. So I was thinking more on the lines of a virtual Eth...
by kghunt
Fri Aug 02, 2013 9:24 pm
Forum: Automation, sensing and robotics
Topic: How to Auto start a python script that uses GPIO tx/rx pins
Replies: 12
Views: 27688

Re: How to Auto start a python script that uses GPIO tx/rx p

Yes use sysvinit or use cron to call your script every minute and have your script check to see if the system just booted. But just installing upstart is a lot easier as the point of upstart is its ease of use. Sysvinit scripts are a lot more complex. Or the most simple method by far is to add a cro...
by kghunt
Fri Aug 02, 2013 7:38 pm
Forum: General discussion
Topic: Paper-Duino-Pi
Replies: 33
Views: 12119

Re: Paper-Duino-Pi

What about a plugin for the pi (software) that enables you to upload sketches etc using codebender.cc web based arduino ide... I have pledged for one of those arduinos and ill be pledging for at least a couple of pi specific ones. It would be good if the piduino could power itself and the pi by a 6-...
by kghunt
Mon Jul 29, 2013 9:01 pm
Forum: Other projects
Topic: Keyboard 3D Print Project
Replies: 6
Views: 2893

Re: Keyboard 3D Print Project

ZX berry anyone? :D Now all you need is a tape drive which is really a hard disk and gpio prototype area (under pop up tape deck)
by kghunt
Wed Jul 24, 2013 9:28 pm
Forum: Python
Topic: SMS controlled power strip
Replies: 23
Views: 8556

Re: SMS controlled power strip

Ahh I had a similar issue a few times but couldn't track it down. Unplugging it for a few seconds then plugging it back in resolves it. There must be a way to force a disconnect reconnect by software. I even considered connecting the modem power via a transistor to a GPIO pin so I could cycle the po...
by kghunt
Wed Jul 24, 2013 8:42 pm
Forum: Python
Topic: SMS controlled power strip
Replies: 23
Views: 8556

Re: SMS controlled power strip

I just noticed.

This error

Code: Select all

NameError: global name 'time' is not defined
Is because you are trying to time.sleep() without first importing time. Stick import time after your other imports.
by kghunt
Tue Jul 23, 2013 10:06 pm
Forum: Automation, sensing and robotics
Topic: How to Auto start a python script that uses GPIO tx/rx pins
Replies: 12
Views: 27688

Re: How to Auto start a python script that uses GPIO tx/rx p

I just installed upstart and all seems well. I'm going to make my default image use moebius and upstart.
by kghunt
Tue Jul 23, 2013 6:20 pm
Forum: Python
Topic: SMS controlled power strip
Replies: 23
Views: 8556

Re: SMS controlled power strip

Is usb6 definately the right port? I tend to do it by ID rather than tty as th try can change between plug ins.
by kghunt
Tue Jul 23, 2013 1:29 pm
Forum: Python
Topic: GPIO Multithreading question
Replies: 4
Views: 2724

Re: GPIO Multithreading question

I have a question.

My C program detects which input or reader was pressed and passes it to my python program. If you press multiple times each python instance is started in a new thread. What would happen if I try to open the same gpio pin from multiple threads?
by kghunt
Wed Jul 17, 2013 8:19 pm
Forum: General discussion
Topic: Why smartphones' filesystem do not corrupt like RPi?
Replies: 17
Views: 3137

Re: Why smartphones' filesystem do not corrupt like RPi?

Me either and I do hoik the power on it too fairly regularly. I almost never shut it down in fact.
by kghunt
Sun Jul 14, 2013 8:27 pm
Forum: Beginners
Topic: Debating on which language to learn
Replies: 10
Views: 1991

Re: Debating on which language to learn

I first learnt python and while its great and still my first choice to work with. I had to write portions of my latest project in C. Mainly to do with accessing gpio. I found python to be very unpredictable at low level interfacing. When you are trying to catch pin changes (even using interupts) Pyt...
by kghunt
Fri Jul 12, 2013 9:22 pm
Forum: C/C++
Topic: First c program write in raspberry pi.
Replies: 55
Views: 44344

Re: First c program write in raspberry pi.

I am using adafruit a web ide as I do not have X installed on my pi.
by kghunt
Fri Jul 12, 2013 9:20 pm
Forum: Python
Topic: SMS controlled power strip
Replies: 23
Views: 8556

Re: SMS controlled power strip

Somehow you have changed the code and it is trying to perform a split on no data and failing. Either find why there is not data or capture that error using try: except:

What serial port is your modem on?

Go to advanced search