PDA

View Full Version : Web Server or a Data Base for Basic Stamp?



Goten
01-26-2006, 06:58 AM
I was looking for a web server for a basic stamp on google, and it takes me to Parallax and i saw a discontinued web server product.

If you know some web server or data base that can be connect directly to basic Stamp, please let me know. otherway i was thinking on program the basic stamp on visual Basic adn then link it to SQL ... it'll be really hardcore.


Best Regards.
Goten

Ryan Clarke
01-26-2006, 07:06 AM
http://www.parallax.com/detail.asp?product_id=30013


Ryan

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ryan Clarke
Parallax Tech Support

RClarke@Parallax.com (mailto:RClarke@Parallax.com)

Goten
01-26-2006, 11:55 AM
Ryan, let me know if i'm wrong, but as i can see i could connect my bs2 (Rs232 Cable or other way) to·the Parallax Internet Netburner and get a RJ45 EXIT?,·i really don't understand too much about·the tool, whats the idea.

I'm wondering if anyone could·link·a pbasic algorithm with a data base, like access, sql, etc.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Best Regards from Chile

Goten

Kevin Wood
01-26-2006, 01:40 PM
Goten,

Do a forum search for PINK. There is a lot of info already posted. As for your database connection, you will need to either program your database to accept info from a serial connection, or write a program that accepts info from a serial connection, then updates the database. If you explain exactly what you are trying to do, it would be easier to offer suggestions.

Goten
01-26-2006, 02:31 PM
It's a RFID·Access Control, if the tag it's· authorized activates the lock if not nothing happend,·both gives the information about who use the tag, the time, and more details, the idea is that some person could see the activity by internet, and could change the algorithm by a remote server. that's all. i attach an image (please correct me if·i don't writte good)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Best Regards from Chile

Goten

stamptrol
01-26-2006, 09:04 PM
Goten

I've been working with the PINK module for a month or so, and have found it to quite easy to work with.

Basically, the PINK has the rj45 ethernet connector that plugs into your router. A utility program allows you to see what address has been assigned to the PINK by the router's DHCP. ( or you can assign a static address).

The other connector is a serial port which allows the Stamp to load or read about 100 registers on the PINK module. By writing a short HTML web page, any of those registers can be read or modified from the Web.

For your project, the Stamp could certainly contain the card ID's for quite a large number of cards, assuming the decision was go/no go based on a card number. The Stamp could easily update the PINK to tell which cards had been active recently. AS well, with a bit of ingenuity, you could load a card number into the PINK from the Web, get the Stamp to read it and add it or remove it from the cards that are active.

You can have a look at a really simple web page running on the PINK by going to 142.167.67.191 the username is sci, the password is katomda

It is set to update the counter value every 5 seconds.

Cheers,

Tom

Tom Walker
01-26-2006, 10:08 PM
Goten,
If you are currently focussing on the idea that the Stamp can somehow "directly" perform relational database functions, you might need a little more education in microcontrollers :) The Stamp will have to communicate with a far more powerful machine for it's database access. Without external EEPROM, larger variable space, and magnitudes more horsepower, the best that should be expected of a microcontroller (ANY microcontroller) is to be able to perform lookups on an EEPROM based table (for us "average Joes" anyhow...).

Now, if you throw a PC into the mix for the database handling functions, the Stamp can easily act as the interface between it and the RFID and locking mechanism hardware...

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Truly Understand the Fundamentals and the Path will be so much easier...

Goten
01-27-2006, 11:00 PM
thanx for all your help.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Best Regards from Chile

Goten

Bullwinkle
01-31-2006, 10:07 AM
If the server running the database was close by you could connect it to the STAMP by a serial cable. You'd then need to write an application that runs on the server to read a message from the STAMP, performed an SQL lookup and returned the result in the expected format to the STAMP. Your could write this in PHP, Perl, C or your favourite programming language.

I'd make the protocol between your STAMP and the server as simple and economical as possible to cut down on the memory requirements of your STAMP code.

Goten
02-01-2006, 01:11 AM
The basic stamp it's always connected to the computer, but i though that i wasn't possible to read a message from the STAMP.

