PINK dummies. How to control your robot online. Eureka! It works!!!
latigerlilly
Posts: 114
Hi guys,
Thanks for all your help! After a week of tinkering, I finally got my PINK module to work! Cool!!!! I purchased a PINK module so that I could control a mobile robotic platform using wireless internet. For those of you who are interested, here's my saga (might be useful if you are a novice contemplating purchasing a PINK module);
After hooking everything up and writing a computer program to test the PINK module, it didn't work. Here are my mistakes so you could learn from them (instead of learning from the school of hard knocks);
1. As allanlane5 and Chris Savage pointed out, there are no string compare operators in PBasic. In other words, you can do IF (variable = "g") THEN but you cannot do IF (variable = "god") THEN. This was kinda confusing because nowhere did I see in the documentation, "There are no string compare operators in PBasic. Here are a few blocks of code to illustrate what we mean."
2. The chip holder for the BS2P40 on the PDB requires you to push the chip almost all the way down so that it is almost flush with the mounting holes. The pins are almost completely inside the holes. This is different from the BOE where the BS2 sits quite high off the mounting holes and quite a bit of pin is showing. Nowhere in the documentation is there a picture of the chip mounted on the PDB from the side. Thanks to Steve Joblin, Mike Green, and Chris Savage (my savior) for telling me this.
3. My router is in the next room and I don't have a long cable so I have to be able to test the PINK module with a computer entering data via the internet in another room. At first I used a LED display. This proved to be unfeasible since I had to run 60 feet every time I tested the module to see if my experiment worked or not. So, I altered my program to use the speaker on the PDB to give a solid 2 second beep when you type the word "odd" in an online form, a rattle like a machine gun when you type "god", and an intermittent short beep every 2 seconds when you type "dog". "dog" is the default variable, by the way. Since I could hear the speaker from 30 feet away, I could test the PINK module from 30 feet away without having to run back and forth.
4. After poring over the documentation in the PBASIC reference in my BASIC stamp editor for the commands SERIN/SEROUT and reading the PINK manual with a fine tooth comb, I decided that my program did not work because there was not enough pause before the SERIN/SEROUT commands to allow for PINK to get on the network and for PINK to read/write serially. So, I added a 200 ms pause for initialization and a 300 ms pause before the SERIN/SEROUT commands.
5. I did not realize that you had to communicate with PINK at 9600 baud, 8 bit, no parity, true if you are using the BS2P40. I tried setting it on 2400 baud, 8 bit, no parity, true, but it didn't work. So, per the example on pg 12 of the PINK manual, I set the baudmode for 240 to correspond with 9600 baud, 8 bit, no parity true. I deviated from the example because I thought that running it at 2400 baud would make the communication more reliable, according to the PBASIC reference in my BASIC stamp editor. 9600 baud is the default baud rate, but the manual doesn't say so. I'm not sure (I haven't tested this), but I think you can change the baud rate by using the program IPSetup. You can then just make sure your baud rate in the programming matches the baud rate on the PINK. I decided to just use the default because it would be a pain to have to adjust the baud rate manually online before using the robotic platform. Going with the default keeps it simple.
6. There has to be a default variable in PINK's flash memory or there has to be a variable already on PINK in RAM (pressing reset on the PDB will restart the program while leaving PINK "on" and RAM intact) or the program will not work. This is because SERIN/SEROUT will look for a variable. If it finds no variable, then this fault will cause the program to grind to a halt. You would think that if there is no variable there, SERIN/SEROUT would grab a null variable and the remainder of the program would still work. This is not true. Nowhere in the PINK manual does it mention "SERIN/SEROUT will not grab null variables. Here are some blocks of code to illustrate what we mean."
7. I had to read the PBASIC reference in my BASIC stamp editor like a book by choosing the topic and then slowly reading the selection to see if it contains the information that I need. The search function wouldn't work. I have Windows XP and the newest Adobe Acrobat Reader. This slowed my progress. Every time I tried to search the PBASIC reference, my computer would freeze up.
8. There is a minor confusion regarding how to connect everything up on page 2 of the PINK manual if you are not using a BS2. I have a BS2P40. Please refer to my schematic in the next post of this thread for a clarification.
I am a total goofball novice as my only Stamp 2 projects previous to this are a BOE-BOT and some simple Stamp 2 driven relays to control 2 medical devices. It is a testament to Parallax's voluminous user-friendly documentation and, most of all, human tech support (Chris Savage, my savior) that has allowed a total novice to be able to do a fairly complex project with zero formal engineering/programming background. I try my best to give a little back by answering questions from even greener newbies than myself here on this forum. Again, to give a little back to the forum, I've written this PINK for dummies post so that any time any newbies have questions about PINK, someone only has to tell this newbie to search for "PINK" and "dummies" and ye shall have all the answers to your questions. By reading the online documentation on the Parallax website and this post, any novice, no matter how green, should be able to get started with the PINK module. I will add more points to this post later as I learn more stuff regarding the PINK module that is not readily apparent to a novice.
Thanks a lot guys! With special thanks to the cool guys/girls of Parallax, and Chris Savage (my savior)!
Much Appreciation,
Lilly.
Thanks for all your help! After a week of tinkering, I finally got my PINK module to work! Cool!!!! I purchased a PINK module so that I could control a mobile robotic platform using wireless internet. For those of you who are interested, here's my saga (might be useful if you are a novice contemplating purchasing a PINK module);
After hooking everything up and writing a computer program to test the PINK module, it didn't work. Here are my mistakes so you could learn from them (instead of learning from the school of hard knocks);
1. As allanlane5 and Chris Savage pointed out, there are no string compare operators in PBasic. In other words, you can do IF (variable = "g") THEN but you cannot do IF (variable = "god") THEN. This was kinda confusing because nowhere did I see in the documentation, "There are no string compare operators in PBasic. Here are a few blocks of code to illustrate what we mean."
2. The chip holder for the BS2P40 on the PDB requires you to push the chip almost all the way down so that it is almost flush with the mounting holes. The pins are almost completely inside the holes. This is different from the BOE where the BS2 sits quite high off the mounting holes and quite a bit of pin is showing. Nowhere in the documentation is there a picture of the chip mounted on the PDB from the side. Thanks to Steve Joblin, Mike Green, and Chris Savage (my savior) for telling me this.
3. My router is in the next room and I don't have a long cable so I have to be able to test the PINK module with a computer entering data via the internet in another room. At first I used a LED display. This proved to be unfeasible since I had to run 60 feet every time I tested the module to see if my experiment worked or not. So, I altered my program to use the speaker on the PDB to give a solid 2 second beep when you type the word "odd" in an online form, a rattle like a machine gun when you type "god", and an intermittent short beep every 2 seconds when you type "dog". "dog" is the default variable, by the way. Since I could hear the speaker from 30 feet away, I could test the PINK module from 30 feet away without having to run back and forth.
4. After poring over the documentation in the PBASIC reference in my BASIC stamp editor for the commands SERIN/SEROUT and reading the PINK manual with a fine tooth comb, I decided that my program did not work because there was not enough pause before the SERIN/SEROUT commands to allow for PINK to get on the network and for PINK to read/write serially. So, I added a 200 ms pause for initialization and a 300 ms pause before the SERIN/SEROUT commands.
5. I did not realize that you had to communicate with PINK at 9600 baud, 8 bit, no parity, true if you are using the BS2P40. I tried setting it on 2400 baud, 8 bit, no parity, true, but it didn't work. So, per the example on pg 12 of the PINK manual, I set the baudmode for 240 to correspond with 9600 baud, 8 bit, no parity true. I deviated from the example because I thought that running it at 2400 baud would make the communication more reliable, according to the PBASIC reference in my BASIC stamp editor. 9600 baud is the default baud rate, but the manual doesn't say so. I'm not sure (I haven't tested this), but I think you can change the baud rate by using the program IPSetup. You can then just make sure your baud rate in the programming matches the baud rate on the PINK. I decided to just use the default because it would be a pain to have to adjust the baud rate manually online before using the robotic platform. Going with the default keeps it simple.
6. There has to be a default variable in PINK's flash memory or there has to be a variable already on PINK in RAM (pressing reset on the PDB will restart the program while leaving PINK "on" and RAM intact) or the program will not work. This is because SERIN/SEROUT will look for a variable. If it finds no variable, then this fault will cause the program to grind to a halt. You would think that if there is no variable there, SERIN/SEROUT would grab a null variable and the remainder of the program would still work. This is not true. Nowhere in the PINK manual does it mention "SERIN/SEROUT will not grab null variables. Here are some blocks of code to illustrate what we mean."
7. I had to read the PBASIC reference in my BASIC stamp editor like a book by choosing the topic and then slowly reading the selection to see if it contains the information that I need. The search function wouldn't work. I have Windows XP and the newest Adobe Acrobat Reader. This slowed my progress. Every time I tried to search the PBASIC reference, my computer would freeze up.
8. There is a minor confusion regarding how to connect everything up on page 2 of the PINK manual if you are not using a BS2. I have a BS2P40. Please refer to my schematic in the next post of this thread for a clarification.
I am a total goofball novice as my only Stamp 2 projects previous to this are a BOE-BOT and some simple Stamp 2 driven relays to control 2 medical devices. It is a testament to Parallax's voluminous user-friendly documentation and, most of all, human tech support (Chris Savage, my savior) that has allowed a total novice to be able to do a fairly complex project with zero formal engineering/programming background. I try my best to give a little back by answering questions from even greener newbies than myself here on this forum. Again, to give a little back to the forum, I've written this PINK for dummies post so that any time any newbies have questions about PINK, someone only has to tell this newbie to search for "PINK" and "dummies" and ye shall have all the answers to your questions. By reading the online documentation on the Parallax website and this post, any novice, no matter how green, should be able to get started with the PINK module. I will add more points to this post later as I learn more stuff regarding the PINK module that is not readily apparent to a novice.
Thanks a lot guys! With special thanks to the cool guys/girls of Parallax, and Chris Savage (my savior)!
Much Appreciation,
Lilly.
Comments
' Learning how to use PINK with the PDB - godsound.bsp
' When PINK sends the variable "god" to the BS2P40 mounted on a PDB, you get a stuccato sound like a machine gun.
' When PINK sends the variable "odd" to the BS2P40 mounted on a PDB, you get a continuous beep.
' When PINK sends the varable "dog" to the BS2P40 mounted on a PDB, you get a short beep every 2 seconds.
' "dog" is the default variable.
' {$STAMP BS2p} ' Stamp Directive
' {$PBASIC 2.5} ' PBASIC Dircetive
' Variables
NBVAR VAR Byte(3) ' Variable passed from PINK to BS2P40
reps VAR Nib ' FOR... NEXT loop counter
' Initialization
MAINIO ' pg 6 of PDB Manual
FREQOUT 10, 7547, 1246 ' PBASIC Syntax Guide in BASIC Stamp Editor
PAUSE 4000 ' 4000 ms pause to wait for PINK to connect to network. If this is not enough time, increase value and/or press the reset button on the PDB.
'If no button is pressed, then put dog in variable 01
SEROUT 13,240,[noparse][[/noparse]"!NB0W01:dog",CLS]
' Main Routine
DO ' Do... Loop in PBASIC Syntax Guide
' Gets Data From PINK.
PAUSE 300 ' 300 ms pause to wait for PINK serial reads/writes.
AUXIO ' Pg 6 of PDB Manual
SEROUT 13,240,[noparse][[/noparse]"!NB0R01"] ' Tells PINK to give BS2P40 the data. Info about SERIN/SEROUT in PBASIC Syntax Guide.
SERIN 12,240,[noparse][[/noparse]STR NBVAR\3] ' Gets Data from PINK.
MAINIO
' If 3 letter variable from PINK begins with a "g" then make a stuccato sound like a machine gun.
IF (NBVAR(0) = "g") THEN
FOR reps = 1 TO 8
FREQOUT 10, 472, 156, 312
PAUSE 125
NEXT
' If 3 letter variable from PINK begins with a "o" then make a continuous beep.
ELSEIF (NBVAR(0) = "o") THEN
FREQOUT 10, 7547, 156, 312
' If neither of the previous 2 conditions are met then, make a short beep every 2 seconds.
ELSE
FREQOUT 10, 472, 156, 312
PAUSE 1575
ENDIF
LOOP
Post Edited (latigerlilly) : 2/25/2007 2:55:38 AM GMT
<html>
<head>
</head>
<body>
<big><b><center>Pink Experimental Webpage</center></b></big>
The value of variable 01 is: <Nb_var01>
<FORM method="post" action="/experwebpage.html">
<P>
What value would you like stored in variable 01?
<INPUT name="Nb_var01" type="text" size="3" maxlength="3">
<INPUT type="submit">
</P>
</FORM>
</body>
</html>
Good work and thanks for posting it!
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
Now tell me if I’m wrong. Pink allows a person to control a stamp from any computer that is tied to the internet? Does it require that you download software to the satellite computer? For instance, can it be accessed from a public library where it mat be prohibitive to download or load unauthorized software? Or how about from a satellite dial-up connection?
I think I’m going to get one of those especially now that you laid it out so well. I could probably have one up and running in no time!
Nice work!
-J
P.S. Sorry to hit you up with so many questions
Yes, PINK can be controlled by any DEVICE (it doesn't even have to be a computer) with a web browser! Please note the HTML webpage in the 3rd post in this thread. No special software installation is needed (as long as you have a working browser). Once you have it set-up, you don't need a computer at all. Only the initial set-up where you name some variables and operating parameters (, etc) do you need a host computer. The PINK unit is a web server that will serve up webpages that you can use to enter data into it. This data will be read by the BS2. You can also write data from the BS2 into PINK. Then, the PINK module will serve up webpages like a interet server that will display such data. Satellite dish, library, (etc) is all good.
There are 3 major utilities in PINK;
1. It can email you. In other words, your BS2 can use it's sensors to collect information. Then, it can use PINK to email you this information. Keep in mind that cell phones can accept emails nowdays. Cool, eh?
2. It can talk to another PINK directly by sending a UDP message (look at Parallax documentation to see what a UDP message is). In other words, your PINK equipped BOE-BOT, if equipped with wireless ethernet access point, can coordinate it's movements with other PINK equipped BOE-BOTs. You can even make a HERD of BOE-BOTs with A.I. herding behavior. Thatz mad tight!
3. It can be used as a server to serve webpages. These webpages can collect information for PINK or display information from PINK. Therefore, a BS2 connected to PINK can display info on the internet and be controlled by someone anywhere on the planet with any device that has a browser. I am quivering with excitement!!!
Cheers,
Lilly.
Good work! I'm sure it seems so simple now! I went through the same exercise with my PINK, but it has worked fine for almost a year now.
A point to note is that in order to get at the PINK from the outside world, the IP address of the local router has to be known. This will change every time the router reboots (unless you've got a static IP address). A work-around is to have re-direction service keep track of that change and let you automatically connect even when the IP changes.
Regards,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk
http://www.siskconsult.com
·
I am having trouble getting the PINK to email me.· I have a web cam that has no problem. On my web cam I only need to put in smtp.comcast.net then a to and from email address and hit the trigger button (no login / no user name /·no password).· Why will my PINK not work.· I have tired the built in page to send a test email.·
I thought Parallax was going to have a update to the firmware.· Maybe I have missed it.· This could be my problem.
It seems like this is a great product but not much info is shared about it.· So, thanks again Lilly!
TIA
Are you sure the Webcam software isn’t piping the data through your smtp client on your PC which has the username/password saved? I have seen applications do this before. The bottom line is that if your mail server requires authentication it will need to get that information from somewhere. I am looking into possibilities for authentication but it may take some time and I cannot make any guarantees. It is being looked into though. Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
No, it does not seem to matter if my computer is on or not.· I have·a Dlink 5300G and a SONY SNC RZ30N2 camera.· I can also send an email via a Moxa Vport 2310.
I have even tried to send an mail with the camera and then send an email with the PINK.· I have heard that the authentication would then not be necessary on the PINK.
I also talked with Comcast Support and they told me no authentication was needed because they knew who I was through my cable modem.
Don't know what to do at this point.
Is there a firmware update?
Thanks,
As per your psot..... Yes it isi possible to change the baud rate of the PINK. I run all 60 of my PINKS at 2400 baud. It is done through the IPSetup Aplication. Take care...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It's Only A Stupid Question If You Have Not Googled It First!!