I need the Pink Module for That???

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Best Regards from Chile

Goten

Tom Walker
02-01-2006, 03:19 AM
The PINK module allows the Stamp to communicate to a network via web pages. It will be in the middle of your PC and the PINK. A simplified typical series of activities might go like this:
1. PINK serves the web page and a client responds.
2. PINK "GET"s some variables and sends them to the STAMP.
3. The Stamp sends its request to the PC via a serial interface.
4. The PC does the database thing.
5. The PC sends its response to the Stamp.
6. The Stamp updates the variables·to PINK·which "POST"s them to the web page.

If any of the previous steps (or transitions between the steps) is confusing, then perhaps some more education is in order.

HTH

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Truly Understand the Fundamentals and the Path will be so much easier...

Post Edited (Tom Walker) : 1/31/2006 7:53:37 PM GMT

DiablodeMorte
02-02-2006, 02:14 AM
Well. You could do something like:
For Card Reads:
-Stamp Reads Card
-Stamp "asks" computer if card is valid
-Card IS valid(Via Comp db relation[mysql?])
--Stamp Opens Lock
--Computer FTPS to the pink and downloads auth.html
--Computer Amends to auth.html and ftps back to pink.. Pink now has accuarted auth info

For Add/Removal of cards
-Pink tells stamp to remove 14732463834
-Stamp tell comp to remove 14732463834
-Comp removes 14732463834
-Comp tells stamp 14732463834 is removed
-Stamp tells pink 14732463834 is removed

I will look into the pink's mime types

Tom Walker
02-02-2006, 02:17 AM
...and if you combine the last two posts, all of the devices/requests previously mentioned should be covered :)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Truly Understand the Fundamentals and the Path will be so much easier...

Goten
02-02-2006, 03:06 AM
Excellent, i really appreciated what you posted.

Do you know where i can find some information about this step "Card IS valid(Via Comp db relation[mysql?])"

I really need to learn that.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Best Regards from Chile

Goten

Paul Baker
02-02-2006, 03:54 AM
I looked a little for you on the SQL<->BS2 interface, and it has been done by various people, but I could not find any concrete examples other than a general description of methodology. Everyone I could see that talked about it, created a PC program to provide an SQL interface for the stamp in this chain: SQL<->PC interface program<->serial port<->Basic Stamp. Any prorgaming language which supports both SQL and serial ports will work to create the interface program. Since you are adding a software layer in the mix, you can make the communication with the stamp to be more stamp friendly (Not nessesary for the BS2 to form properly structured SQL requests, the PC program can worry about that).

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10

Tibo
02-02-2006, 04:42 AM
Have a look here : http://www.4d.com/docs/CMU/CMU79730.HTM

Tom Walker
02-02-2006, 04:49 AM
I envision something like this:
1. Stamp sends serial message to PC like V123456. (validate number 123456)
2. PC program receives message and queries database.
3. Based on record count of returned dataset, PC either responds serially to Stamp with Y or N.
4. Stamp acts accordingly.

This is assuming very simplistic "one RFID reader" operation. A more complex (and robust) messaging system will need to be developed otherwise.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Truly Understand the Fundamentals and the Path will be so much easier...

Orion
02-02-2006, 11:01 AM
Goten said...
Excellent, i really appreciated what you posted.

Do you know where i can find some information about this step "Card IS valid(Via Comp db relation[mysql?])"

I really need to learn that.

This should easy,·a SQL query along the lines of
·
SELECT * FROM users WHERE card="xxxxxxx";
·
If you get a result you know the·card exists.·
·
Look into SQL query syntax and it should become pretty clear
.

Post Edited (Orion) : 2/2/2006 3:11:35 AM GMT

Orion
02-02-2006, 11:24 AM
You may want to look at other means of getting the data from the stamp <=>ethernet<=>PC. Http will work but it's clunky to get 2way serial communication. UDP or telnet would work more like a serial connection. With http you’re going to have to refresh the page regularly to detect the stamp requesting validation. Telnet is basically an Ethernet, 2 way serial connection. Wait and listen for message, no constant transfer of http pages.

Post Edited (Orion) : 2/2/2006 3:27:22 AM GMT

DiablodeMorte
02-02-2006, 09:45 PM
Actually. As long as the computer <-> Stamp Connection is fast you would only need to rehresh once for things like removal and never have to refresh for looking at auths

Example:

(B) = User At Browser
(B) POSTES on removeCard.html with the card number
(B) Is presented with a "do you really want to do this? Selects YES
(B) Is told to "Please wait for 30 seconds for the transaction(PC<->Stamp relations)
(B) After 30 seconds the page refreshes(First Refresh)
(B) Is told the operation is complete and the stamp resets the 2 used vars


THat's one page refresh

As far a mysql <-> PC communication one could write it in C w/ a serial component. It would be light and maybe even comand line

Orion
02-03-2006, 07:31 AM
Can you post data without the user interaction, submit button?

Goten said...
It's a RFID·Access Control, if the tag it's· authorized activates the lock if not nothing happend,·both gives the information about who use the tag, the time, and more details, the idea is that some person could see the activity by internet, and could change the algorithm by a remote server. that's all. i attach an image (please correct me if·i don't writte good)


····· I was thinking of a simple card access system, where the stamp would read the card and report to the pc.··The pc would check the db and send back a pass/fail to the stamp which would handle unlocking the door.· So the user would not·do anything other than present a card.· The html pages would be for the system admin to see who entered, when and where, enable cards, schedule doors.·

Post Edited (Orion) : 2/4/2006 12:03:02 AM GMT

Goten
02-08-2006, 05:36 AM
Orion said...
where the stamp would read the card and report to the pc.··The pc would check the db and send back a pass/fail to the stamp which would handle unlocking the door.·
·· This it is the exact idea.
····Right now·I am using pbasic to recognize the tag and·activate the lock,·my problem it·is that I do not know··how to accede to a database from·a bs2, i don't know if i could use the·Stamp Daq for excel, the module Pink or another thing. Help.


Thanx

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Best Regards from Chile

Goten

Tibo
02-08-2006, 05:51 AM
Goten,

To do so, you ONLY need to create a program, not to buy any other devices than the RFid reader, the automated lock and your PC.
This program will listen/talk through a serial port (COM1 or COM2 or ...).
The BS2 will be at the other end of the serial cable and that's all folks, you're done !

The stamps is waiting for a card...
The stamp reads a card (and tell the PC through serial line).
The PC then knows an RFID event happend, and wait for the ID number.
The stamp then tell the ID number to the PC.
The PC checks in the database.
The PC returns a status code to say 'ok' or 'no' (I suggest a beep to tell user " http://forums.parallax.com/images/smilies/nono.gif ").
The stamps is waiting for a card (and so on)...

This require a bit of programming langage other than PBASIC (such as java, c, etc..) and an adapted database (mySQL) and the SQL driver to interact with the database.
Interesting project, keep us informed !
++
PS. I dont know how commanded/automated locks work so I did not mention this aspect of your project.
PS². If there are only a few people who will use a RFid 'key', how about using a flat file '.txt' instead of all the database mecanic ?

Post Edited (Tibot) : 2/7/2006 10:00:52 PM GMT

Paul Baker
02-08-2006, 05:55 AM
First you need a database running on the PC (obviously), second you need to create another program on the PC (use Visual Basic or any other programming language you are comfortable with) that will do the BS to database link. Such a program is beyond the scope of these forums (though someone may end up helping you, creation of PC programs isn't really covered in these forums).

I have played around with the database included in Borland's C++ Builder 3.0 Enterprise Edition and created a simple C++ program to make database inquiries. You would have to use a similar software development package for the PC.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10

Post Edited (Paul Baker) : 2/7/2006 10:01:33 PM GMT

Orion
02-08-2006, 09:43 AM
If this is something you wanted to use on more than one door, ethernet would have a huge benefit over serial communication. If you use this on 10 doors with separate stamps doing each door, serial is going to become a major headache. With ethernet you can easily have 10 controllers into a hub and a single cable to the pc. This would be much easier than trying to setup com1-10 on a pc. Also the cable length restriction of rs232 vs ethernet, would be anther reason you may want to use ethernet

Basically you need to define what you’re trying to do in more detail, instead of us guessing.

Goten
02-10-2006, 09:44 PM
In fact, i'm working with 2 doors, but it could increase.


i saw on internet (black box) a rs232 to rj45 converter. but i thought that i could use 2 rfid reader with just one bs2.

i really don't know to much about programming, i just had use pbasic... what you suggest?· Tibot said Java, Paul Bake Visual Basic... and others c++, think that i'm a newbie

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Best Regards from Chile

Goten

DiablodeMorte
02-10-2006, 10:15 PM
Um. If you are running windows(I assume) You should probably start out with Visual Basic (.net?) becasue it is fairly easy to learn and is very easy to deisgn a gui for debug. I do agree w/ Orion(sp?) and that if you were managing more than 1 door ehternet is the way to go. Under that assumption that the PINK can send UDP messages(I really don't remeber and don't have time to look it up) you could do something like:

(D) = Door/RFID/BAsic Stamp/PINK contraption

(D) Gets RFID Scan
(D) (PINK) Sends udp message to computer via ETHERNET
PC does its database thing
(D) (Basic stamp) Listens for a new udp message on the pink
(D) (Basic stamp) If new udp is "Y" Opens Door, if not beeps loudly and annoyingly

Paul Baker
02-10-2006, 10:15 PM
Well considering you are not a seasoned programmer, it usually best to stick with what you know. While PBASIC and Visual Basic are very different they are more similar than any of the other languages. There are also many different varieties of the Basic language for the PC. You should start a new thread in the Sandbox asking for peoples opinion on which version of Basic for the PC you should get, stating that you want it to be as similar to PBASIC as possible, come with a database, or easily interface with a free or cheap database availible seperately and supports RS-232 and network (ethernet) communications on the PC.

I advise that you stick with the RS232 link with the stamp for now, it eliminates the need for purchasing the PINK module and simplifies the programming on both the Stamp and PC side. You want to make the first iteration of your design as simple as possible. Once you have that working like you want, you can then think about moving it to ethernet communications.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10

Post Edited (Paul Baker) : 2/10/2006 2:22:35 PM GMT

Tom Walker
02-10-2006, 10:27 PM
In addition, I would recommend taking this in steps. First get the RFID reader to talk to the Stamp (verify by DEBUGging to the IDE). Then, get the Stamp to activate the lock. Then, get the Stamp to respond (unlock or raspberry) to a message from the PC (DEBUG terminal or HyperTerm should be sufficient for providing the PC "response"). Then figure out your database and the appropriate communications with it.

This may seem like a lot of work, but you will be much better served by the things you learn and the gratification of completing each of these tasks.

Good Luck!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Truly Understand the Fundamentals and the Path will be so much easier...

Paul Baker
02-11-2006, 01:38 AM
Righto, Tom. The most important lesson any newbie can learn about embedded design is to start off as small as possible, baby steps all the way. Subdividing portions of the final project into independent sub-projects, getting each sub-project working in its own right, then worry about integrating them, again in a step by step fashion. For the newbies on the forum this is called "limiting the scope", it reduces the number of places a bug can pop into your code or hardware, making the task of finding it much, much easier. Way too many people just starting off; wire everything up at once, write all the code, then just stare at the code and hardware when it doesn't work. Do yourself and us a favor and practice limiting the scope of your projects. When you post your code asking us for help and it runs page after page, it is perfectly clear that you didn't follow this technique, because the bug would have entered your code when it was much smaller if you did follow the technique (smaller code also helps us track down were the problem is when we try to answer your question).

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10

Post Edited (Paul Baker) : 2/10/2006 5:44:24 PM GMT

Goten
02-11-2006, 02:00 AM
muchas gracias
Thank u Very much.http://forums.parallax.com/images/smilies/turn.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Best Regards from Chile

Goten

Paul Baker
02-11-2006, 02:40 AM
Best of luck Goten, and keep us posted on your project.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10